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 |
|---|---|---|---|---|---|---|---|---|
1613bde53cfda3d38d7e62c6c91f3d6c5407fb9c | Add script inspect_checkpoint.py to check if a model checkpoint is corrupted with NaN/inf values | liyi193328/pointer-generator,liyi193328/pointer-generator,liyi193328/pointer-generator,abisee/pointer-generator | inspect_checkpoint.py | inspect_checkpoint.py | """
Simple script that checks if a checkpoint is corrupted with any inf/NaN values. Run like this:
python inspect_checkpoint.py model.12345
"""
import tensorflow as tf
import sys
import numpy as np
if __name__ == '__main__':
if len(sys.argv) != 2:
raise Exception("Usage: python inspect_checkpoint.py <file_na... | apache-2.0 | Python | |
d5e16fdf73eb281da3541fa7a0e3f8792b83faeb | bump to 0.3.0 | ledgr/tproxy,benoitc/tproxy | tproxy/__init__.py | tproxy/__init__.py | # -*- coding: utf-8 -
#
# This file is part of tproxy released under the MIT license.
# See the NOTICE for more information.
version_info = (0, 3, 0)
__version__ = ".".join(map(str, version_info))
| # -*- coding: utf-8 -
#
# This file is part of tproxy released under the MIT license.
# See the NOTICE for more information.
version_info = (0, 2, 4)
__version__ = ".".join(map(str, version_info))
| mit | Python |
bb5a94208bb3a96995182b773998dbec4ebf7667 | Test wrapper py script | gracecox/EoSeval | py_scripts/EoSeval_test.py | py_scripts/EoSeval_test.py | # -*- coding: utf-8 -*-
"""
Code description goes in here
"""
import numpy
import EoSeq
from scipy.optimize import curve_fit
# Prompt user for filename string
# filename = raw_input("Please enter a file path for P and V data")
# Load in data file
# data = numpy.loadtxt(filename, delimiter = ',')
data = numpy.loadtxt... | mit | Python | |
9a082b04973a9927014df496aa31f5c05e8be6ca | add 143 | ufjfeng/leetcode-jf-soln,ufjfeng/leetcode-jf-soln | python/143_reorder_list.py | python/143_reorder_list.py | """
Given a singly linked list L: L0→L1→…→Ln-1→Ln,
reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→…
You must do this in-place without altering the nodes' values.
For example,
Given {1,2,3,4}, reorder it to {1,4,2,3}.
"""
# Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.... | mit | Python | |
c91c8f56940ba60190f771ef7731169e68b2053e | Create functions.py | ahmedkhaled4d/FCIH,ahmedkhaled4d/FCIH,ahmedkhaled4d/ajax_pagination,ahmedkhaled4d/FCIH | python/openCV/functions.py | python/openCV/functions.py | import numpy as np
import cv2
def nothing():
pass
def Rvalue(x):
#print('R=',x)
return x
def Gvalue(x):
#print('G=',x)
return x
def Bvalue(x):
#print('B=',x)
return x
img = np.zeros((512, 512, 3), np.uint8)
drawing = False # true if mouse is pressed
mode = True # if True, draw rectangle. Pre... | mit | Python | |
38756d3fd7ac1d858d45f256e8d4ad118ecbf531 | add basic admin file | emencia/emencia-django-socialaggregator | emencia/django/socialaggregator/admin.py | emencia/django/socialaggregator/admin.py | """Admin for parrot.gallery"""
from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from emencia.django.socialaggregator.models import Feed
from emencia.django.socialaggregator.models import Aggregator
from emencia.django.socialaggregator.models import Ressource
class FeedAdmin(ad... | agpl-3.0 | Python | |
d53ec3fefddda14e6d7fad466f5e81d3ed369330 | Add sfp_numverify module | smicallef/spiderfoot,smicallef/spiderfoot,smicallef/spiderfoot | modules/sfp_numverify.py | modules/sfp_numverify.py | #-------------------------------------------------------------------------------
# Name: sfp_numverify
# Purpose: SpiderFoot plug-in to search numverify.com API for a phone number
# and retrieve location and carrier information.
#
# Author: <bcoles@gmail.com>
#
# Created: 2019-05-25
# C... | mit | Python | |
8b7db3fc9b90897c0e8da6d6b63d12e79754c625 | Solve Knowit2019/19 | matslindh/codingchallenges,matslindh/codingchallenges | knowit2019/19.py | knowit2019/19.py | def hidden_palindrome(n):
n_s = str(n)
if n_s == n_s[::-1]:
return False
s = str(n + int(n_s[::-1]))
return s == s[::-1]
def test_hidden_palindrome():
assert hidden_palindrome(38)
assert not hidden_palindrome(49)
if __name__ == '__main__':
s = 0
for x in range(1, 12345432... | mit | Python | |
f5d4fa76c7ea97af5cd30a3840835e6b97dd0721 | Add release script. (#162) | databricks/tensorframes,tjhunter/tensorframes,databricks/tensorframes,tjhunter/tensorframes | dev/release.py | dev/release.py | #!/usr/bin/env python
import click
from datetime import datetime
from subprocess import call, check_call, check_output, PIPE
import sys
DATABRICKS_REMOTE = "git@github.com:databricks/tensorframes.git"
PUBLISH_MODES = {
"local": "tfs_testing/publishLocal",
"m2": "tfs_testing/publishM2",
"spark-package-publi... | apache-2.0 | Python | |
58d19ea654e0c8d250f46b0d72191e48b4bc8588 | add tests for encryption/decryption in awx.main.utils.common | wwitzel3/awx,wwitzel3/awx,wwitzel3/awx,snahelou/awx,snahelou/awx,snahelou/awx,snahelou/awx,wwitzel3/awx | awx/main/tests/unit/common/test_common.py | awx/main/tests/unit/common/test_common.py | from awx.conf.models import Setting
from awx.main.utils import common
def test_encrypt_field():
field = Setting(pk=123, value='ANSIBLE')
encrypted = common.encrypt_field(field, 'value')
assert encrypted == '$encrypted$AES$Ey83gcmMuBBT1OEq2lepnw=='
assert common.decrypt_field(field, 'value') == 'ANSIBL... | apache-2.0 | Python | |
8ae3e44b0a43f382c98194b9caa097b62de899ef | Add script to save ner data to a csv file | WhatWorksWhenForWhom/nlppln,WhatWorksWhenForWhom/nlppln,WhatWorksWhenForWhom/nlppln | nlpppln/save_ner_data.py | nlpppln/save_ner_data.py | #!/usr/bin/env python
import click
import os
import codecs
import json
import pandas as pd
@click.command()
@click.argument('input_dir', type=click.Path(exists=True))
@click.argument('output_file', type=click.Path())
def nerstats(input_dir, output_file):
output_dir = os.path.dirname(output_file)
if not os.pat... | apache-2.0 | Python | |
46a40e7e8fc424cc7e7a601fc99ab2d852cd0980 | Add example GCP CLI tool. (#69) | google/cloud-forensics-utils,google/cloud-forensics-utils | examples/gcp_cli.py | examples/gcp_cli.py | # -*- coding: utf-8 -*-
# Copyright 2020 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 ... | apache-2.0 | Python | |
9cc4067d581f6a97136e0f186dc8aa1dbc734e47 | verify that the dynamic oracle for ArcEager can reach all projective parses | andersjo/hals | hals/transition_system/arc_eager_test.py | hals/transition_system/arc_eager_test.py | from copy import copy, deepcopy
import numpy as np
from unittest import TestCase
from transition_system.arc_eager import ArcEager, ArcEagerDynamicOracle
def generate_all_projective_parses(size):
arc_eager = ArcEager(1)
initial = arc_eager.state(size)
stack = []
stack.append(initial)
parses = set... | mit | Python | |
db380d8e6a8dfa5444f82a0978fad3494d923278 | Add tests of generate_matrix | hvy/chainer,chainer/chainer,niboshi/chainer,chainer/chainer,chainer/chainer,niboshi/chainer,niboshi/chainer,chainer/chainer,wkentaro/chainer,hvy/chainer,niboshi/chainer,pfnet/chainer,hvy/chainer,wkentaro/chainer,hvy/chainer,wkentaro/chainer,wkentaro/chainer | tests/chainer_tests/testing_tests/test_matrix.py | tests/chainer_tests/testing_tests/test_matrix.py | import unittest
import numpy
from chainer import testing
from chainer.testing import condition
@testing.parameterize(*testing.product({
'dtype': [
numpy.float16, numpy.float32, numpy.float64,
numpy.complex64, numpy.complex128,
],
'x_s_shapes': [
((2, 2), (2,)),
((2, 3), (... | mit | Python | |
3cad51e08ef4c1dcfb11cbb8c32272328b31015a | Prepare v1.2.306.dev | gazpachoking/Flexget,ZefQ/Flexget,tarzasai/Flexget,ZefQ/Flexget,tobinjt/Flexget,OmgOhnoes/Flexget,ianstalk/Flexget,malkavi/Flexget,poulpito/Flexget,ratoaq2/Flexget,poulpito/Flexget,crawln45/Flexget,antivirtel/Flexget,jawilson/Flexget,cvium/Flexget,oxc/Flexget,qvazzler/Flexget,dsemi/Flexget,LynxyssCZ/Flexget,malkavi/Fle... | flexget/_version.py | flexget/_version.py | """
Current FlexGet version.
This is contained in a separate file so that it can be easily read by setup.py, and easily edited and committed by
release scripts in continuous integration. Should (almost) never be set manually.
The version should always be set to the <next release version>.dev
The jenkins release job wi... | """
Current FlexGet version.
This is contained in a separate file so that it can be easily read by setup.py, and easily edited and committed by
release scripts in continuous integration. Should (almost) never be set manually.
The version should always be set to the <next release version>.dev
The jenkins release job wi... | mit | Python |
05e7db377b7f0224ec97d5f96c387d711e1e0f23 | Add problem | mikefeneley/topcoder | src/SRM-144/time.py | src/SRM-144/time.py |
class Time:
def whatTime(self, seconds):
hours = seconds / 3600
a = 3600
leftover = seconds - hours * 3600
minutes = leftover / 60
final_sec = seconds - hours * 3600 - minutes * 60
final = str(hours) + ":" + str(minutes)+ ":" + str(final_sec)
return final
| mit | Python | |
61f542c215c0b45bf8b4121bc4705c760c334aa9 | Add a SetObjectExtruderOperation class | Curahelper/Cura,hmflash/Cura,hmflash/Cura,fieldOfView/Cura,fieldOfView/Cura,ynotstartups/Wanhao,Curahelper/Cura,ynotstartups/Wanhao | cura/Settings/SetObjectExtruderOperation.py | cura/Settings/SetObjectExtruderOperation.py | # Copyright (c) 2017 Ultimaker B.V.
# Cura is released under the terms of the AGPLv3 or higher.
from UM.Scene.SceneNode import SceneNode
from UM.Operations.Operation import Operation
from cura.Settings.SettingOverrideDecorator import SettingOverrideDecorator
## Simple operation to set the extruder a certain object ... | agpl-3.0 | Python | |
57c29ec11b91505cade24670cc45726a8689bb9a | add needed util module | HERA-Team/hera_mc,HERA-Team/hera_mc,HERA-Team/Monitor_and_Control | hera_mc/cm_utils.py | hera_mc/cm_utils.py | # -*- mode: python; coding: utf-8 -*-
# Copyright 2016 the HERA Collaboration
# Licensed under the 2-clause BSD license.
"""Some dumb low-level configuration management utility functions.
"""
from __future__ import print_function
import datetime
def _get_datetime(_date,_time):
if _date.lower() == 'now':
... | bsd-2-clause | Python | |
860b7b30f393622dac9badd15d65bf59679580e2 | Create utils.py | twitterdev/twitter-for-bigquery,atomicjets/twitter-for-bigquery,atomicjets/twitter-for-bigquery,twitterdev/twitter-for-bigquery,atomicjets/twitter-for-bigquery,twitterdev/twitter-for-bigquery | image_gnip/utils.py | image_gnip/utils.py | import os
import sys
import time
import logging.config
import json
class Utils:
@staticmethod
def insert_record(client, dataset_id, table_id, record):
result = client.push_rows(dataset_id, table_id, [record], None)
if result.get('insertErrors', None):
prin... | apache-2.0 | Python | |
0080b6744b0ed9603ecf28b826e03aef01a58d2c | add editmate extension | danielballan/ipython_extensions,NunoEdgarGub1/ipython_extensions,minrk/ipython_extensions,dekstop/ipython_extensions,NunoEdgarGub1/ipython_extensions,minrk/ipython_extensions,dekstop/ipython_extensions,NunoEdgarGub1/ipython_extensions,danielballan/ipython_extensions,minrk/ipython_extensions,dekstop/ipython_extensions,d... | editmate.py | editmate.py | """
Use TextMate as the editor
Usage: %load_ext editmate
Now when you %edit something, it opens in textmate.
This is only necessary because the textmate command-line entrypoint
doesn't support the +L format for linenumbers, it uses `-l L`.
"""
from subprocess import Popen, list2cmdline
from IPython.core.error impo... | bsd-3-clause | Python | |
2ecf595b29b3b45769ab0934be6d095a4f80ad56 | Add mmtl unit teset | HazyResearch/metal,HazyResearch/metal | tests/metal/mmtl/test_mmtl.py | tests/metal/mmtl/test_mmtl.py | import unittest
from metal.mmtl.BERT_tasks import create_tasks
from metal.mmtl.metal_model import MetalModel
from metal.mmtl.trainer import MultitaskTrainer
class MMTLTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
task_names = [
"COLA",
"SST2",
"MNLI",
... | apache-2.0 | Python | |
34b1eb53ffbca24a36c103f2017b8780405c48f4 | add prod wsgi to code | USStateDept/FPA_Core,nathanhilbert/FPA_Core,USStateDept/FPA_Core,nathanhilbert/FPA_Core,USStateDept/FPA_Core,nathanhilbert/FPA_Core | find.wsgi | find.wsgi | from openspending import core
application = core.create_web_app() | agpl-3.0 | Python | |
59de1a12d44245b69ade0d4703c98bf772681751 | Add tests for User admin_forms | incuna/django-user-management,incuna/django-user-management | user_management/models/tests/test_admin_forms.py | user_management/models/tests/test_admin_forms.py | from django.core.exceptions import ValidationError
from django.test import TestCase
from .. import admin_forms
from . factories import UserFactory
class UserCreationFormTest(TestCase):
def test_clean_email(self):
email = 'test@example.com'
form = admin_forms.UserCreationForm()
form.clean... | bsd-2-clause | Python | |
706e8a6318b50466ee00ae51f59ec7ab76f820d6 | Create forecast.py | AJBBB/Turnkey-Twitter-WeatherBot,mattyk1985/Turnkey-Twitter-WeatherBot | forecast.py | forecast.py | # -*- coding: utf-8 -*-
# Weather Twitter Bot - AJBBB - 7/8/2015 v2.*
import urllib2
import json
from birdy.twitter import UserClient
import tweepy
#Twitter Keys
CONSUMER_KEY = "YOUR CONSUMER KEY HERE"
CONSUMER_SECRET = "YOUR CONSUMER SECRET HERE"
ACCESS_TOKEN = "YOUR ACCESS TOKEN HERE"
ACCESS_TOKEN_SECRET = "YOUR ... | mit | Python | |
ae1aaaddb8adbbe4167e9b2a073493df90f6fd60 | Remove unused CACHE_VERSION | hpsbranco/subliminal,neo1691/subliminal,juanmhidalgo/subliminal,Elettronik/subliminal,ofir123/subliminal,fernandog/subliminal,h3llrais3r/subliminal,SickRage/subliminal,Diaoul/subliminal | subliminal/cache.py | subliminal/cache.py | # -*- coding: utf-8 -*-
import datetime
from dogpile.cache import make_region
#: Expiration time for show caching
SHOW_EXPIRATION_TIME = datetime.timedelta(weeks=3).total_seconds()
#: Expiration time for episode caching
EPISODE_EXPIRATION_TIME = datetime.timedelta(days=3).total_seconds()
region = make_region()
| # -*- coding: utf-8 -*-
import datetime
from dogpile.cache import make_region
#: Subliminal's cache version
CACHE_VERSION = 1
#: Expiration time for show caching
SHOW_EXPIRATION_TIME = datetime.timedelta(weeks=3).total_seconds()
#: Expiration time for episode caching
EPISODE_EXPIRATION_TIME = datetime.timedelta(da... | mit | Python |
1d5227941c4839ff781fb944f425865b8afdc01f | Add lc0732_my_calendar_iii.py | bowen0701/algorithms_data_structures | lc0732_my_calendar_iii.py | lc0732_my_calendar_iii.py | """Leetcode 732. My Calendar III
Hard
URL: https://leetcode.com/problems/my-calendar-iii/
Implement a MyCalendarThree class to store your events. A new event can always be added.
Your class will have one method, book(int start, int end). Formally, this represents a
booking on the half open interval [start, end), the... | bsd-2-clause | Python | |
5dc8e70bc081646fdeb37e9af1090a78e016d91b | add script inserting initial datas in selected database | Tisseo/TID,Tisseo/TID | insert_initial_datas.py | insert_initial_datas.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import psycopg2
import sys
import argparse
POSTGRESQL_connection = u"host='localhost' port=5432 user='postgres' password='postgres'"
def main():
parser = argparse.ArgumentParser(description="Script d'insertion des données initiales d'une base ENDIV.")
parser.add_... | agpl-3.0 | Python | |
2aa90b34951bde36696bbcb773940a6adc245f23 | Add Authenticater plugin | HWDexperte/ts3observer | plugins/Authenticater.py | plugins/Authenticater.py | from ts3observer.models import Plugin, Action
import MySQLdb
class Meta:
author_name = 'Tim Fechner'
author_email = 'tim.b.f@gmx.de'
version = '1.0'
class Config:
enable = False
interval = 5
yaml = {
'general': {
'servergroup_id': 0,
'remove_if_deleted': True,... | mit | Python | |
571dbf74bfc9f893d25ad7d626de800b2b3d6c73 | move load document functionality to deserializer. prepare for post/put methods | pavlov99/jsonapi,pavlov99/jsonapi | jsonapi/deserializer.py | jsonapi/deserializer.py | """ Deserializer definition."""
class DeserializerMeta(object):
pass
class Deserializer(object):
Meta = DeserializerMeta
@classmethod
def load_document(cls, document):
""" Given document get model.
:param dict document: Document
:return django.db.models.Model model: model ... | mit | Python | |
6537dc8853bb7f8d9fb93b0fb2b1c0241bb08b6b | Create client.py | suvrat-joshi/Mininet-Implementation-of-Cristian-s-Algorithm | python-scripts/client.py | python-scripts/client.py | import socket
from datetime import datetime, time
s=socket.socket(socket.AF_INET, socket.SOCK_STREAM) # create a client socket
port=9999
# get the current date-time
time1=datetime.now()
s.connect(("10.0.0.2", port)) # connect to server socket which is at address 10.0.0.2 and port 9999
tm=s.recv(1024) # this will rea... | apache-2.0 | Python | |
bae50495106ce5c9cb39143a58e0e73a4e823d29 | Implement DispatchLoader (metapath import hook) | joushou/dispatch,joushou/dispatch | loader.py | loader.py | from __future__ import print_function, absolute_import, unicode_literals, division
from stackable.stack import Stack
from stackable.utils import StackablePickler
from stackable.network import StackableSocket, StackablePacketAssembler
from sys import modules
from types import ModuleType
class DispatchLoader(object):
d... | mit | Python | |
0f79cf1d15292476f2bead6d85d15e6f0db6ebbf | Revert "Remove manage.py in the root" | LabD/wagtail-personalisation,LabD/wagtail-personalisation,LabD/wagtail-personalisation | manage.py | manage.py | #!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tests.sandbox.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure tha... | mit | Python | |
77e13247b63af4dc2355bab2fdc64e2b38ec777a | Create manage.py | tnkteja/blockchained | manage.py | manage.py | #!/usr/bin/python
import argparse
from json import dump, load
from os import remove, rename, system
parser = argparse.ArgumentParser(description='This tool is Chaincode Development Manager.')
parser.add_argument("--init", action="store_true",help="Initialise the Chaincode environment")
# parser.add_argument('integers... | mit | Python | |
540ab945736486ce78452750486ea73128b29d7b | Add parse_xml.py | jg1141/revealjs_with_speech,jg1141/revealjs_with_speech,jg1141/revealjs_with_speech | parse_xml.py | parse_xml.py | import sys
import os
from bs4 import BeautifulSoup
from zipfile import ZipFile
def main(argv):
root, ext = os.path.splitext(argv[1])
with ZipFile(argv[1]) as myzip:
with myzip.open("content.xml") as f:
soup = BeautifulSoup(f.read(), "lxml")
# print(soup)
notes = soup.findAll("draw:... | mit | Python | |
269b779fe560fb85ca527cdda2ebd4e5e9b3a89c | Add monkeyrunner script to common operations | Miliox/droid_emc2,Miliox/droid_emc2,Miliox/droid_emc2,Miliox/droid_emc2,Miliox/droid_emc2 | monkey/common.py | monkey/common.py | from com.android.monkeyrunner import MonkeyDevice as mkd
from com.android.monkeyrunner import MonkeyRunner as mkr
_ddmm_pkg = 'br.ufpe.emilianofirmino.ddmm'
def open_dev():
"""Estabilish a MonkeyDevice connection to android"""
return mkr.waitForConnection(1000)
def open_app(device, package, activity = '.Main... | mit | Python | |
e0d075661677b4b02fa29d108472e80b9fbcad02 | Add quote fixture | Neetuj/softlayer-python,allmightyspiff/softlayer-python,kyubifire/softlayer-python,underscorephil/softlayer-python,briancline/softlayer-python,softlayer/softlayer-python,nanjj/softlayer-python,skraghu/softlayer-python,cloudify-cosmo/softlayer-python,iftekeriba/softlayer-python | SoftLayer/testing/fixtures/Billing_Order_Quote.py | SoftLayer/testing/fixtures/Billing_Order_Quote.py | getObject = {
'accountId': 1234,
'id': 1234,
'name': 'TestQuote1234',
'quoteKey': '1234test4321',
}
getRecalculatedOrderContainer = {
'orderContainers': [{
'presetId': '',
'prices': [{
'id': 1921
}],
'quantity': 1,
'packageId': 50,
'useHou... | mit | Python | |
07b6e59a5c7f581bd3e67f6ce254a8388e8b97e1 | add test | nakagami/minitds | minitds/test_minitds.py | minitds/test_minitds.py | #!/usr/bin/env python3
##############################################################################
# The MIT License (MIT)
#
# Copyright (c) 2016 Hajime Nakagami
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to... | mit | Python | |
9b7817e4c4583ddecf2586b595bce9e2e126f4f0 | Add test for image.py | karlch/vimiv,karlch/vimiv,karlch/vimiv | tests/image_test.py | tests/image_test.py | #!/usr/bin/env python
# encoding: utf-8
from unittest import main
from vimiv_testcase import VimivTestCase
class ImageTest(VimivTestCase):
"""Image mode Test."""
@classmethod
def setUpClass(cls):
cls.init_test(cls, ["vimiv/testimages/arch_001.jpg"])
cls.image = cls.vimiv["image"]
de... | mit | Python | |
a13ee62b02d3fe1958f2cbecd903c3e8b32562da | Add dummy test file #2 | 7pairs/kac6vote | tests/test_dummy.py | tests/test_dummy.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2017 Jun-ya HASEBA
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless r... | apache-2.0 | Python | |
5d795253180ef11117ae27447fa597fa15b40734 | Add testing for graphing code | LaurEars/codegrapher | tests/test_graph.py | tests/test_graph.py | import os
from click.testing import CliRunner
from cli.script import cli
def get_graph_code():
return '''
from copy import deepcopy as dc
class StringCopier(object):
def __init__(self):
self.copied_strings = set()
def copy(self):
string1 = 'this'
string2 = dc(string1)
s... | mit | Python | |
66989005b6e9443c65c082ea1c2e4386ffae1330 | Add a few basic pages tests ahead of #406 | bountysource/www.gittip.com,mccolgst/www.gittip.com,MikeFair/www.gittip.com,studio666/gratipay.com,mccolgst/www.gittip.com,mccolgst/www.gittip.com,gratipay/gratipay.com,eXcomm/gratipay.com,eXcomm/gratipay.com,studio666/gratipay.com,studio666/gratipay.com,gratipay/gratipay.com,mccolgst/www.gittip.com,MikeFair/www.gittip... | tests/test_pages.py | tests/test_pages.py | from gittip.testing import serve_request, load, setup_tips
def test_homepage():
actual = serve_request('/').body
expected = "Gittip happens every Thursday."
assert expected in actual, actual
def test_profile():
with load(*setup_tips(("cheese", "puffs", 0))):
expected = "I’m grateful for... | cc0-1.0 | Python | |
7a5b46d5a9d0e45b928bcadfeb91a6285868d8f3 | Create medium_RunLength.py | GabrielGhe/CoderbyteChallenges,GabrielGhe/CoderbyteChallenges | medium_RunLength.py | medium_RunLength.py | """
Determine the run length
of a string
ex: aaabbrerr > 3a2b1r1e2r
"""
def RunLength(string):
val = string[0]
count = 1
ret = ""
for char in string[1:]:
if char != val:
ret += str(count)
ret += val
val = char
count = 1
else:
count += 1
ret += str(count)
ret += val
re... | mit | Python | |
f3c8117755537ca96c3c8c72d5f54b8c244c260b | add top-level class | jobovy/mwdust,jobovy/mwdust | mwdust/DustMap3D.py | mwdust/DustMap3D.py | ###############################################################################
#
# DustMap3D: top-level class for a 3D dust map; all other dust maps inherit
# from this
#
###############################################################################
class DustMap3D:
"""top-level class for a 3D dust... | bsd-3-clause | Python | |
20cebf2b93a310dac4c491b5a59f1a2846f51073 | Add basic implementation | ZhukovAlexander/triegex | triegex/__init__.py | triegex/__init__.py | __all__ = ('Triegex',)
class TriegexNode:
def __init__(self, char: str, childrens=()):
self.char = char
self.childrens = {children.char: children for children in childrens}
def render(self):
if not self.childrens:
return self.char
return self.char + r'(?:{0})'.for... | mit | Python | |
a4ba072e7a136fe1ebb813a1592bf5c378fd855b | 优化了乌龟吃鱼游戏” | Zhaominxin/MyProject,Zhaominxin/MyProject | turtle_fish_game.py | turtle_fish_game.py | import random
class Turtle:
energy = 50
x = random.randint(0, 10)
y = random.randint(0, 10)
def __init__(self, name):
self.name = name
def moving(self):
move = random.choice([-2,-1,1,2])
direction = random.choice(['x','y'])
print('Turtle{0} move {1}, o... | mit | Python | |
465956eb780ace1835e08ca2c87895d7ff1326cf | save a legacy script, may have to use again some year | akrherz/pyWWA,akrherz/pyWWA | util/wisc_ingest.py | util/wisc_ingest.py | import subprocess
import os
import glob
import mx.DateTime
sts = mx.DateTime.DateTime(2011,12,1)
ets = mx.DateTime.DateTime(2012,1,1)
WANT = ['EAST-CONUS','NHEM-COMP','SUPER-NATIONAL','NHEM-MULTICOMP','WEST-CONUS']
def dodate(now, dir):
base = now.strftime("/mesonet/gini/%Y_%m_%d/sat/"+dir)
for (d2,bogus,fil... | mit | Python | |
099151db3a18384ebb4b7abc17c1a38567e5d2cb | add crash scan for reporting | Mozilla-TWQA/mtbf_operation,zapion/mtbf_operation,ShakoHo/mtbf_operation | utils/crash_scan.py | utils/crash_scan.py | #!/usr/bin/python
import subprocess
import re
import os
p = subprocess.Popen(['adb', 'devices'], stdout=subprocess.PIPE)
res = p.communicate()[0].split('\n')
res.pop(0)
devices = []
for li in res:
m = re.search('(\w+)', li)
if(m is not None):
devices.append(m.group(0))
total_crash_num = 0
crash_stat... | mpl-2.0 | Python | |
9ddb89b4b652fb3026632ffd79dea9321f58cc31 | bump version in __init__.py | 1flow/1flow,1flow/1flow,WillianPaiva/1flow,WillianPaiva/1flow,1flow/1flow,WillianPaiva/1flow,1flow/1flow,WillianPaiva/1flow,1flow/1flow,WillianPaiva/1flow | oneflow/__init__.py | oneflow/__init__.py |
VERSION = '0.16.4'
|
VERSION = '0.16.3.1'
| agpl-3.0 | Python |
9d994180a38976939e5da1757303ef8ed76f5e07 | bump version in __init__.py | WillianPaiva/1flow,1flow/1flow,1flow/1flow,1flow/1flow,1flow/1flow,1flow/1flow,WillianPaiva/1flow,WillianPaiva/1flow,WillianPaiva/1flow,WillianPaiva/1flow | oneflow/__init__.py | oneflow/__init__.py |
VERSION = '0.19.1'
|
VERSION = '0.19'
| agpl-3.0 | Python |
aaca641f968bf12eb2177460f8cf809d62ea3bd4 | Add a strict version of itertools.groupby | lamby/buildinfo.debian.net,lamby/buildinfo.debian.net | bidb/utils/itertools.py | bidb/utils/itertools.py | from __future__ import absolute_import
import itertools
def groupby(iterable, keyfunc, sortfunc=lambda x: x):
return [
(x, list(sorted(y, key=sortfunc)))
for x, y in itertools.groupby(iterable, keyfunc)
]
| agpl-3.0 | Python | |
d2c414576cfcf935ed36ffe2c5fb594911be0832 | work on sge module started | sfranky/qtop,fgeorgatos/qtop,sfranky/qtop,qtop/qtop,qtop/qtop,fgeorgatos/qtop,fgeorgatos/qtop,qtop/qtop | sge.py | sge.py | from collections import OrderedDict
__author__ = 'sfranky'
from lxml import etree
fn = '/home/sfranky/PycharmProjects/results/gef_sge1/qstat.F.xml.stdout'
tree = etree.parse(fn)
root = tree.getroot()
def extract_job_info(elem, elem_text):
"""
inside elem, iterates over subelems named elem_text and extracts ... | mit | Python | |
482a2639911b676bf68dcd529dcc1ffecaaf10ea | Create shortner.py | WebShark025/ZigZag-v2,WebShark025/ZigZag-v2,WebShark025/ZigZag-v2 | plugins/shortner.py | plugins/shortner.py | mit | Python | ||
5ae58621bd766aeaa6f1838397b045039568887c | Add driver to find plate solutions | dkirkby/babeldix | platesolve.py | platesolve.py | import babeldix
import sys
import operator
# Print solutions in order of increasing score
for plate in sys.argv[1:]:
solns = babeldix.Plates.get_solutions(plate)
for (soln,score) in sorted(solns.items(), key=operator.itemgetter(1)):
print '{0:s} {1:d} {2:s}'.format(plate,score,soln)
| mit | Python | |
c1bfe92878edc3f9598a6d97046775cb8d9b0aa0 | Make migration for item-visibility change | verleihtool/verleihtool,verleihtool/verleihtool,verleihtool/verleihtool,verleihtool/verleihtool | depot/migrations/0009_auto_20170330_1342.py | depot/migrations/0009_auto_20170330_1342.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-03-30 13:42
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('depot', '0008_auto_20170330_0855'),
]
operations = [
migrations.AlterField(... | agpl-3.0 | Python | |
03ecddce6f34d04957ca5161eb7d776daf02ed47 | Add blobdb messages | pebble/libpebble2 | protocol/blobdb.py | protocol/blobdb.py | __author__ = 'katharine'
from base import PebblePacket
from base.types import *
class InsertCommand(PebblePacket):
key_size = Uint8()
key = BinaryArray(length=key_size)
value_size = Uint16()
value = BinaryArray(length=value_size)
class DeleteCommand(PebblePacket):
key_size = Uint8()
key = B... | mit | Python | |
cf0310a7111bdb79b4bbe2a52095c8344778c80c | Add admin.py for protocols | Hackfmi/Diaphanum,Hackfmi/Diaphanum | protocols/admin.py | protocols/admin.py | from django.contrib import admin
from .models import Protocol
admin.site.register(Protocol) | mit | Python | |
98ed7f3f682bf1ba23bb0030aa81e8fff23e54ad | Add harvester | erinspace/scrapi,fabianvf/scrapi,felliott/scrapi,CenterForOpenScience/scrapi,fabianvf/scrapi,felliott/scrapi,erinspace/scrapi,CenterForOpenScience/scrapi | scrapi/harvesters/uow.py | scrapi/harvesters/uow.py | '''
Harvester for the Research Online for the SHARE project
Example API call: http://ro.uow.edu.au/do/oai/?verb=ListRecords&metadataPrefix=oai_dc
'''
from __future__ import unicode_literals
from scrapi.base import OAIHarvester
class UowHarvester(OAIHarvester):
short_name = 'uow'
long_name = 'University of W... | apache-2.0 | Python | |
1b4ca9e9afccfc1492aeea955f2cd3c783f1dc80 | Create file_parser.py | armatita/NCparser | file_parser.py | file_parser.py | # -*- coding: utf-8 -*-
"""
Created on Thu Mar 19 17:03:35 2015
@author: pedro.correia
"""
from __future__ import division # Just making sure that correct integer division is working
import numpy as np # This is numpy,python numerical library
import xlrd as xcl # This library allow you to... | mit | Python | |
26d364765cdb0e4e4bf755286d92c305b8dabb0c | Add files via upload | mzoorob/LAPOP-Projects,mzoorob/LAPOP-Projects | find_qCodes.py | find_qCodes.py | __author__ = 'zoorobmj'
import re
import csv
import os
if __name__ == '__main__':
folder = "C:\Users\zoorobmj\PycharmProjects\Question_Matrix" # my directory
files = [f for f in os.listdir(folder) if f.endswith('.txt')]
q_list = []
for f in folder:
Qs = open('CoreESP2016.txt', 'r'... | cc0-1.0 | Python | |
5ae45bfbbd6559d344eb641853ef8e83b3ff1c90 | Add wowza blueprint | chrippa/blues,5monkeys/blues,Sportamore/blues,adisbladis/blues,Sportamore/blues,andreif/blues,adisbladis/blues,5monkeys/blues,andreif/blues,andreif/blues,5monkeys/blues,adisbladis/blues,Sportamore/blues,chrippa/blues,chrippa/blues | blues/wowza.py | blues/wowza.py | """
Wowza Blueprint
===============
**Fabric environment:**
.. code-block:: yaml
blueprints:
- blues.wowza
"""
from fabric.decorators import task
from refabric.api import run, info
from refabric.context_managers import sudo
from refabric.contrib import blueprints
from . import debian
__all__ = ['start'... | mit | Python | |
0e53f398bf2cf885393865ec1f899308bb56625b | Add a low-level example for creating views. | mistermocha/jenkinsapi,imsardine/jenkinsapi,mistermocha/jenkinsapi,JohnLZeller/jenkinsapi,JohnLZeller/jenkinsapi,aerickson/jenkinsapi,zaro0508/jenkinsapi,imsardine/jenkinsapi,zaro0508/jenkinsapi,jduan/jenkinsapi,domenkozar/jenkinsapi,mistermocha/jenkinsapi,jduan/jenkinsapi,salimfadhley/jenkinsapi,salimfadhley/jenkinsap... | examples/create_a_view_low_level.py | examples/create_a_view_low_level.py | """
A low level example:
This is how JenkinsAPI creates views
"""
import requests
import json
url = 'http://localhost:8080/newView'
str_view_name = "ddsfddfd"
params = {}# {'name': str_view_name}
headers = {'Content-Type': 'application/x-www-form-urlencoded'}
data = {
"mode": "hudson.model.ListView",
#"Submit"... | mit | Python | |
4c73cad398d5dac85b264187f709a860f356b311 | Add new file with mixin for mysql | KSchopmeyer/smipyping,KSchopmeyer/smipyping,KSchopmeyer/smipyping,KSchopmeyer/smipyping,KSchopmeyer/smipyping | smipyping/_mysqldbmixin.py | smipyping/_mysqldbmixin.py | #!/usr/bin/env python
# (C) Copyright 2017 Inova Development 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
#
# U... | mit | Python | |
206c99420101655d7495000d659d571ef729300b | Add areas spider | tvl/scrapy-soccerway | soccerway/spiders/areas.py | soccerway/spiders/areas.py | # -*- coding: utf-8 -*-
import scrapy
from soccerway.items import Match
from urllib.parse import urlencode
class AreasSpider(scrapy.Spider):
name = "areas"
allowed_domains = ["http://www.soccerway.mobi"]
start_urls = ['http://www.soccerway.mobi/?']
params = {
"sport": "soccer",
"page": ... | apache-2.0 | Python | |
171de05d8ea4a31b0f97c38206b44826364d7693 | Add http_status.py | cortesi/mitmproxy,vhaupert/mitmproxy,ParthGanatra/mitmproxy,pombredanne/netlib,ddworken/mitmproxy,MatthewShao/mitmproxy,xaxa89/mitmproxy,ujjwal96/mitmproxy,jvillacorta/mitmproxy,mitmproxy/mitmproxy,mosajjal/mitmproxy,xaxa89/mitmproxy,ParthGanatra/mitmproxy,mitmproxy/mitmproxy,gzzhanghao/mitmproxy,ddworken/mitmproxy,mos... | netlib/http_status.py | netlib/http_status.py |
CONTINUE = 100
SWITCHING = 101
OK = 200
CREATED = 201
ACCEPTED = 202
NON_AUTHORITATIVE_INFORMATION = 203
NO_CONTENT = 204
RESET_CONTENT = 205
PARTIAL_CONTENT... | mit | Python | |
e7a2ec9b38b69a852667cca8d5c7da3ff242ce61 | Add processTweets.py | traxex33/Twitter-Analysis | processTweets.py | processTweets.py | import json
import re
import operator
import string
import collections
from collections import Counter
from nltk.corpus import stopwords
from nltk.tokenize import word_tokenize
#Setup regex to ingore emoticons
emoticons_str = r"""
(?:
[:=;] Eyes
[oO\-]? # Nose (optional)
[D\)\]\(\]/\\OpP] # Mouth
)"""
#Setup ... | mit | Python | |
e39bce6ba02ad4ed3c20768c234606afb48ac86a | Solve Largest Product | rootulp/hackerrank,rootulp/hackerrank,rootulp/hackerrank,rootulp/hackerrank,rootulp/hackerrank,rootulp/hackerrank | python/euler008.py | python/euler008.py | #!/bin/python3
import sys
from functools import reduce
class LargestProduct:
def __init__(self, num, num_consecutive_digits):
self.num = num
self.num_consecutive_digits = num_consecutive_digits
def largest_product(self):
return max(map(LargestProduct.product, LargestProduct.slices(La... | mit | Python | |
8c14684667b48921987f833f41727d036a3fe9f7 | Add SICK evaluation script in python | kovvalsky/LangPro,kovvalsky/LangPro,kovvalsky/LangPro,kovvalsky/LangPro | python/evaluate.py | python/evaluate.py | #!/usr/bin/env python
# -*- coding: utf8 -*-
import argparse
import re
from collections import Counter
#################################
def parse_arguments():
parser = argparse.ArgumentParser(description="Evaluate predictions against gold labels.")
parser.add_argument(
'sys', metavar='FILE', help='File wi... | bsd-3-clause | Python | |
cd239be7ec84ccb000992841700effeb4bc6a508 | Add quickstart fabfile.py | petchat/streamparse,petchat/streamparse,msmakhlouf/streamparse,Parsely/streamparse,scrapinghub/streamparse,eric7j/streamparse,codywilbourn/streamparse,Parsely/streamparse,petchat/streamparse,hodgesds/streamparse,eric7j/streamparse,crohling/streamparse,msmakhlouf/streamparse,petchat/streamparse,hodgesds/streamparse,msma... | streamparse/bootstrap/project/fabfile.py | streamparse/bootstrap/project/fabfile.py | """fab env:prod deploy:wordcount"""
import json
from fabric.api import run, put, env as _env
from fabric.decorators import task
@task
def env(e=None):
"""Activate a particular environment from the config.json file."""
with open('config.json', 'r') as fp:
config = json.load(fp)
_env.hosts = config... | apache-2.0 | Python | |
7f7fbb94796134301ee5289fa447e8632f59c912 | Create sec660_ctf_windows300.py | timip/exploit | sec660_ctf_windows300.py | sec660_ctf_windows300.py | #!/usr/bin/python
import socket
import sys
import time
buf = ""
buf += "\xd9\xc5\xba\x43\xdc\xd1\x08\xd9\x74\x24\xf4\x5e\x31"
buf += "\xc9\xb1\x53\x31\x56\x17\x83\xee\xfc\x03\x15\xcf\x33"
buf += "\xfd\x65\x07\x31\xfe\x95\xd8\x56\x76\x70\xe9\x56\xec"
buf += "\xf1\x5a\x67\x66\x57\x57\x0c\x2a\x43\xec\x60\xe3\x64"
buf +... | apache-2.0 | Python | |
348b10962f12e1c49ed5c4caf06a838b89b1e5af | Create plasma.py | icfaust/TRIPPy,icfaust/TRIPPy | plasma.py | plasma.py | import geometry
| mit | Python | |
bd05625c2e0a164f0b720c8c13fb06540d4fcdb9 | Create ica_demo.py (#496) | probml/pyprobml,probml/pyprobml,probml/pyprobml,probml/pyprobml | scripts/ica_demo.py | scripts/ica_demo.py | # Blind source separation using FastICA and PCA
# Author : Aleyna Kara
# This file is based on https://github.com/probml/pmtk3/blob/master/demos/icaDemo.m
from sklearn.decomposition import PCA, FastICA
import numpy as np
import matplotlib.pyplot as plt
import pyprobml_utils as pml
def plot_signals(signals, suptitle, ... | mit | Python | |
a8add82f2f9092d07f9ef40420c4b303700c912d | add a 'uniq' function | StoDevX/cs251-toolkit,StoDevX/cs251-toolkit,StoDevX/cs251-toolkit,StoDevX/cs251-toolkit | lib/uniq.py | lib/uniq.py | # from http://www.peterbe.com/plog/uniqifiers-benchmark
def identity(x):
return x
def uniq(seq, idfun=identity):
# order preserving
seen = {}
result = []
for item in seq:
marker = idfun(item)
if marker in seen:
continue
seen[marker] = True
result.appen... | mit | Python | |
c57c672aae98fb5b280f70b68ac27fc2d94a243f | Add test class to cover the RandomForestClassifier in Go | nok/sklearn-porter | tests/estimator/classifier/RandomForestClassifier/RandomForestClassifierGoTest.py | tests/estimator/classifier/RandomForestClassifier/RandomForestClassifierGoTest.py | # -*- coding: utf-8 -*-
from unittest import TestCase
from sklearn.ensemble import RandomForestClassifier
from tests.estimator.classifier.Classifier import Classifier
from tests.language.Go import Go
class RandomForestClassifierGoTest(Go, Classifier, TestCase):
def setUp(self):
super(RandomForestClass... | bsd-3-clause | Python | |
e045a7bd1c3d791de40412bafa62702bee59132e | Add Python solution for day 15. | Mark-Simulacrum/advent-of-code-2015,Mark-Simulacrum/advent-of-code-2015,Mark-Simulacrum/advent-of-code-2015,Mark-Simulacrum/advent-of-code-2015 | day15/solution.py | day15/solution.py |
data = open("data", "r").read()
ingredients = []
for line in data.split("\n"):
name = line.split(": ")[0]
properties = line.split(": ")[1].split(", ")
props = { 'value': 0 }
for prop in properties:
props[prop.split(" ")[0]] = int(prop.split(" ")[1])
ingredients.append(props)
def getPropertyScore(property,... | mit | Python | |
df68e5aa8ab620f03c668ae886ed8a1beef3c697 | Add HKDF-SHA256 implementation. | isislovecruft/scramblesuit,isislovecruft/scramblesuit | hkdf-sha256.py | hkdf-sha256.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
from Crypto.Hash import HMAC
from Crypto.Hash import SHA256
import obfsproxy.transports.base as base
import math
class HKDF_SHA256( object ):
"""
Implements HKDF using SHA256: https://tools.ietf.org/html/rfc5869
This class only implements the `expand' but not the `extra... | bsd-3-clause | Python | |
7cf5f0a4e2b7c8e83f26ea3f9170c5ee0e7bbdbb | make it easier to compare/validate models | et-al-Health/parserator,yl2695/parserator,datamade/parserator | parserator/spotcheck.py | parserator/spotcheck.py | import pycrfsuite
def compareTaggers(model1, model2, string_list, module_name):
"""
Compare two models. Given a list of strings, prints out tokens & tags
whenever the two taggers parse a string differently. This is for spot-checking models
:param tagger1: a .crfsuite filename
:param tagger2: anothe... | mit | Python | |
d4adf3e0e177e80ce7bc825f1cb4e461e5551b2f | Add basic configuration support to oonib | juga0/ooni-probe,Karthikeyan-kkk/ooni-probe,kdmurray91/ooni-probe,lordappsec/ooni-probe,kdmurray91/ooni-probe,0xPoly/ooni-probe,lordappsec/ooni-probe,juga0/ooni-probe,0xPoly/ooni-probe,0xPoly/ooni-probe,Karthikeyan-kkk/ooni-probe,kdmurray91/ooni-probe,Karthikeyan-kkk/ooni-probe,0xPoly/ooni-probe,juga0/ooni-probe,juga0/... | oonib/config.py | oonib/config.py | from ooni.utils import Storage
import os
# XXX convert this to something that is a proper config file
main = Storage()
main.reporting_port = 8888
main.http_port = 8080
main.dns_udp_port = 5354
main.dns_tcp_port = 8002
main.daphn3_port = 9666
main.server_version = "Apache"
#main.ssl_private_key = /path/to/data/private.... | bsd-2-clause | Python | |
58f05fe7736ce387bb8086128bc9de32b8cd6a59 | Add simplify.py | indico/indico-plugins,ThiefMaster/indico-plugins,ThiefMaster/indico-plugins,indico/indico-plugins,indico/indico-plugins,ThiefMaster/indico-plugins,ThiefMaster/indico-plugins,indico/indico-plugins | livesync/indico_livesync/simplify.py | livesync/indico_livesync/simplify.py | # This file is part of Indico.
# Copyright (C) 2002 - 2014 European Organization for Nuclear Research (CERN).
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (a... | mit | Python | |
6a65d102bfcd667c382704ea3430d76faaa1b3d1 | Add tests | looplab/salut | tests/test_salut.py | tests/test_salut.py | import unittest
from mock import MagicMock
import socket
import gevent
import gevent.socket
from otis.common.salut import Announcer, Browser
class TestSalut(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_announce(self):
announcer = Announcer('Test',... | apache-2.0 | Python | |
f65a6c12dd615d235a306b130ebd63358429e8c6 | Create boss.py | PixelIndigo/ctfsolutions | boss.py | boss.py | # -*- coding: utf-8 -*-
import urllib
import urllib2
import re
from cookielib import CookieJar
reg = re.compile(r'href="\.\/in[^"\\]*(?:\\.[^"\\]*)*"')
stager = re.compile(r'>.+100.')
answers = {1: '/index.php?answer=42', 2: '/index.php?answer=bt'}
wrong = set()
cj = CookieJar()
opener = urllib2.build_opener(urll... | unlicense | Python | |
df7235e13c14f13dd27ede6c098a9b5b80b4b297 | Add test_functions | juliakreutzer/bandit-neuralmonkey,bastings/neuralmonkey,ufal/neuralmonkey,ufal/neuralmonkey,ufal/neuralmonkey,juliakreutzer/bandit-neuralmonkey,juliakreutzer/bandit-neuralmonkey,juliakreutzer/bandit-neuralmonkey,ufal/neuralmonkey,ufal/neuralmonkey,bastings/neuralmonkey,bastings/neuralmonkey,juliakreutzer/bandit-neuralm... | neuralmonkey/tests/test_functions.py | neuralmonkey/tests/test_functions.py | #!/usr/bin/env python3
"""Unit tests for functions.py."""
# tests: mypy, lint
import unittest
import tensorflow as tf
from neuralmonkey.functions import piecewise_function
class TestPiecewiseFunction(unittest.TestCase):
def test_piecewise_constant(self):
x = tf.placeholder(dtype=tf.int32)
y = p... | bsd-3-clause | Python | |
b2acb7dfd7dc08afd64d80f25ab0a76469e5fff6 | add import script for North Lanarkshire | DemocracyClub/UK-Polling-Stations,chris48s/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,chris48s/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,chris48s/UK-Polling-Stations | polling_stations/apps/data_collection/management/commands/import_north_lanarkshire.py | polling_stations/apps/data_collection/management/commands/import_north_lanarkshire.py | from data_collection.management.commands import BaseScotlandSpatialHubImporter
"""
Note:
This importer provides coverage for 173/174 districts
due to incomplete/poor quality data
"""
class Command(BaseScotlandSpatialHubImporter):
council_id = 'S12000044'
council_name = 'North Lanarkshire'
elections = ['loc... | bsd-3-clause | Python | |
cc907c9b8f22bd08ed6460e5e99ebb4e8ce5a499 | add import script for Perth and Kinross | DemocracyClub/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,chris48s/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,chris48s/UK-Polling-Stations,chris48s/UK-Polling-Stations | polling_stations/apps/data_collection/management/commands/import_perth_and_kinross.py | polling_stations/apps/data_collection/management/commands/import_perth_and_kinross.py | from data_collection.management.commands import BaseScotlandSpatialHubImporter
"""
Note:
This importer provides coverage for 104/107 districts
due to incomplete/poor quality data
"""
class Command(BaseScotlandSpatialHubImporter):
council_id = 'S12000024'
council_name = 'Perth and Kinross'
elections = ['loc... | bsd-3-clause | Python | |
a9ed1a52a552d76246028d892cc6d01e5ac069cf | Move sidecar to api | polyaxon/polyaxon,polyaxon/polyaxon,polyaxon/polyaxon | api/events/monitors/sidecar.py | api/events/monitors/sidecar.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
import logging
import os
import time
from django.conf import settings
from polyaxon_k8s.constants import PodLifeCycle
from polyaxon_k8s.manager import K8SManager
from api.config_settings import CeleryPublishTask
from api.celery... | apache-2.0 | Python | |
6b81d938ed99a943e8e81816b9a013b488d4dfd8 | Add util.py to decode wordpiece ids in Transformer | lcy-seso/models,PaddlePaddle/models,lcy-seso/models,PaddlePaddle/models,PaddlePaddle/models,kuke/models,qingqing01/models,kuke/models,kuke/models,kuke/models,lcy-seso/models,qingqing01/models,qingqing01/models | fluid/neural_machine_translation/transformer/util.py | fluid/neural_machine_translation/transformer/util.py | import sys
import re
import six
import unicodedata
# Regular expression for unescaping token strings.
# '\u' is converted to '_'
# '\\' is converted to '\'
# '\213;' is converted to unichr(213)
# Inverse of escaping.
_UNESCAPE_REGEX = re.compile(r"\\u|\\\\|\\([0-9]+);")
# This set contains all letter and number chara... | apache-2.0 | Python | |
e69da5fb3550703c466cd8ec0e084e131fb97150 | add first small and simple tests about the transcoder manager | furbrain/Coherence,ismaelgaudioso/Coherence,opendreambox/python-coherence,ismaelgaudioso/Coherence,unintended/Cohen,sreichholf/python-coherence,coherence-project/Coherence,furbrain/Coherence,sreichholf/python-coherence,opendreambox/python-coherence,coherence-project/Coherence,unintended/Cohen | coherence/test/test_transcoder.py | coherence/test/test_transcoder.py |
from twisted.trial.unittest import TestCase
from coherence.transcoder import TranscoderManager
from coherence.transcoder import (PCMTranscoder, WAVTranscoder, MP3Transcoder,
MP4Transcoder, MP2TSTranscoder, ThumbTranscoder)
known_transcoders = [PCMTranscoder, WAVTranscoder, MP3Transcoder, MP4Transcoder,
... | mit | Python | |
d1958e834182fd7d43b97ea17057cc19dff21ca1 | Test addr response caching | Bitcoin-ABC/bitcoin-abc,Bitcoin-ABC/bitcoin-abc,Bitcoin-ABC/bitcoin-abc,Bitcoin-ABC/bitcoin-abc,Bitcoin-ABC/bitcoin-abc,Bitcoin-ABC/bitcoin-abc,Bitcoin-ABC/bitcoin-abc,Bitcoin-ABC/bitcoin-abc,Bitcoin-ABC/bitcoin-abc,Bitcoin-ABC/bitcoin-abc,Bitcoin-ABC/bitcoin-abc,Bitcoin-ABC/bitcoin-abc,Bitcoin-ABC/bitcoin-abc | test/functional/p2p_getaddr_caching.py | test/functional/p2p_getaddr_caching.py | #!/usr/bin/env python3
# Copyright (c) 2020 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test addr response caching"""
import time
from test_framework.messages import (
CAddress,
NODE_NETW... | mit | Python | |
9698e473615233819f886c5c51220d3a213b5545 | Add initial prototype | nok/git-walk,nok/git-walk | script.py | script.py | #!/usr/bin/env python
import sys
import subprocess as subp
cmd = '' if len(sys.argv) <= 1 else str(sys.argv[1])
if cmd in ['prev', 'next']:
log = subp.check_output(['git', 'rev-list', '--all']).strip()
log = [line.strip() for line in log.split('\n')]
pos = subp.check_output(['git', 'rev-parse', 'HEAD'... | mit | Python | |
6500bc2682aeecb29c79a9ee9eff4e33439c2b49 | Add verifica_diff script | palcu/infooltenia,palcu/infooltenia,palcu/infooltenia,palcu/infooltenia,palcu/infooltenia,palcu/infooltenia | conjectura/teste/verifica_diff.py | conjectura/teste/verifica_diff.py | from sh import cp, rm, diff
import sh
import os
SURSA_VERIFICATA = 'conjectura-inturi.cpp'
cp('../' + SURSA_VERIFICATA, '.')
os.system('g++ ' + SURSA_VERIFICATA)
filename = 'grader_test'
for i in range(1, 11):
print 'Testul ', i
cp(filename + str(i) + '.in', 'conjectura.in')
os.system('./a.out')
print diff('... | mit | Python | |
5d769d651947384e18e4e9c21a10f86762a3e950 | add more tests | PyBossa/pybossa,Scifabric/pybossa,Scifabric/pybossa,PyBossa/pybossa | test/test_api/test_api_announcement.py | test/test_api/test_api_announcement.py | # -*- coding: utf8 -*-
# This file is part of PYBOSSA.
#
# Copyright (C) 2017 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 | |
18b22600f94be0e6fedd6bb202753736d61c85e6 | Add alternative settings to make test debugging easier | jfterpstra/bluebottle,jfterpstra/bluebottle,onepercentclub/bluebottle,jfterpstra/bluebottle,onepercentclub/bluebottle,jfterpstra/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle | runserver_settings.py | runserver_settings.py | from django.conf import global_settings
import os
SITE_ID = 1
TIME_ZONE = 'Europe/Amsterdam'
PROJECT_ROOT = os.path.join(os.path.dirname(__file__))
MEDIA_ROOT = os.path.join(PROJECT_ROOT, 'bluebottle', 'test_files', 'media')
STATIC_ROOT = os.path.join(PROJECT_ROOT, 'bluebottle', 'test_files', 'assets')
STATICI18N_... | bsd-3-clause | Python | |
a1f411be91a9db2193267de71eb52db2f334641b | add a file that prints hello lesley | ctsit/J.O.B-Training-Repo-1 | hellolesley.py | hellolesley.py | #This is my hello world program to say hi to Lesley
print 'Hello Lesley'
| apache-2.0 | Python | |
03b80665f6db39002e0887ddf56975f6d31cc767 | Create __init__.py | shyampurk/m2m-traffic-corridor,shyampurk/m2m-traffic-corridor,shyampurk/m2m-traffic-corridor | server/__init__.py | server/__init__.py | mit | Python | ||
33581b5a2f9ca321819abfd7df94eb5078ab3e7c | Add domain.Box bw compatibility shim w/deprecation warning | Alwnikrotikz/py-lepton,AlanZatarain/py-lepton,jmichelsen/py-lepton,jmichelsen/py-lepton,tectronics/py-lepton,AlanZatarain/py-lepton,tectronics/py-lepton,Alwnikrotikz/py-lepton | lepton/domain.py | lepton/domain.py | #############################################################################
#
# Copyright (c) 2008 by Casey Duncan and contributors
# All Rights Reserved.
#
# This software is subject to the provisions of the MIT License
# A copy of the license should accompany this distribution.
# THE SOFTWARE IS PROVIDED "AS IS", W... | #############################################################################
#
# Copyright (c) 2008 by Casey Duncan and contributors
# All Rights Reserved.
#
# This software is subject to the provisions of the MIT License
# A copy of the license should accompany this distribution.
# THE SOFTWARE IS PROVIDED "AS IS", W... | mit | Python |
03fdc41437f96cb1d6ba636c3a5d8c5dc15430b1 | Create requirements.py | pesaply/sarafu,Hojalab/sarafu,pesaply/sarafu,Hojalab/sarafu | requirements.py | requirements.py | mit | Python | ||
ab99f855f708dec213c9eea1489643c01526e0b0 | Add unittests for bridgedb.parse.versions module. | pagea/bridgedb,pagea/bridgedb | lib/bridgedb/test/test_parse_versions.py | lib/bridgedb/test/test_parse_versions.py | # -*- coding: utf-8 -*-
#_____________________________________________________________________________
#
# This file is part of BridgeDB, a Tor bridge distribution system.
#
# :authors: Isis Lovecruft 0xA3ADB67A2CDB8B35 <isis@torproject.org>
# please also see AUTHORS file
# :copyright: (c) 2014, The Tor Proje... | bsd-3-clause | Python | |
caef0059d803fc885d268ccd66b9c70a0b2ab129 | Create Exercise4_VariablesAndNames.py | hrahadiant/LearnPythonTheHardWay | Exercise4_VariablesAndNames.py | Exercise4_VariablesAndNames.py | # Exercise 4 : Variables and Names
cars = 100
space_in_a_car = 4.0
drivers = 30
passengers = 90
cars_not_driven = cars - drivers
cars_driven = drivers
carpool_capacity = cars_driven * space_in_a_car
average_passengers_per_cars = passengers / cars_driven
print("There are", cars, "cars available.")
print("There are onl... | mit | Python | |
7b00bbb576df647a74b47b601beff02af308d16a | 添加 输出到 MySQL | ibbd-dev/ibbdETL,ibbd-dev/ibbdETL | src/target/mysql.py | src/target/mysql.py | # -*- coding: utf-8 -*-
# Author: mojiehua
# Email: mojh@ibbd.net
# Created Time: 2017-07-18 17:38:44
import pymysql
class Target:
"""
写入 MySQL 数据库,需要预先创建表,字段应与输出的字段一致
支持的配置参数 params 如下:
host: MySQL 主机地址
port: MySQL 端口(可选参数,默认3306)
user: 用户名
passwd: 密码
db: 数据库
table: 表名
charse... | apache-2.0 | Python | |
1a4db50c848a3e7bb1323ae9e6b26c884187c575 | Add my fibonacci sequence homework. | bigfatpanda-training/pandas-practical-python-primer,bigfatpanda-training/pandas-practical-python-primer | training/level-1-the-zen-of-python/dragon-warrior/fibonacci/rwharris-nd_fibonacci.py | training/level-1-the-zen-of-python/dragon-warrior/fibonacci/rwharris-nd_fibonacci.py | def even_fibonacci_sum(a:int,b:int,max:int) -> int:
temp = 0
sum = 0
while (b <= max):
if (b%2 == 0):
sum += b
temp = a + b
a = b
b = temp
print(sum)
even_fibonacci_sum(1,2,4000000) | artistic-2.0 | Python | |
f14c483283984b793f1209255e059d7b9deb414c | Add in the db migration | MaxPresman/cfapi,smalley/cfapi,smalley/cfapi,codeforamerica/cfapi,codeforamerica/cfapi,MaxPresman/cfapi,MaxPresman/cfapi,smalley/cfapi | migrations/versions/8081a5906af_.py | migrations/versions/8081a5906af_.py | """empty message
Revision ID: 8081a5906af
Revises: 575d8824e34c
Create Date: 2015-08-25 18:04:56.738898
"""
# revision identifiers, used by Alembic.
revision = '8081a5906af'
down_revision = '575d8824e34c'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - pl... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.