commit stringlengths 40 40 | subject stringlengths 1 1.49k | old_file stringlengths 4 311 | new_file stringlengths 4 311 | new_contents stringlengths 1 29.8k | old_contents stringlengths 0 9.9k | lang stringclasses 3
values | proba float64 0 1 |
|---|---|---|---|---|---|---|---|
544c9cf63f54ca9e77fa37ab5e529791f9e00c3c | Create sysinfo.py | sysinfo.py | sysinfo.py | #!/usr/bin/env python3
if __name__ == '__main__':
print
| Python | 0.000002 | |
8e9dd7161d654bd7ee76752f88a2c646f980fe40 | add raster tools | gdal_utils/raster_tools.py | gdal_utils/raster_tools.py | # ===============================================================================
# Copyright 2016 dgketchum
#
# 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... | Python | 0.000001 | |
277eca85f5eaf009c9ae7a38ef28801a747f9efa | Add copyright notice | nose2/util.py | nose2/util.py | """
This module contains some code copied from unittest2/loader.py and other
code developed in reference to that module and others within unittest2.
unittest2 is Copyright (c) 2001-2010 Python Software Foundation; All
Rights Reserved. See: http://docs.python.org/license.html
"""
import os
import re
import sys
try:
... | import os
import re
import sys
try:
from compiler.consts import CO_GENERATOR
except ImportError:
# IronPython doesn't have a complier module
CO_GENERATOR=0x20
try:
from inspect import isgeneratorfunction # new in 2.6
except ImportError:
import inspect
# backported from Python 2.6
def isgen... | Python | 0 |
fd9df92647007c381ad685c86e578a38576fd2b0 | add test inference code for pcqm4m | examples/lsc/pcqm4m/test_inference_gnn.py | examples/lsc/pcqm4m/test_inference_gnn.py | import torch
from torch_geometric.data import DataLoader
import torch.optim as optim
import torch.nn.functional as F
from torch.utils.tensorboard import SummaryWriter
from torch.optim.lr_scheduler import StepLR
from gnn import GNN
import os
from tqdm import tqdm
import argparse
import time
import numpy as np
import r... | Python | 0.000001 | |
64e028ed51c8cd485586623b295391c00526f5f9 | add speed test example | flexx/ui/examples/speed_test.py | flexx/ui/examples/speed_test.py | """
This little app runs some speed tests by sending binary data over the
websocket (from JS to Py and back), and measuring the time it costs to
do this.
Note that the data is buffered by the websocket (and to some extend in Flexx'
event system), so when multiple messages are send in quick succession, the
last message... | Python | 0.000001 | |
475ea65cce34b7af03a7355e16d95104292aa7fb | Create suntimes.py | suntimes.py | suntimes.py | #! /bin/python
# -*- coding: UTF-8 -*-
import urllib2, json, datetime, time
import dateutil.parser
global latitude
global longitude
api=json.loads(urllib2.urlopen("http://freegeoip.net/json/").read().decode("UTF-8"))
latitude=str(api['latitude'])
longitude=str(api["longitude"])
def getsunrise(lat="", lng="", formatt... | Python | 0.000055 | |
561b1b0bf1950bac54bc9c079daf6c09b3f87158 | Create pd.py | src/ml/pd.py | src/ml/pd.py | #encoding=utf8
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
s = pd.Series([1,3,5,np.nan,6,8])
print(s)
dates = pd.date_range('20130101', periods=6)
print(dates)
#创建DataFrame
df = pd.DataFrame(np.random.randn(6,4), index=dates, columns=list('ABCD'))
print(df)
#通过字典创建DataFrame
f2 = pd.DataFrame... | Python | 0.000002 | |
f9317419417ec348b6520ce6aecf852a391d4b01 | Add importers module init | po2strings/importers/__init__.py | po2strings/importers/__init__.py | # -*- coding: utf-8 -*- | Python | 0 | |
124190aae0f39885011a5f12667d2348ffa32d09 | add invoke task to remve trailing ws | tasks/ws.py | tasks/ws.py | import os
from invoke import task
from ._config import ROOT_DIR, NAME
def trim_py_files(directory):
for root, dirs, files in os.walk(directory):
for fname in files:
filename = os.path.join(root, fname)
if fname.endswith('.py'):
with open(filename, 'rb') as f:
... | Python | 0.000002 | |
9f6952e0c46795bb704c9169cd71fdf18d952ebf | Add ChEBI client | indra/databases/chebi_client.py | indra/databases/chebi_client.py | import os
import csv
from functools32 import lru_cache
chebi_to_pubchem_file = os.path.dirname(os.path.abspath(__file__)) + \
'/../resources/chebi_to_pubchem.tsv'
try:
fh = open(chebi_to_pubchem_file, 'rt')
rd = csv.reader(fh, delimiter='\t')
chebi_pubchem = {}
for row in rd:
... | Python | 0 | |
29e0644f5becc9833743f35aaa07011863fa9a12 | add gas art | src/art/gas/__init__.py | src/art/gas/__init__.py | import math
import colorsys
import png
from ...loader import load
from ...seed import generateSeed
from ...random import random, randomNoise2D
from ...pixel import generatePixel
# Configuration
width = 1000 # Width
height = 1000 # Height
xs = 700 # Filled width
ys = 700 # Filled height
xo = int((width - xs) / 2) # X ... | Python | 0.000001 | |
3826858481c4f9bbf8d887fa390322f8190c96e2 | Add module to list ip addresses | py3status/modules/net_iplist.py | py3status/modules/net_iplist.py | # -*- coding: utf-8 -*-
"""
Display the list of current IPs. This excludes loopback IPs and displays
"no connection" if there is no connection.
Configuration parameters
ignore: list of IPs to ignore. Can use shell style wildcards.
(default: ['127.*'])
no_connection: string to display if there are no no... | Python | 0 | |
66ad00861f7143e35ab80674295fa5bf7998cfa5 | Create pytabcomplete.py | HexChat/pytabcomplete.py | HexChat/pytabcomplete.py | from __future__ import print_function
import hexchat
__module_name__ = "PythonTabComplete"
__module_author__ = "TingPing"
__module_version__ = "0"
__module_description__ = "Tab completes modules in Interactive Console"
lastmodule = ''
lastcomplete = 0
lasttext = ''
def keypress_cb(word, word_eol, userdata):
global... | Python | 0.000002 | |
248023106d4e881110a646e9d078ecad4f58e24d | Add a Python program which reads from a pipe and writes the data it gets to syslog. | pipelogger.py | pipelogger.py | #!/usr/bin/env python
#
import argparse
import os
import syslog
parser = argparse.ArgumentParser(
description='Syslog messages as read from a pipe')
parser.add_argument('-i', '--ident',
help='Use the given identifier for syslogging',
required=True)
parser.add_argument('pipe', help='Pipe file to read log records f... | Python | 0 | |
85d29ef779687a3b9db5333ce9921fc20e66b985 | Create test_get.py | test_get.py | test_get.py | #!/usr/bin/env python
# -*- coding=utf-8 -*-
#以get明文的方式传递数据
import urllib
import urllib2
values={}
values['username'] = "1016903103@qq.com"
values['password']="XXXX"
data = urllib.urlencode(values)
url = "http://passport.csdn.net/account/login"
geturl = url + "?"+data #字符串合并
request = urllib2.Request(geturl)
respons... | Python | 0.000003 | |
5d54d3f9ead119671affa9bb04ec64efc7c3eea4 | Fix check.py a+x perms | check.py | check.py | #!/usr/bin/env python3
# coding: utf-8
"""
EXPERIMENTAL
Regular expression rule checker for Khan Academy translations.
Instructions:
- Download https://crowdin.com/download/project/khanacademy.zip
- Unzip the 'de' folder.
- From the directory where the 'de' folder is located, run this script.
"""
import polib
impo... | #!/usr/bin/env python3
# coding: utf-8
"""
EXPERIMENTAL
Regular expression rule checker for Khan Academy translations.
Instructions:
- Download https://crowdin.com/download/project/khanacademy.zip
- Unzip the 'de' folder.
- From the directory where the 'de' folder is located, run this script.
"""
import polib
impo... | Python | 0.000002 |
66201e6d73a909bc0ad932ad4b5de9d2ce30d4fe | add Blob class | PhloxAR/features/blob.py | PhloxAR/features/blob.py | # -*- coding:utf-8 -*-
from __future__ import division, print_function
from __future__ import absolute_import, unicode_literals
from PhloxAR.base import math
from PhloxAR.base import sss
from PhloxAR.base import *
from PhloxAR.features.feature import Feature
from PhloxAR.color import Color
from PhloxAR.image import I... | Python | 0.000001 | |
0b06fb26fa5393e4ba80e2942ebba34d9f9fa4de | Create 1st Python script | Python/spatial-basics.py | Python/spatial-basics.py | from shapely.wkt import loads
g = loads('POINT (0.0 0.0)')
| Python | 0.000001 | |
a61d37449f8000a83942513f2ad71151ef26822d | Add unit tests for synapse.cells | synapse/tests/test_cells.py | synapse/tests/test_cells.py | import synapse.axon as s_axon
import synapse.cells as s_cells
import synapse.cryotank as s_cryotank
from synapse.tests.common import *
class CellTest(SynTest):
def test_cell_cryo(self):
with self.getTestDir() as dirn:
with s_cells.cryo(dirn) as cryo:
self.isinstance(cryo, s_cr... | Python | 0.000001 | |
4a9de740e73f3a10f4f0fdaaf2738e17e77b306f | Add sample Channel API tictactoe.py source | tictactoe.py | tictactoe.py | #!/usr/bin/python2.4
#
# Copyright 2010 Google Inc. All Rights Reserved.
# pylint: disable-msg=C6310
"""Channel Tic Tac Toe
This module demonstrates the App Engine Channel API by implementing a
simple tic-tac-toe game.
"""
import datetime
import logging
import os
import random
import re
from django.utils import sim... | Python | 0 | |
7454abdfba5d37d81dc3ad4bf7fb2f63bc552f38 | Add wsgi file | toolkit.wsgi | toolkit.wsgi | import os
import sys
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
sys.path.append(os.path.abspath("."))
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
| Python | 0.000001 | |
6a2b3673d1332d4dfb0b0367da76e3036536359e | add radio routines | radio.py | radio.py | import astropy.units as u
import astropy.constants as const
import numpy as np
from astropy.wcs import WCS
from astropy.io import fits
square_beam = 1/np.sqrt(np.pi / (4 * np.log(2)))
def beam_area(BMAJ, BMIN=None):
if not isinstance(BMAJ,u.Quantity):
BMAJ = BMAJ * u.arcsec
if (BMIN is not None) and (... | Python | 0.000002 | |
ea5d2be685d7b144e29fa7d362f290a0569875cb | add radio.py | radio.py | radio.py | # -*- coding: utf-8 -*-
import unittest
import serial
class IC911:
def connect(self, radioport):
print "IC911"
#self._ser=serial.Serial(radioport,38400)
def chengefreq(self,freqvalue):
priansumble = "FE"*2
receiveaddress = "60"
sendeaddress = "E0"
command="05"
... | Python | 0.000011 | |
324161f37b54aee71de801b4206f925c967d11d4 | Add a couple of simple tests and fix typo | tasklib/tests.py | tasklib/tests.py | import shutil
import tempfile
import unittest
import uuid
from .task import TaskWarrior
class TasklibTest(unittest.TestCase):
def setUp(self):
self.tmp = tempfile.mkdtemp()
self.tw = TaskWarrior(data_location=self.tmp)
def tearDown(self):
shutil.rmtree(self.tmp)
class TaskFilterTe... | Python | 0.00002 | |
94013176a1dfe7724106ec2deed5f650b71b8f65 | Create basic admin interface... | clic/web/admin.py | clic/web/admin.py | # from __future__ import absolute_import # help python find modules within clic package (see John H email 09.04.2014)
from flask import Flask, render_template
from flask.ext.security import Security, SQLAlchemyUserDatastore, \
UserMixin, RoleMixin, login_required
from flask.ext.admin.contrib import sqla
from flas... | Python | 0 | |
86d51e36ca0f5772717d72d4729fb331a0066636 | Fix smoke tests to delete resources synchronously. | tempest/smoke.py | tempest/smoke.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 OpenStack, LLC
# 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/... | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 OpenStack, LLC
# 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/... | Python | 0 |
24f16c8e012000a86ccba564fb0be84504b60824 | Use Jacoco to create a code coverage report; update build scripts to run it. | scripts/assert_code_coverage.py | scripts/assert_code_coverage.py | #!/usr/bin/env python
import xml.etree.ElementTree as ElementTree
import sys
# This parses buck-out/gen/jacoco/code-coverage/index.html after
# `buck test --all --code-coverage --code-coverage-format xml --no-results-cache`
# has been run.
PATH_TO_CODE_COVERAGE_XML = 'buck-out/gen/jacoco/code-coverage/coverage.xml'
... | Python | 0.000001 | |
ce8f335b8b52d682cd233a96529201a4c537e88d | Add Python 3.5 | setup.py | setup.py | #!/usr/bin/env python
from setuptools import setup
from codecs import open
from scot import __version__ as ver
with open('README.md', encoding='utf-8') as readme:
long_description = readme.read()
setup(
name='scot',
version=ver,
description='EEG/MEG Source Connectivity Toolbox',
long_description... | #!/usr/bin/env python
from setuptools import setup
from codecs import open
from scot import __version__ as ver
with open('README.md', encoding='utf-8') as readme:
long_description = readme.read()
setup(
name='scot',
version=ver,
description='EEG/MEG Source Connectivity Toolbox',
long_description... | Python | 0.999999 |
fc70bf43639f34d92b21c66269ee2e15da9f0e5c | Fix missing dev dependency | setup.py | setup.py | import setuptools
import sys
# Thwart installation for unsupported versions of Python. `pip` didn't start
# enforcing `python_requires` until 9.0.
if sys.version_info < (3, 4):
raise RuntimeError('Unsupported Python version: ' + sys.version)
setuptools.setup(
author='Diego Argueta',
author_email='darguet... | import setuptools
import sys
# Thwart installation for unsupported versions of Python. `pip` didn't start
# enforcing `python_requires` until 9.0.
if sys.version_info < (3, 4):
raise RuntimeError('Unsupported Python version: ' + sys.version)
setuptools.setup(
author='Diego Argueta',
author_email='darguet... | Python | 0.000112 |
a17efdceeeec0932ff403ebeb6f787ea8b08a3a4 | Add print lists function practice problem | Problems/printLists.py | Problems/printLists.py | #!/Applications/anaconda/envs/Python3/bin
def main():
# Test suite
test_list_1 = ["puppy", "kitten", "lion cub"]
test_list_2 = ["lettuce",
"bacon",
"turkey",
"mayonnaise",
"tomato",
"white bread"]
pret... | Python | 0.000003 | |
9bbea15cd6832f9a0a75a05775fcf2a12297f8c8 | Update setup.py | setup.py | setup.py | """Chassis: Opinionated REST Framework."""
from distutils.core import setup
setup(
name='chassis',
version='0.0.5',
packages=['chassis'],
description="Tornado framework for self-documenting JSON RESTful APIs.",
author="Refinery 29",
author_email="chassis-project@refinery29.com",
url="https... | """Chassis: Opinionated REST Framework."""
from distutils.core import setup
setup(
name='chassis',
version='0.0.5',
packages=['chassis'],
description="Tornado framework for self-documenting JSON RESTful APIs.",
author="Refinery 29",
author_email="chassis-project@refinery29.com",
url="https... | Python | 0 |
14ff724cd05f51973af9ede47d9f8cfe2a1ce908 | Add optional flag to setuptools extension (#78) | setup.py | setup.py | import sys
import platform
from pkg_resources import parse_version
from setuptools import setup, Extension
cpython = platform.python_implementation() == 'CPython'
is_glibc = platform.libc_ver()[0] == 'glibc'
windows = sys.platform.startswith('win')
if is_glibc:
glibc_ver = platform.libc_ver()[1]
libc_ok = pars... | import sys
import platform
from pkg_resources import parse_version
from setuptools import setup, Extension
cpython = platform.python_implementation() == 'CPython'
is_glibc = platform.libc_ver()[0] == 'glibc'
windows = sys.platform.startswith('win')
if is_glibc:
glibc_ver = platform.libc_ver()[1]
libc_ok = pars... | Python | 0 |
34643864e52f3231aa40256bc160569af234e8e7 | Add setup.py | setup.py | setup.py | from setuptools import find_packages, setup
version = __import__('vdlkino').__version__
setup(
name='vdlkino',
version=version,
description='Library in Python for comunicate computer with Arduino running VDLKino',
author='Eduardo Klosowski',
author_email='eduardo_klosowski@yahoo.com',
licens... | Python | 0.000001 | |
8ec65137efcf1f8cf37923b916e7496e10027edc | Bump version. | setup.py | setup.py | import os
import sys
from setuptools import setup
INSTALL_REQUIRES = ['python_cjson', 'requests >=1.0.3', 'boto >=2.1.1']
if sys.version_info < (2, 7, 0):
INSTALL_REQUIRES.append('argparse>=1.1')
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
name = "qds_sdk",
... | import os
import sys
from setuptools import setup
INSTALL_REQUIRES = ['python_cjson', 'requests >=1.0.3', 'boto >=2.1.1']
if sys.version_info < (2, 7, 0):
INSTALL_REQUIRES.append('argparse>=1.1')
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
name = "qds_sdk",
... | Python | 0 |
42a287d23a1153df636c193695615d99b7c75e4d | Test stopping all running file backups | test/stop_all.py | test/stop_all.py | import urbackup_api
server = urbackup_api.urbackup_server("http://127.0.0.1:55414/x", "admin", "foo")
for action in server.get_actions():
a = action["action"]
if a ==server.action_full_file or a==server.action_resumed_full_file:
print("Running full file backup: "+action["name"])
... | Python | 0 | |
a9cc03c02b6d8571efd563e04f2cb774f4c3e7bf | add original walk.py | lib/walk.py | lib/walk.py | # File: os-path-walk-example-2.py
#http://effbot.org/librarybook/os-path/os-path-walk-example-2.py
import os
def index(directory):
# like os.listdir, but traverses directory trees
stack = [directory]
files = []
while stack:
directory = stack.pop()
for file in os.listdir(directory):
... | Python | 0.000004 | |
afdf9e4ff719066d2828dd3c4dd0088e705fddf5 | Add ansirunner module | spam/ansirunner.py | spam/ansirunner.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
AnsibleRunner:
INTRO:
USAGE:
"""
import ansible.runner
class AnsibleRunner(object):
'''
Ansible Runner Wrapper class.
'''
def __init__(self):
'''
Initialize AnsibleRunner.
'''
pass
def validate_host_parameters(... | Python | 0 | |
5fc17b6c0f4d9d9862df63c330b257a8ec6932af | Add a test of switching back and forth between Decider() values (specifically 'MD5' and 'timestamp-match'), copied from back when this functionality was configured with the SourceSignatures() function. | test/Decider/switch-rebuild.py | test/Decider/switch-rebuild.py | #!/usr/bin/env python
#
# __COPYRIGHT__
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
... | Python | 0.00004 | |
3a9445c6b3053d492c12bbf808d251c6da55632a | Add a test for the builtin __import__ function. | tests/import/builtin_import.py | tests/import/builtin_import.py | # test calling builtin import function
# basic test
__import__('builtins')
# first arg should be a string
try:
__import__(1)
except TypeError:
print('TypeError')
# level argument should be non-negative
try:
__import__('xyz', None, None, None, -1)
except ValueError:
print('ValueError')
| Python | 0.000003 | |
6dcd913e794edbac28d98988d0936262d4663b9f | create input function | core/get_input.py | core/get_input.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from core.compatible import version
from core.alert import __input_msg
def __input(msg, default):
if version() is 2:
try:
data = raw_input(__input_msg(msg))
if data == '':
data = default
except:
data... | Python | 0.999998 | |
a72a0674a6db3880ed699101be3c9c46671989f0 | Add a primitive pythonic wrapper. | xxdata_11.py | xxdata_11.py | import os
import _xxdata_11
parameters = {
'isdimd' : 200,
'iddimd' : 40,
'itdimd' : 50,
'ndptnl' : 4,
'ndptn' : 128,
'ndptnc' : 256,
'ndcnct' : 100
}
def read_scd(filename):
fd = open(filename, 'r')
fortran_filename = 'fort.%d' % fd.fileno()
os.symlink(filename, fortran_filen... | Python | 0 | |
b6cd59f800b254d91da76083546ab7c10689df5f | Add unit test to enforce unique file names. | tests/test_no_dup_filenames.py | tests/test_no_dup_filenames.py | # Copyright 2014 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | Python | 0 | |
e81fd02cc7431ea01416126b88a22b4bba9b755e | Test - add cmake test tool | tests/test_tools/test_cmake.py | tests/test_tools/test_cmake.py | # Copyright 2015 0xc0170
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, soft... | Python | 0 | |
15102368281837ace7e67ad915f2ff9c4c4a1ac3 | remove package alias tool | tools/remove_packages_alias.py | tools/remove_packages_alias.py | import os
import sys
import logging
import urllib3
from elasticsearch import Elasticsearch, NotFoundError
from os_package_registry import PackageRegistry
from sqlalchemy import MetaData, create_engine
urllib3.disable_warnings()
logging.root.setLevel(logging.INFO)
if __name__ == "__main__":
es_host = os.environ... | Python | 0.000001 | |
d53cff101248b9c90f5d2ae3f93d0e4933d03266 | add a manifest (.cvmfspublished) abstraction class | cvmfs/manifest.py | cvmfs/manifest.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created by René Meusel
This file is part of the CernVM File System auxiliary tools.
"""
import datetime
class UnknownManifestField:
def __init__(self, key_char):
self.key_char = key_char
def __str__(self):
return self.key_char
class ManifestV... | Python | 0.000001 | |
66fcd6ab9d8703b2588bc2605278a5e056356de5 | add top level bot class with basic outline of execution | updatebot/bot.py | updatebot/bot.py | #
# Copyright (c) 2008 rPath, Inc.
#
# This program is distributed under the terms of the Common Public License,
# version 1.0. A copy of this license should have been distributed with this
# source file in a file called LICENSE. If it is not present, the license
# is always available at http://www.rpath.com/permanent/... | Python | 0 | |
8d2510fd38d946813b96798c745772641f19a5e7 | Create 10MinEmail.py | 10MinEmail.py | 10MinEmail.py | from bs4 import BeautifulSoup
import threading
import urllib
web=urllib.urlopen('http://www.my10minutemail.com/')
soup=BeautifulSoup(web)
print soup.p.string
print 'Email Valid For 10 minutes'
raw_input()
#def alarm():
# print 'One Minute is Left'
#t = threading.Timer(60.0, alarm)
#t.start()
| Python | 0.000001 | |
198dc11cadc1a20f95dccd5bb4897fa2947ff810 | Add Affichage.py | Affichage.py | Affichage.py | class Affichage:
def affichage_jeux(self):
return 0
| Python | 0.000001 | |
abe6ead4f93f98406fe197b6884e51015c200ca1 | Add a test for query_result_to_dict | test/test_searchentities.py | test/test_searchentities.py | import unittest
from . import models
from sir.schema.searchentities import SearchEntity as E, SearchField as F
class QueryResultToDictTest(unittest.TestCase):
def setUp(self):
self.entity = E(models.B, [
F("id", "id"),
F("c_bar", "c.bar"),
F("c_bar_trans", "c.bar", tra... | Python | 0.999999 | |
c1bbbd7ac51a25919512722d633f0d8c2d1009e2 | Create unit tests directory | tests/test_lazy_toeplitz.py | tests/test_lazy_toeplitz.py | from scipy.linalg import toeplitz
import numpy as np
from cooltools.snipping import LazyToeplitz
n = 100
m = 150
c = np.arange(1, n+1)
r = np.r_[1,np.arange(-2, -m, -1)]
L = LazyToeplitz(c, r)
T = toeplitz(c, r)
def test_symmetric():
for si in [
slice(10, 20),
slice(0, 150),
... | Python | 0 | |
c3026f4c6e5edff30347f544746781c7214c2c2e | Add root test file. | test_SM2SM.py | test_SM2SM.py | '''
Created on 2015-01-20
@author: levi
'''
'''
Created on 2015-01-19
@author: levi
'''
import unittest
from patterns.HSM2SM_matchLHS import HSM2SM_matchLHS
from patterns.HSM2SM_rewriter import HSM2SM_rewriter
from PyRamify import PyRamify
from t_core.messages import Packet
from t_core.iterator import Iterator
fro... | Python | 0 | |
3c7c81fa65206ea70cbff8394efe35749dc9dddd | add bitquant.py driver | web/bitquant.py | web/bitquant.py | from flask import Flask, request
app = Flask(__name__, static_url_path='', static_folder='bitquant')
@app.route("/")
def root():
return app.send_static_file('index.html')
if __name__ == "__main__":
app.run()
| Python | 0.000001 | |
58d3df14b1b60da772f59933345a2dfdf2cadec2 | Add python solution for day 17 | day17/solution.py | day17/solution.py | import itertools
data = open("data", "r").read()
containers = map(int, data.split("\n"))
part1 = []
minLength = None
for length in range(len(containers)):
combinations = itertools.combinations(containers, length)
combinations = filter(lambda containers: sum(containers) == 150, combinations)
part1 += combinations... | Python | 0.000262 | |
88cfd7529c6c08e24b20576c1e40f41f3156a47e | add tandem sam scores script | bin/tandem_sam_scores.py | bin/tandem_sam_scores.py | """
tandem_sam_scores.py
For each alignment, compare the "target" simulated alignment score to the
actual score obtained by the aligner. When the read is simulated, we borrow
the target score and the pattern of mismatches and gaps from an input
alignment. But because the new read's sequence and point of origin are
d... | Python | 0 | |
b4c21650cfd92d722a0ac20ea51d90f15adca44e | add permissions classes for Group API | bioshareX/permissions.py | bioshareX/permissions.py | from django.http.response import Http404
from rest_framework.permissions import DjangoModelPermissions, SAFE_METHODS
from django.contrib.auth.models import Group
class ViewObjectPermissions(DjangoModelPermissions):
def has_object_permission(self, request, view, obj):
if hasattr(view, 'get_queryset'):
... | Python | 0 | |
43fe12c4dc2778e6c7a4b65dae587004a0ec0155 | rename plugin -> calico_rkt | calico_rkt/calico_rkt.py | calico_rkt/calico_rkt.py | #!/usr/bin/env python
from __future__ import print_function
import socket
from netaddr import IPAddress
from pycalico import datastore, netns
import functools
import json
import os
import sys
from subprocess import check_output, CalledProcessError
from pycalico.datastore_datatypes import Rules
from pycalico.netns impo... | Python | 0 | |
9557fc7696b182dd25f15bee85d522c22910bd90 | Add test for siingle camera. | camera-capture-1.py | camera-capture-1.py | #! /usr/bin/env python
# -*- coding:utf-8 -*-
#
# Application to capture images from two AVT Manta cameras with the Vimba SDK
#
#
# External dependencies
#
import ctypes
import os
import cv2
import numpy
import time
#
# Vimba frame structure
#
class VmbFrame( ctypes.Structure ) :
# VmbFrame structure fields
... | Python | 0 | |
6e1d1da7983da2ca43a1185adc2ddb2e2e1b7333 | Add basic cycles exercices | chapter02/cicles.py | chapter02/cicles.py | #!/usr/bin/env python
print "Escribir un ciclo definido para imprimir por pantalla todos los numeros entre 10 y 20."
print [x for x in range(10, 20)]
print "Escribir un ciclo definido que salude por pantalla a sus cinco mejores amigos/as."
print [amigo for amigo in ['Lola', 'Dolores', 'Quique', 'Manuel', 'Manolo']]
... | Python | 0.000013 | |
08c189a643f0b76ad28f9c0e0bc376a0ae202343 | Create nesting.py | codility/nesting.py | codility/nesting.py | """
https://codility.com/programmers/task/nesting/
"""
def solution(S):
balance = 0
for char in S:
balance += (1 if char == '(' else -1)
if balance < 0:
return 0
return int(balance == 0)
| Python | 0.000002 | |
7055485e8c29c1002a0b3d9cb45cffef1bb5dc46 | Add script | SimSyCam.py | SimSyCam.py | # SimSyCam - Simple Symbian Camera
import appuifw
appuifw.app.orientation='landscape' # must be called before importing camera
appuifw.app.screen='full'
from key_codes import *
import e32, time, camera, globalui, graphics
# variables used for mode change messages
info = u""
start_time = 0
# supportet modes
flash_m... | Python | 0.000002 | |
02b5ba55c854e5157ef5f65d3faa9bce960eced2 | Add pygments support. | firmant/pygments.py | firmant/pygments.py | # Copyright (c) 2011, Robert Escriva
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of condition... | Python | 0 | |
631aa503d1457f823cacd0642a1554ce8f31c1f9 | add jm server | python/jm_server.py | python/jm_server.py | #!/usr/bin/python
#
# jm_server.py
#
# Author: Zex <top_zlynch@yahoo.com>
#
import dbus
import dbus.service
from basic import *
class JuiceMachine(dbus.service.FallbackObject):
"""
JuiceMachine server
"""
def __init__(self):
connection = dbus.SessionBus()
connection_name = dbus.serv... | Python | 0 | |
59a108840f0fb07f60f20bc9ff59a0d194cb0ee3 | enable import as module | __init__.py | __init__.py | """
.. module:: lmtscripts
:platform: Unix
:synopsis: useful scripts for EHT observations at LMT
.. moduleauthor:: Lindy Blackburn <lindylam@gmail.com>
.. moduleauthor:: Katie Bouman <klbouman@gmail.com>
"""
| Python | 0.000001 | |
88b6549b74dd767733cd823de410e00067a79756 | add test auto updater | auto_update_tests.py | auto_update_tests.py | #!/usr/bin/env python
import os, sys, subprocess, difflib
print '[ processing and updating testcases... ]\n'
for asm in sorted(os.listdir('test')):
if asm.endswith('.asm.js'):
print '..', asm
wasm = asm.replace('.asm.js', '.wast')
actual, err = subprocess.Popen([os.path.join('bin', 'asm2wasm'), os.path... | Python | 0 | |
322dd59f362a1862c739c5c63cd180bce8655a6d | Test to add data | AddDataTest.py | AddDataTest.py | __author__ = 'chuqiao'
import script
script.addDataToSolrFromUrl("http://www.elixir-europe.org:8080/events", "http://www.elixir-europe.org:8080/events");
script.addDataToSolrFromUrl("http://localhost/ep/events?state=published&field_type_tid=All", "http://localhost/ep/events");
| Python | 0 | |
be9cf41600b2a00494ca34e3b828e7a43d8ae457 | Create testing.py | bcn/utils/testing.py | bcn/utils/testing.py | """Utility functions for unittests.
Notes
-----
Defines a function that compares the hash of outputs with the expected output, given a particular seed.
"""
from __future__ import division, absolute_import
import hashlib
def assert_consistency(X, true_md5):
'''
Asserts the consistency between two function out... | Python | 0.000001 | |
41904abd0778719a1586b404c1ca56eb3205f998 | Include undg/myip to this repo bin. | bin/myip.py | bin/myip.py | #!/usr/bin/python3
def extIp(site): # GETING PUBLIC IP
import urllib.request
from re import findall
ipMask = '\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}'
if site == 'dyndns':
url = 'http://checkip.dyndns.org'
regexp = '<body>Current IP Address: ('+ipMask+')</body>'
if site == 'google':
... | Python | 0 | |
c5a7e6dc9a98f056a31552e7ace4d150b13b998f | Create markdown.py | markdown.py | markdown.py | import os
import sys
import markdown
from cactus.utils import fileList
template = """
%s
{%% extends "%s" %%}
{%% block %s %%}
%s
{%% endblock %%}
"""
title_template = """
{%% block title %%}%s{%% endblock %%}
"""
CLEANUP = []
def preBuild(site):
for path in fileList(site.paths['pages']):
if not path.endsw... | Python | 0.000002 | |
5492e1b318ff0af3f1e2b1ed0217ed2744b50b68 | Add first structure for issue 107 (automatic configuration doc generation) | server/src/configuration_doc.py | server/src/configuration_doc.py | from collections import namedtuple
NO_DEFAULT = object()
ANY_TYPE = object()
_Argument = namedtuple('Argument', 'category type default message')
_sorted_variables = []
######################################
#
# CORE
#
CORE = 'core'
WEBLAB_CORE_SERVER_SESSION_TYPE = 'core_session_type'
WEBLAB_CORE_SERVER_S... | Python | 0 | |
411f855daa9f06868aa597f84c0b739429d705f4 | Create bot_read.py | bot_read.py | bot_read.py | #!/usr/bin/python
import praw
user_agent = ("PyFor Eng bot 0.1")
r = praw.Reddit(user_agent=user_agent)
subreddit = r.get_subreddit('python')
for submission in subreddit.get_hot(limit=5):
print submission.title
print submission.selftext
print submission.score
subreddit = r.get_subreddit('learnpython')
... | Python | 0.000001 | |
7c4097822b72f8f8103744c67b56c01a484a573b | Create dfirwizard-v12.py | dfirwizard-v12.py | dfirwizard-v12.py | #!/usr/bin/python
# Sample program or step 8 in becoming a DFIR Wizard!
# No license as this code is simple and free!
import sys
import pytsk3
import datetime
import pyewf
import argparse
import hashlib
import csv
import os
import re
import vss
import pyvshadow
class ewf_Img_Info(pytsk3.Img_Info):
def __init... | Python | 0.000001 | |
608120909f05096b51f43d99da4ea3bb86d02472 | add slim vgg19 model | SRGAN/vgg19.py | SRGAN/vgg19.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
import tensorflow.contrib.slim as slim
from collections import OrderedDict
tf.set_random_seed(777) # reproducibility
def get_tensor_aliases(tensor):
"""Get a list with the alias... | Python | 0 | |
b62b37db1141221ae735b531bdb46264aadbe2e7 | add make_requests client in python | make_requests.py | make_requests.py | import os
import sys
import time
def main(timeout_secs, server_port, iteration_count, file_name):
for i in range(iteration_count):
start_time_secs = time.time()
cmd = 'nc localhost %d < file_list_with_time.txt' % server_port
rc = os.system(cmd)
if rc != 0:
sys.exit(1)
... | Python | 0.000001 | |
5794a2d8d2b59a6a37b5af4e8c1adba276c325c4 | Create TagAnalysis.py | TagAnalysis.py | TagAnalysis.py | # Analysis of question tags
| Python | 0 | |
a6a9bb5a365aef9798091335c81b1b793578ed1f | Initialize car classifier | car_classifier.py | car_classifier.py | class CarClassifier(object):
""" Classifier for car object
Attributes:
car_img_dir: path to car images
not_car_img_dir: path to not car images
sample_size: number of images to be used to train classifier
"""
def __init__(self, car_img_dir, not_car_img_dir, sample_size):
"... | Python | 0.001911 | |
1732fe53dc228da64f3536ce2c76b420d8b100dc | Create the animation.py module. | ch17/animation.py | ch17/animation.py | # animation.py
# Animation
"""
This is an example of animation using pygame.
An example from Chapter 17 of
'Invent Your Own Games With Python' by Al Sweigart
A.C. LoGreco
"""
| Python | 0 | |
248a756cd6ff44eca6e08b3e976bc2ae027accd4 | Add memory ok check | chassis_memory.py | chassis_memory.py | import re
import subprocess
from maas_common import status_err, status_ok, metric_bool
OKAY = re.compile('(?:Health|Status)\s+:\s+(\w+)')
def chassis_memory_report():
"""Return the report as a string."""
return subprocess.check_output(['omreport', 'chassis', 'memory'])
def memory_okay(report):
"""Dete... | Python | 0.000001 | |
260e2b6d4820ce008d751bc21289ece997247d05 | add source | sqlalchemy_fulltext/__init__.py | sqlalchemy_fulltext/__init__.py | # -*- coding: utf-8 -*-s
import re
from sqlalchemy import event
from sqlalchemy.schema import DDL
from sqlalchemy.orm.mapper import Mapper
from sqlalchemy.ext.compiler import compiles
from sqlalchemy.ext.declarative import declared_attr
from sqlalchemy.sql.expression import ClauseElement
MYSQL = "mysql"
MYSQL_BUILD_I... | Python | 0 | |
eb1ba44a9c00303bbf8ff20b4b489a6058a4ab1d | Fix Buffer.__len__ | neovim/buffer.py | neovim/buffer.py | from util import RemoteMap
class Buffer(object):
def __len__(self):
return self.get_length()
def __getitem__(self, idx):
if not isinstance(idx, slice):
return self.get_line(idx)
include_end = False
start = idx.start
end = idx.stop
if start == None:
... | from util import RemoteMap
class Buffer(object):
def __len__(self):
return self._vim.get_buffer_count()
def __getitem__(self, idx):
if not isinstance(idx, slice):
return self.get_line(idx)
include_end = False
start = idx.start
end = idx.stop
if start... | Python | 0.000133 |
257a328745b9622713afa218940d2cd820987e93 | Add a super simple color correction client example | examples/color-correction-ui.py | examples/color-correction-ui.py | #!/usr/bin/env python
#
# Simple example color correction UI.
# Talks to an fcserver running on localhost.
#
# Micah Elizabeth Scott
# This example code is released into the public domain.
#
import Tkinter as tk
import socket
import json
import struct
s = socket.socket()
s.connect(('localhost', 7890))
print "Connecte... | Python | 0 | |
2359d7f6140b7b8292c3d9043064a9ee195ecebb | add module for storing repeated constants | code/constants.py | code/constants.py | """Module for constants and conversion factors."""
__author__ = 'Salman Hashmi, Ryan Keenan'
__license__ = 'BSD License'
TO_DEG = 180./np.pi
TO_RAD = np.pi/180.
| Python | 0.000001 | |
e2744bef45b62b6af2882aa881c494b9367a7d2a | Add 2D hybridization demo with file-write | experiments/hybridization_2D.py | experiments/hybridization_2D.py | """Solve a mixed Helmholtz problem
sigma + grad(u) = 0,
u + div(sigma) = f,
using hybridisation with SLATE performing the forward elimination and
backwards reconstructions. The corresponding finite element variational
problem is:
dot(sigma, tau)*dx - u*div(tau)*dx + lambdar*dot(tau, n)*dS = 0
div(sigma)*v*dx + u*v*d... | Python | 0 | |
07da1b8a2d0a8c8e28db3c9bed9de1d9f9a7ad6f | Add base solver class | base_solver.py | base_solver.py | #!/usr/bin/env python
# encoding: utf-8
from datetime import datetime
class BaseSolver(object):
task = None
best_solution = None
best_distance = float('inf')
search_time = None
def __init__(self, task):
self.task = task
def run(self):
start_time = datetime.now()
self... | Python | 0 | |
ff76d47f210e97f3ac4ba58a2c3eecb045b28cde | Create RateLimit.py | Cogs/RateLimit.py | Cogs/RateLimit.py | import asyncio
import discord
import os
from datetime import datetime
from discord.ext import commands
# This is the RateLimit module. It keeps users from being able to spam commands
class RateLimit:
# Init with the bot reference, and a reference to the settings var
def __init__(self, bot, settings):
self.bo... | Python | 0.000001 | |
d2b7f191519835a3a8f0e8a32fb52c7b354b0e33 | Add Slurp command | Commands/Slurp.py | Commands/Slurp.py | # -*- coding: utf-8 -*-
"""
Created on Aug 31, 2015
@author: Tyranic-Moron
"""
from IRCMessage import IRCMessage
from IRCResponse import IRCResponse, ResponseType
from CommandInterface import CommandInterface
from Utils import WebUtils
from bs4 import BeautifulSoup
class Slurp(CommandInterface):
triggers = ['... | Python | 0.000005 | |
3d14d2be217e0fbec17955ffa318a584edd96bec | Revert "remove custom demand for update from master" | cea/demand.py | cea/demand.py | """
===========================
Analytical energy demand model algorithm
===========================
File history and credits:
J. Fonseca script development 24.08.15
D. Thomas formatting, refactoring, debugging and cleaning
D. Thomas integration in toolbox
J. Fonseca refactoring to new properties file ... | Python | 0 | |
10737d8979c07e33af3e6c993062cdd6b0f13352 | Create cogestione.py | cogestione.py | cogestione.py | from random import shuffle
from random import randint
import matplotlib.pyplot as plt
class Session(object):
def __init__(self, n, capacity, course):
self.n = n
self.capacity = capacity
self.enrolled = 0
self.students = []
self.course = course
def add(self, student):
... | Python | 0.000001 | |
bfdd9077fcdd27254e9ac29991647456487aef7d | Add memoize util. | pylib/memoize.py | pylib/memoize.py | # Copyright 2012 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | Python | 0.002851 | |
8b6020384e20305411d2bbb587a2504ef302a17c | Create calculatepi.py | calculatepi.py | calculatepi.py | """
calculatepi.py
Author: <your name here>
Credit: <list sources used, if any>
Assignment:
| Python | 0.000002 | |
d3a320bf9387a0a36419c5166a4052e87d6c059e | Check Tabular Widths script added | K11.07-CheckTabularWidths.py | K11.07-CheckTabularWidths.py | #FLM: Check Tabular Widths 1.2
# ------------------------
# (C) Vassil Kateliev, 2017 (http://www.kateliev.com)
# * Based on TypeDrawers Thread
# http://typedrawers.com/discussion/1918/simple-script-test-in-batch-if-all-tabular-and-fixed-width-values-are-correct
# No warranties. By using this you agree
# t... | Python | 0 | |
0bc5b307d5121a3cacac159fa27ab42f97e208aa | Add database module | rabbithole/db.py | rabbithole/db.py | # -*- coding: utf-8 -*-
import logging
from sqlalchemy import (
create_engine,
text,
)
logger = logging.getLogger(__name__)
class Database(object):
"""Database writer.
:param url: Database connection string
:type url: str
"""
def __init__(self, url, insert_query):
"""Connect ... | Python | 0.000001 | |
b62ed7a60349536457b03a407e99bae3e3ff56e8 | install issue | erpnext/setup/install.py | erpnext/setup/install.py | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
default_mail_footer = """<div style="padding: 7px; text-align: right; color: #888"><small>Sent via
<a style="color... | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
default_mail_footer = """<div style="padding: 7px; text-align: right; color: #888"><small>Sent via
<a style="color... | Python | 0.000001 |
43e823ad9ea7c44b49c883e8633dc488dff0d2ca | Add end_time for indexing. | events/search_indexes.py | events/search_indexes.py | from haystack import indexes
from .models import Event
from django.utils.translation import get_language
from django.utils.html import strip_tags
class EventIndex(indexes.SearchIndex, indexes.Indexable):
text = indexes.CharField(document=True, use_template=True)
autosuggest = indexes.EdgeNgramField(model_attr=... | from haystack import indexes
from .models import Event
from django.utils.translation import get_language
from django.utils.html import strip_tags
class EventIndex(indexes.SearchIndex, indexes.Indexable):
text = indexes.CharField(document=True, use_template=True)
autosuggest = indexes.EdgeNgramField(model_attr=... | Python | 0 |
a85e444e9411f9f768db7c3e1b589b737c01b0a0 | add mnist examples | TensorFlow/ex3/test_mnist.py | TensorFlow/ex3/test_mnist.py | #!/usr/bin/env python
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import gzip
import os
import tempfile
import numpy
from six.moves import urllib
from six.moves import xrange # pylint: disable=redefined-builtin
import tensorflow as tf
from tensorflow.e... | Python | 0 | |
523ef51278c964718da68bb789e78e6c8f5f8766 | Add the init method to the notification model. | model/notification.py | model/notification.py | def NotificationModel(Query):
def __init__(self, db):
self.db = db
self.table_name = "notification"
super(NotificationModel, self).__init__() | Python | 0 | |
c68c5bf488cb7224d675bec333c6b7a4992574ed | Add a simple APL exception class | apl_exception.py | apl_exception.py | """
A simple APL exception class
"""
class APL_Exception (BaseException):
"""
APL Exception Class
"""
def __init__ (self,message,line=None):
self.message = message
self.line = line
# EOF
| Python | 0.000007 | |
4ed366aa341a32667fed84aa683062c2cd789b4b | implement a forecast gridding routine | scripts/fxgridder.py | scripts/fxgridder.py | """Generate forecast grids"""
import sys
import datetime
import pytz
import requests
import os
import pygrib
import socket
import shutil
import zipfile
import glob
import numpy as np
from scipy.interpolate import NearestNDInterpolator
from pyiem import reference
from pyiem.datatypes import temperature, humidity, speed
... | Python | 0 | |
e68590e9e05ab54b91ad3d03e372fbf8b341c3b9 | Use a logger thread to prevent stdout races. | gtest-parallel.py | gtest-parallel.py | #!/usr/bin/env python2
import Queue
import optparse
import subprocess
import sys
import threading
parser = optparse.OptionParser(
usage = 'usage: %prog [options] executable [executable ...]')
parser.add_option('-w', '--workers', type='int', default=16,
help='number of workers to spawn')
parser.a... | #!/usr/bin/env python2
import Queue
import optparse
import subprocess
import sys
import threading
parser = optparse.OptionParser(
usage = 'usage: %prog [options] executable [executable ...]')
parser.add_option('-w', '--workers', type='int', default=16,
help='number of workers to spawn')
parser.a... | Python | 0 |
e093ce0730fa3071484fed251535fea62e0430d6 | add logger view | View/LoggerView.py | View/LoggerView.py | # Under MIT License, see LICENSE.txt
from PyQt4.QtGui import QWidget
from PyQt4.QtCore import QTimer
from PyQt4.QtGui import QListWidget
from PyQt4.QtGui import QHBoxLayout
from PyQt4.QtGui import QVBoxLayout
from PyQt4.QtGui import QPushButton
from Model.DataInModel import DataInModel
__author__ = 'RoboCupULaval'
... | Python | 0 | |
b2f07c815c66be310ee1c126ba743bb786d79a08 | Create problem2.py | W2/PS2/problem2.py | W2/PS2/problem2.py | '''
PROBLEM 2: PAYING DEBT OFF IN A YEAR (15.0/15.0 points)
Now write a program that calculates the minimum fixed monthly payment needed in order pay off a credit card balance within 12 months. By a fixed monthly payment, we mean a single number which does not change each month, but instead is a constant amount that w... | Python | 0.000024 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.