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 |
|---|---|---|---|---|---|---|---|
3ab998b022ff69c21c470de397f12557a1141168 | Add tests for photo.utils | src/photo/tests/test_utils.py | src/photo/tests/test_utils.py | """
Tests for photo.utils
"""
import uuid
from django.test import TestCase
from photo import utils
# pylint: disable=too-few-public-methods
class DummyInstance:
"""
Dummy instance object for passing into UploadToPathAndRename
"""
pk = None # pylint: disable=invalid-name
class UploadToPathAndRenameT... | Python | 0 | |
dea182f5618f7590ee7e8fb6d2872ac60c6b6069 | Add setup.py to afni. | nipype/interfaces/afni/setup.py | nipype/interfaces/afni/setup.py | def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration('afni', parent_package, top_path)
config.add_data_dir('tests')
return config
if __name__ == '__main__':
from numpy.distutils.core import setup
setup(**configuration(... | Python | 0.000178 | |
fdf6dfbb7f82252cfe1e07719e3658fc529f47aa | Create hello-friend.py | baby-steps/hello-friend.py | baby-steps/hello-friend.py | print "hell0-fr1end"
| Python | 0.992038 | |
545bc9ae80fb9b141613e8a107560d6d868b5bcd | adding Solar System Universe | EXOSIMS/SimulatedUniverse/SolarSystemUniverse.py | EXOSIMS/SimulatedUniverse/SolarSystemUniverse.py | from EXOSIMS.Prototypes.SimulatedUniverse import SimulatedUniverse
import numpy as np
from EXOSIMS.util.eccanom import eccanom
import astropy.units as u
import astropy.constants as const
class SolarSystemUniverse(SimulatedUniverse):
"""Simulated Universe module based on SAG13 Planet Population module.
"""... | Python | 0.998929 | |
709ec407d333a624ff4476a81bc0f6ebb86f055a | add comments handle python file | data/Reddit/moderators_subreddit_comments.py | data/Reddit/moderators_subreddit_comments.py | # -*- coding: utf-8 -*-
# @Author: Lich_
# @Date: 2016-11-26 18:14:52
# @Last Modified by: LichAmnesia
# @Last Modified time: 2016-11-26 13:53:35
import json
import os
# generate the moderators from moderators file. the output is the moderators_subreddit file
def getmoderators():
file = open('moderators_sub... | Python | 0 | |
5c278ec8afe7fd97c0f3a4b45c0acc25706afd1e | add python_solve.py | dune-burgers/pymor-wrapper/python_solve.py | dune-burgers/pymor-wrapper/python_solve.py | import sys
from pymor.tools import mpi
from pymor.discretizations.mpi import mpi_wrap_discretization
from pymor.vectorarrays.mpi import MPIVectorArrayAutoComm
from dune_burgers import discretize_dune_burgers
filename = sys.argv[1]
exponent = float(sys.argv[2])
obj_id = mpi.call(mpi.function_call_manage, discretize_... | Python | 0.998873 | |
b4729cfbff3bdf11da73436d4f927f0ffb9d1b40 | Add montage func | mnefun/misc.py | mnefun/misc.py | # -*- coding: utf-8 -*-
"""Miscellaneous utilities."""
import numpy as np
import mne
def make_montage(info, kind, check=False):
from . import _reorder
assert kind in ('mgh60', 'mgh70', 'uw_70', 'uw_60')
picks = mne.pick_types(info, meg=False, eeg=True, exclude=())
if kind in ('mgh60', 'mgh70'):
... | Python | 0.000001 | |
3ed04c4ba438c9dcbea94e6b48a06316fcdac4d3 | diofant task 002 | diofant/diofant_002.py | diofant/diofant_002.py | #!/usr/bin/env python3
# Имеется ряд чисел Фибоначчи: 1, 1, 2, 3, 5, 8, 13, 21,...
# (каждый следующий член ряда равен сумме двух предыдущих, начинается ряд с двух единиц).
# Найти сумму членов этого ряда, меньших одного миллиарда и находящихся на нечетных позициях.
# Внимание! Ответом на задачу является целое число в... | Python | 0.99999 | |
ded9c39402ca9cf7adfaaebbf06c196048d48db9 | Add presubmit check for run-bindings-tests | Source/bindings/PRESUBMIT.py | Source/bindings/PRESUBMIT.py | # Copyright (C) 2013 Google Inc. 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 conditions and the ... | Python | 0.000071 | |
e94d5f86d983f6b930d41abaed56cba05e5fa030 | test run_async | corehq/apps/userreports/tests/test_async_indicators.py | corehq/apps/userreports/tests/test_async_indicators.py | from django.test import SimpleTestCase
from corehq.apps.userreports.models import DataSourceConfiguration
from corehq.apps.userreports.util import get_indicator_adapter
class RunAsynchronousTest(SimpleTestCase):
def _create_data_source_config(self, indicators=None):
default_indicator = [{
"ty... | Python | 0.000005 | |
d9d8e68c92fc808e43cf5ffe897541738f90d428 | Add manage.py to support running project scripts | manage.py | manage.py | from flask_script import Manager
from app import app
manager = Manager(app)
if __name__ == "__main__":
manager.run() | Python | 0 | |
52193599f1f6bc5acded2188c9e2016c52d26188 | Add HTML music table generator | music_table.py | music_table.py | #!/usr/bin/env python3
# Written by Michael Younkin in 2014. This work is in the public domain.
HELP_TEXT = '''
music_table.py
--------------
SYNOPSIS
python music_table.py -h
python music_table.py URL_PREFIX
DESCRIPTION
This program generates HTML for the GSO website's "listen" page. It will
accep... | Python | 0.000001 | |
6b34500741b4ef1f73fac0045805ab49dad579ba | product expression | doing-math-with-python/product_expression.py | doing-math-with-python/product_expression.py | # -*- coding: utf-8 -*-
"""
Product of two expressions
Created on Tue Feb 16 14:38:14 2016
@author: Liu Lixiang
"""
from sympy import expand, sympify, pprint
from sympy.core.sympify import SympifyError
def product(expr1, expr2):
prod = expand(expr1*expr2)
pprint(prod)
if __name__=='__main__':
expr1 = ... | Python | 0.960891 | |
fbd179d9d22a2eef6c2fb24152a441b85133e556 | Add missing component of previous commit | lowfat/utils.py | lowfat/utils.py | """
This module contains small utility classes and functions which do not clearly belong to one part of the project.
"""
import enum
class ChoicesEnum(enum.Enum):
"""
Abstract Enum class to represent values in a Django CharField choices.
"""
@classmethod
def choices(cls):
"""
Get ... | Python | 0.000002 | |
9199563bb21276102ca58dc6b7c99f593db863d4 | Add test for call_actions_during_tree_build | tests/func/test_build_tree.py | tests/func/test_build_tree.py | import pytest # noqa
from parglare import Grammar, Parser
def test_call_actions_during_tree_build():
grammar = """
Program: "begin" MoveCommand* "end";
MoveCommand: "move" Direction;
Direction: "up" | "down" | "left" | "right";
"""
g = Grammar.from_string(grammar)
code = """
begin
... | Python | 0.000002 | |
9140b3249820d0dd86f7f85270327d9264841b50 | Test for selecting mysql search backend | tests/search_backend_mysql.py | tests/search_backend_mysql.py | from wolis.test_case import WolisTestCase
from wolis import utils
class SearchBackendMysqlTest(WolisTestCase):
@utils.restrict_database('mysql*')
@utils.restrict_phpbb_version('>=3.1.0')
def test_set_search_backend(self):
self.login('morpheus', 'morpheus')
self.acp_login('morpheus', 'morphe... | Python | 0 | |
3c3fe1e1f1884df47157c71584b7b6087bde7f10 | add owner check, code borrowed from RoboDanny | cogs/utils/checks.py | cogs/utils/checks.py | from discord.ext import commands
def is_owner_check(message):
return message.author.id == '103714384802480128'
def is_owner():
return commands.check(lambda ctx: is_owner_check(ctx.message))
| Python | 0 | |
ee88f6927dee820318bc821081138374b8f754f2 | Create data_functions.py | data_functions.py | data_functions.py | import pandas as pd
import numpy as np
def load_data(path):
'''
(str) -> (pandas.DataFrame)
Loads the database and cleans the whitespace in STATIONS_ID.
IMPORTANT: This function assumes you have the database stored in a text file in the directory.
'''
data = pd.read_csv(path, index_col = 2... | Python | 0.000261 | |
82906d8dabfd551c997569f2f36ecdfc1ef3057f | Create duplicates.py | Python/duplicates.py | Python/duplicates.py | #The rem_dep method removes the duplicate values while maintaining the original order of the list.
def rem_dup(values):
output=[]
seen=set()
for val in values:
if val not in seen:
output.append(val)
seen.add(val)
return output
#sample list to test code.
values=[... | Python | 0.000391 | |
8611ea1e23b8958be98a6d5c15bd66f08e46859f | Handle connection error when sending event to consul. | meerkat_libs/consul_client/__init__.py | meerkat_libs/consul_client/__init__.py | import json
import logging
import jwt
import collections
from os import environ
import backoff as backoff
import requests
from meerkat_libs import authenticate
CONSUL_URL = environ.get("CONSUL_URL", "http://nginx/consul")
SUBMISSIONS_BUFFER_SIZE = environ.get("CONSUL_SUBMISSIONS_BUFFER_SIZE", 1000)
DHIS2_EXPORT_ENAB... | import json
import logging
import jwt
import collections
from os import environ
import backoff as backoff
import requests
from meerkat_libs import authenticate
CONSUL_URL = environ.get("CONSUL_URL", "http://nginx/consul")
SUBMISSIONS_BUFFER_SIZE = environ.get("CONSUL_SUBMISSIONS_BUFFER_SIZE", 1000)
DHIS2_EXPORT_ENAB... | Python | 0 |
f666560f9ffa2323b8a125e3ad3d3faf6bd5b3de | add command to grant sms gateway permissions | corehq/apps/smsbillables/management/commands/add_sms_gateway_permissions.py | corehq/apps/smsbillables/management/commands/add_sms_gateway_permissions.py | from django.contrib.auth.models import User
from django.core.management import BaseCommand
from django_prbac.models import Grant, Role, UserRole
from corehq import privileges
class Command(BaseCommand):
help = 'Grants the user(s) specified the privilege to access global sms gateways'
def add_arguments(self... | Python | 0.000009 | |
ff82f56b8ea901a30478b11a61f8ca52b23346bd | Add a test case for guessing the BuildDir associated with a subdirectory argument. | test/BuildDir/guess-subdir.py | test/BuildDir/guess-subdir.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.997656 | |
f8fbf47ede2536d2d2a40ef70a648b11ea928132 | Replace libraries of plumbing/models/exporters.py (issue #11). | imagedownloader/plumbing/models/exporters.py | imagedownloader/plumbing/models/exporters.py | from django.db import models
from core import Process, Stream, FileStatus, File
from libs.file import netcdf as nc
import calendar
from libs import matrix
import pytz
from datetime import datetime
class Compact(Process):
class Meta:
app_label = 'plumbing'
extension = models.TextField()
resultant_stream = ... | from django.db import models
from core import Process, Stream, FileStatus, File
from libs.file import netcdf as nc
import os
import calendar
import collections
from libs import matrix
class Compact(Process):
class Meta:
app_label = 'plumbing'
extension = models.TextField()
resultant_stream = models.Foreig... | Python | 0 |
88e5b5117c747f21cc868503d2e5c123ca976585 | Add tests for decorators | kolibri/core/tasks/test/test_decorators.py | kolibri/core/tasks/test/test_decorators.py | import pytest
from kolibri.core.tasks.decorators import task
from kolibri.core.tasks.exceptions import FunctionNotRegisteredAsJob
from kolibri.core.tasks.job import JobRegistry
from kolibri.core.tasks.job import RegisteredJob
from kolibri.core.tasks.utils import stringify_func
@pytest.fixture
def registered_jobs():
... | Python | 0 | |
a6be0447e07d388f5dc4942d7f9e391366185c78 | Create solution.py | leetcode/easy/count_and_say/py/solution.py | leetcode/easy/count_and_say/py/solution.py | class Solution(object):
def countAndSay(self, n):
"""
:type n: int
:rtype: str
"""
s = '1'
while n > 1:
t = ''
cnt = 1
for i in range(len(s)):
if i + 1 < len(s) and s[i] == s[i + 1]:
... | Python | 0.000018 | |
ff187730fa1ebd64984dbb6e91a8f04edae84548 | Introduce module for CLI commands; implement data generating command | ngx_task/cli.py | ngx_task/cli.py | import os
from concurrent.futures import ThreadPoolExecutor, as_completed
from ngx_task import settings, utils
def generate_data():
if not os.path.exists(settings.DATA_DIR):
os.mkdir(settings.DATA_DIR, 0o755)
files_to_submit = ['arc-{}.zip'.format(arc_num) for arc_num in range(1, 51)]
with Thre... | Python | 0 | |
4ccf9b6135ca5c6317502ffd663d5de4d180eea3 | Add migration for commit b52f572646f30a8a4f2fc2bec6fc31c8f498f33f | mcf_standard_browser/standards_review/migrations/0032_auto_20160307_1802.py | mcf_standard_browser/standards_review/migrations/0032_auto_20160307_1802.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.3 on 2016-03-07 18:02
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('standards_review', '0031_auto_20160209_1255'),
]
op... | Python | 0.000001 | |
bc5105d7e8263bcaf0be8cc88bff8438fa1972a4 | add import script for ryedale | polling_stations/apps/data_collection/management/commands/import_ryedale.py | polling_stations/apps/data_collection/management/commands/import_ryedale.py | """
Imports Ryedale
"""
from django.contrib.gis.geos import Point, GEOSGeometry
from data_collection.management.commands import BaseKamlImporter
class Command(BaseKamlImporter):
"""
Imports the Polling Station data from Ryedale Council
"""
council_id = 'E07000167'
districts_name = 'Thirsk_and_... | Python | 0 | |
d44bf960aa597e5a38fbc2f8f7dd18fbd704cf7c | add nova start vm to recovery | drcontroller/recovery/nova_start_vm.py | drcontroller/recovery/nova_start_vm.py | import novaclient.v1_1.client as novaclient
import ConfigParser
def start_vm(server_id):
cf=ConfigParser.ConfigParser()
cf.read("/home/eshufan/projects/drcontroller/drcontroller/conf/set.conf")
drc_ncred={}
drc_ncred['auth_url']= cf.get("drc","auth_url")
drc_ncred['username']= cf.get("drc","user")
... | Python | 0 | |
cb0a5480a7c198a34069e4e65707c18f0ee6b7b9 | Add catalan_numbers.py (#4455) | dynamic_programming/catalan_numbers.py | dynamic_programming/catalan_numbers.py | """
Print all the Catalan numbers from 0 to n, n being the user input.
* The Catalan numbers are a sequence of positive integers that
* appear in many counting problems in combinatorics [1]. Such
* problems include counting [2]:
* - The number of Dyck words of length 2n
* - The number well-formed expressions with... | Python | 0 | |
6d03266160ce95a41b94561d707e399df78aae14 | Add sanity test case comm_wifi_connect | lib/oeqa/runtime/sanity/comm_wifi_connect.py | lib/oeqa/runtime/sanity/comm_wifi_connect.py | import time
from oeqa.oetest import oeRuntimeTest
class CommWiFiTest(oeRuntimeTest):
'''WiFi test by connmanctl'''
def test_wifi_connect_nopassword(self):
'''connmanctl to connect a no-password wifi AP'''
# un-block software rfkill lock
self.target.run('rfkill unblock all')
# En... | Python | 0.000143 | |
2cc6edec8295a216261fff09388a35e0805f474c | Add test to validate service names | tests/functional/test_service_names.py | tests/functional/test_service_names.py | # Copyright 2017 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompa... | Python | 0.000001 | |
b63986d2ce2f7ac24cd78c7b5971878d9b1a841a | Add remaining integration tests | tests/integration/modules/mac_ports.py | tests/integration/modules/mac_ports.py | # -*- coding: utf-8 -*-
'''
integration tests for mac_ports
'''
# Import python libs
from __future__ import absolute_import, print_function
# Import Salt Testing libs
from salttesting.helpers import ensure_in_syspath, destructiveTest
ensure_in_syspath('../../')
# Import salt libs
import integration
import salt.utils... | Python | 0 | |
6ad9b8e65562c00607fe0fe9f92cdba3c022ef2b | Add initial version Teach First Oauth2 backend. | lms/djangoapps/student_account/teachfirst.py | lms/djangoapps/student_account/teachfirst.py | from django.conf import settings
from social_core.backends.oauth import BaseOAuth2
import logging
log = logging.getLogger(__name__)
class TeachFirstOAuth2(BaseOAuth2):
"""TeachFirst OAuth2 authentication backend."""
settings_dict = settings.CUSTOM_BACKENDS.get('teachfirst')
name = 'teachfirst-oauth2'
... | Python | 0 | |
fde3496e41c9c00231d0f4d309147ff7dbae0f16 | Improve heredoc | cms/wizards/wizard_base.py | cms/wizards/wizard_base.py | # -*- coding: utf-8 -*-
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ImproperlyConfigured
from django.forms.models import ModelForm
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import (
override as force_language,
f... | # -*- coding: utf-8 -*-
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ImproperlyConfigured
from django.forms.models import ModelForm
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import (
override as force_language,
f... | Python | 0.000001 |
372469139dc103f75003f96616ac53bce8986274 | Add prediction module | src/righter/predict.py | src/righter/predict.py | import json
import argparse
import righter
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('-i', '--input-file', help='File with one json per line containing the key text', required=True)
parser.add_argument('-o', '--file-output', help='Save analysis to output file', requ... | Python | 0.000001 | |
1490aa8b11f9a7766eb03883214ded87ce1de439 | Generate a sample binomial distribution | stats/binomial_plot.py | stats/binomial_plot.py | import numpy as np
import random
import matplotlib.pylab as plt
from collections import Counter
def run_trial():
coin_tosses = 10
p = 0.5
successes = 0
for t in range(coin_tosses):
if random.random() < p:
successes = successes + 1
return successes
def main():
trials = 10... | Python | 0.999999 | |
15daff9a7823ddd7dbc3fb6f141d539d6b636301 | Add description field to Config | project/timeslot/migrations/0008_auto_20160622_0937.py | project/timeslot/migrations/0008_auto_20160622_0937.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('timeslot', '0007_auto_20160616_0049'),
]
operations = [
migrations.AlterField(
model_name='config',
... | Python | 0.000001 | |
757812e63c42f38ad065c31744427c5902a5d322 | Move some Utils outside of the main script. | data-preprocessor/listFile.py | data-preprocessor/listFile.py | # -*- coding: utf-8 -*-
"""
Created on Sun Sep 11 10:23:38 2016
@author: SISQUAKE
"""
import os
def listFilePath(path):
File = [];
Dir = [];
for (dirpath, dirnames, filenames) in os.walk(path):
for name in filenames:
tmp = os.path.join(dirpath, name);
File.app... | Python | 0 | |
1bf55df37a12af7984f08eb429e61a2c3a7cd836 | Add initial server states | blitz/io/server_states.py | blitz/io/server_states.py | __author__ = 'Will Hart'
from blitz.constants import *
from blitz.io.client_states import BaseState
def validate_command(tcp, msg, commands):
"""
Helper function which checks to see if a message is in the list of valid commands
and sends an appropriate response over the TCP network
"""
if msg.spl... | Python | 0.000001 | |
8e8cb549251b6914a34a729bb06c02462ed95af9 | convert old wizard into osv memory wizard for configuration | bin/addons/base/module/wizard/base_module_configuration.py | bin/addons/base/module/wizard/base_module_configuration.py | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | Python | 0.000002 | |
90c27c1444f80b6d746c8f92b6b79e38ae5ce87e | Update TFRT dependency to use revision http://github.com/tensorflow/runtime/commit/1a04c55547456cffd9b9d250dc8680eb9d89f750. | third_party/tf_runtime/workspace.bzl | third_party/tf_runtime/workspace.bzl | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "1a04c55547456cffd9b9d250dc8680eb9d89f750"
TFRT_SHA256 = "296130004f8b3ce22b46b9f263c9379dd462eff53c2332... | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "5e36ba4f8e42a4022062a10a75684d5a2dfb1b53"
TFRT_SHA256 = "3bf90326b6dd4f938825dd7ab3424abbee7cc86b370f24... | Python | 0.000002 |
f099d055279abfea2bd58c8e0b28c2fa162ac8cd | modify zqplant crawler script | crawler/DzwBaikeCrawler.py | crawler/DzwBaikeCrawler.py | import hashlib
'''
curl
-H 'Host: api.dzwbaike.xyz'
-H 'Content-Type: text/html;charset=UTF-8'
-H 'Accept: */*' -H 'Accept-Language: zh-cn'
-H 'token: 05e33d91-dd85-40d5-aa67-a90130270a95'
-H 'User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_3 like Mac OS X) AppleWebKit/603.3.8 (KHTML, like Gecko) Mobile/14G60 Mic... | Python | 0 | |
32a569f0f6f33ef5cf11031bb359989379582489 | add script to create cloudtrail table in Athena | create_cloudtrail_table.py | create_cloudtrail_table.py | import boto3
# Create AWS session
try:
session = boto3.session.Session(profile_name='training')
except Exception as e:
session = boto3.session.Session()
# Connect to Athena
athena = session.client('athena', region_name='us-east-1')
def lambda_handler(event, context):
# You must submit the AWS account n... | Python | 0 | |
f693949a21864938991904ed1503ae5303426c90 | Revert "Remove test stub" | test/TestLineNumber.py | test/TestLineNumber.py | # Copyright (c) 2020 Albin Vass <albin.vass@gmail.com>
#
# 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, m... | Python | 0 | |
3bb43f31263cce7ceebab943a1eed9e8c83cb90d | Set dbtable for models to use the "celery_" prefix not "djcelery". | djcelery/models.py | djcelery/models.py | import django
from django.db import models
from django.utils.translation import ugettext_lazy as _
from picklefield.fields import PickledObjectField
from celery import conf
from celery import states
from djcelery.managers import TaskManager, TaskSetManager
TASK_STATUSES_CHOICES = zip(states.ALL_STATES, states.ALL_S... | import django
from django.db import models
from django.utils.translation import ugettext_lazy as _
from picklefield.fields import PickledObjectField
from celery import conf
from celery import states
from djcelery.managers import TaskManager, TaskSetManager
TASK_STATUSES_CHOICES = zip(states.ALL_STATES, states.ALL_S... | Python | 0 |
18f7737f1f187aef7181e6cdd72db774df8eda3d | add transformer test | jubakit/test/integration/test_model.py | jubakit/test/integration/test_model.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
from unittest import TestCase
import os
import json
from jubakit.model import JubaModel
from jubakit.anomaly import Anomaly, Config as AnomalyConfig
from jubakit.classifier import Classifier, Config as Classif... | Python | 0 | |
00990b531f1f78b372b0b08a649a84e6168a3c0e | Use ugettext_lazy for import-time translations. | debug_toolbar/panels/timer.py | debug_toolbar/panels/timer.py | from __future__ import absolute_import, unicode_literals
try:
import resource # Not available on Win32 systems
except ImportError:
resource = None
import time
from django.template.loader import render_to_string
from django.utils.translation import ugettext_lazy as _
from debug_toolbar.panels import Panel
... | from __future__ import absolute_import, unicode_literals
try:
import resource # Not available on Win32 systems
except ImportError:
resource = None
import time
from django.template.loader import render_to_string
from django.utils.translation import ugettext as _
from debug_toolbar.panels import Panel
clas... | Python | 0 |
317c74fb6a31aad82f080b3bb8383c4047ae2f63 | Create tests.py | demo/openmrs/openmrs/tests.py | demo/openmrs/openmrs/tests.py | import unittest
from BaseOpenmrsObject import *
class TestOrderFunctions(unittest.TestCase):
def setUp(self):
self.order = Order()
self.order.setOrderId(9112)
self.order.setOrderNumber('911')
def test_copy_methods(self):
copy1 = self.order.copy()
copy2 = self.o... | Python | 0.000001 | |
9f18d31b85067fac2fd4d41d59c3158b50bd8c87 | math2 | tests/domains/math2.py | tests/domains/math2.py | #!/usr/bin/env python3
from collections import defaultdict
from copy import copy
from strips import *
class S(State):
def __init__(self, n):
self.n = n
@Action
def incr(self):
if self.n % 4 != 0: raise UnsatisfiedPreconditions()
self.n += 1
@Action
def double(self):
... | Python | 0.999621 | |
274d539e0cf08a3417315bd68bc5544dbb21d0ff | Add config test | tests/config.py | tests/config.py | import wakefs.config
import os
import unittest
import random
import string
def random_str(N):
''.join(random.choice(string.ascii_uppercase + string.digits + string.ascii_lowercase) for x in range(N))
class TestConfigFileCreate(unittest.TestCase):
def test_file_create(self):
testfile = "test.cfg"
... | Python | 0.000001 | |
c1c5f58d12ff9a8e532de971c28e3676915a7117 | Add py-cairocffi package (#12161) | var/spack/repos/builtin/packages/py-cairocffi/package.py | var/spack/repos/builtin/packages/py-cairocffi/package.py | # Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyCairocffi(PythonPackage):
"""cairocffi is a CFFI-based drop-in replacement for Pycairo, ... | Python | 0 | |
eda01c6b45629d6c039785ba502dcde47cabd020 | Add python implementation | probability.py | probability.py | #!/usr/bin/env python
import random
import sets
BOARD_SIZE = 9
MINES = 10
SAMPLES = 10**5
def generate_mines(board_size, num_of_mines):
mines = sets.Set()
while len(mines) != num_of_mines:
mines.add((random.randint(0, board_size - 1),
random.randint(0, board_size - 1)))
return mi... | Python | 0.000099 | |
3352236ff27dbfd749b71dd152f6809b2019bee4 | add tests | test_czech_holidays.py | test_czech_holidays.py | import re
from datetime import date
import requests
import pytest
from czech_holidays import holidays, Holidays, Holiday
WIKIPEDIA_RE = re.compile(r'Rok\s\d{4}</th>\s<td>(?P<date>\w+)')
WIKIPEDIA_DATE_RE = re.compile(r'(?P<day>\d+)\.\s+(?P<month>\w+)\s+(?P<year>\d{4})')
def fetch_easter_dates():
response = r... | Python | 0 | |
0415071808b1bfa659a790e50692dc65d479b627 | add config.sample.py | tests/config.sample.py | tests/config.sample.py | """
This is the sample config.py
create your own config.py which match your testsetup
It will be imported by device tests
"""
from testWrt import testsetup
TestSetup = testsetup.TestSetup()
TestSetup.set_openwrt("192.168.2.1")
| Python | 0.000003 | |
08f147052e19c43e89f3548a10ecc847316e6789 | Add a tool for backend synchronization | tools/syncer.py | tools/syncer.py | def sync():
import os
from bson.objectid import ObjectId
from girder import logger
from girder.models.assetstore import Assetstore
from girder.models.collection import Collection
from girder.models.file import File
from girder.models.folder import Folder
from girder.models.item import It... | Python | 0.000001 | |
eb091fc81dc374d0eb0800a596d6e0db95a55687 | Create CombinationSumII_001.py | leetcode/040-Combination-Sum-II/CombinationSumII_001.py | leetcode/040-Combination-Sum-II/CombinationSumII_001.py | #Node simplification, improvement & optimization
#How, it's good because it can be done on the original code of "Combination Sum"
class Solution:
# @param {integer[]} candidates
# @param {integer} target
# @return {integer[][]}
def combinationSum2(self, candidates, target):
candidates.sort()
... | Python | 0.000021 | |
d3a9a4a300acc204111e19945381a995f0f7cdda | add import script for Dumfries and Galloway | polling_stations/apps/data_collection/management/commands/import_dumfries_and_galloway.py | polling_stations/apps/data_collection/management/commands/import_dumfries_and_galloway.py | from data_collection.management.commands import BaseScotlandSpatialHubImporter
class Command(BaseScotlandSpatialHubImporter):
council_id = 'S12000006'
council_name = 'Dumfries and Galloway'
elections = ['local.dumfries-and-galloway.2017-05-04']
| Python | 0 | |
ba5d87ff551df47df2ed4de15058df28ad49fe41 | add error classes. | pumblr/error.py | pumblr/error.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
class PumblrError(object):
"""Pumblr exception"""
def __init__(self, msg):
self._msg = msg
def __str__(self):
return self._msg
class PumblrAuthError(PumblrError):
"""403 Forbidden exception"""
pass
class PumblrReqestError(PumblrErr... | Python | 0 | |
e6fb23f0bfb095b63bb9427f7838719f5248177c | Update Mindreader to use copy and no longer manipulate state | axelrod/strategies/mindreader.py | axelrod/strategies/mindreader.py | import copy
import inspect
from axelrod import Player, RoundRobin, Game, update_histories
def simulate_match(player_1, player_2, strategy, rounds=10):
"""Simulates a number of matches."""
for match in range(rounds):
play_1, play_2 = strategy, player_2.strategy(player_1)
# Update histories and... | import copy
import inspect
from axelrod import Player, RoundRobin, Game, update_histories
def simulate_match(player_1, player_2, strategy, rounds=10):
"""Simulates a number of matches."""
for match in range(rounds):
play_1, play_2 = strategy, player_2.strategy(player_1)
# Update histories and... | Python | 0 |
86fe554e8cc67ad346d2ecc532cea6e94461a0c6 | Add support for file session | app/tools/session.py | app/tools/session.py | #-*- coding:utf-8 -*-
import uuid
import time
import os
import json
class Session(dict):
def __init__(self,session_id=None,expire=None,*args,**kw):
if session_id==None:
self._session_id=self._generate_session_id()
else:
self._session_id=session_id
self._expire=expire
super(Session,self).__init__(*args,*... | Python | 0 | |
8bfd0031c4a93b644cd8f9892a0cc1a8671a9024 | add build/BuildSpawn.py | Source/Python/build/BuildSpawn.py | Source/Python/build/BuildSpawn.py | import os
from threading import *
from subprocess import *
class BuildSpawn(Thread):
def __init__(self, Sem=None, Filename=None, Args=None, Num=0):
Thread.__init__(self)
self.sem=Sem
self.filename=Filename
self.args=Args
self.num=Num
def run(se... | Python | 0.000001 | |
00a00621f005e3db3fd25c4c09fb1540ba165fed | Test the VenvBuilder | tests/unit/builders/test_venv.py | tests/unit/builders/test_venv.py | import subprocess
import pretend
import pytest
import virtualenv.builders.venv
from virtualenv.builders.venv import VenvBuilder, _SCRIPT
def test_venv_builder_check_available_success(monkeypatch):
check_output = pretend.call_recorder(lambda *a, **kw: None)
monkeypatch.setattr(
virtualenv.builders.v... | Python | 0 | |
efc8d3182f79111b3a1b7df445dafd46fef9862a | Add YAML wrapper allowing conf strings to be used in YAML source files | controlbeast/utils/yaml.py | controlbeast/utils/yaml.py | # -*- coding: utf-8 -*-
"""
controlbeast.utils.yaml
~~~~~~~~~~~~~~~~~~~~~~~
:copyright: Copyright 2014 by the ControlBeast team, see AUTHORS.
:license: ISC, see LICENSE for details.
"""
import os
import yaml
from controlbeast.conf import CbConf
from controlbeast.utils.dynamic import CbDynamicIterable
f... | Python | 0 | |
42635f57c7af35c90f6327636f157aa807cde118 | add Python DREST client | dynamic_rest/client.py | dynamic_rest/client.py | import json
import requests
import inflection
API_AUTH_ENDPOINT = '/accounts/login/'
class AuthenticationFailed(Exception):
pass
class APIClient(object):
def __init__(
self,
host,
version=None,
session=None,
sessionid=None,
username=None,
password=N... | Python | 0.000001 | |
79f92d050fbf9ebe4f088aeabb5e832abeefe0d5 | Initialize unit tests for Coursera API module | tests/test_coursera.py | tests/test_coursera.py | import unittest
from mooc_aggregator_restful_api import coursera
class CourseraTestCase(unittest.TestCase):
'''
Unit Tests for module udacity
'''
def setUp(self):
self.coursera_test_object = coursera.CourseraAPI()
def test_coursera_api_courses_response(self):
self.assertEqual(s... | Python | 0.000001 | |
7d65a128ee71bc5c85170b247730ea385ab58d0c | add first handler test | tests/test_handlers.py | tests/test_handlers.py | import unittest
from unittest.mock import Mock
class RangeVotingHandler():
def __init__(self, member_repository):
self.repository = member_repository
def handle(self, command):
self.repository.save()
class RangeVotingRepository():
def save(self, rangevoting):
pass
class RangeV... | Python | 0 | |
8415decb4fea7cb8ad3a2800ecd9c9a9190fa331 | Add rename script in python | rename.py | rename.py | import os
SEPARATOR = '_'
EXT = ".png"
digits = range(1, 10)
for d in digits:
i = 1
for file in os.listdir(str(d)):
if file.endswith(EXT):
filepath = str(d) + '/'
old_filename = filepath + file
new_filename = filepath + str(d) + SEPARATOR + str(i) + EXT
os.rename(old_filename, new_filename)
i +=... | Python | 0.000001 | |
5872cbeb083ea4f6eba01c79185036cee0d7848c | add indexfile tools. Should go to pds tools later. | pyciss/indexfiles.py | pyciss/indexfiles.py | """Support tools to work with PDS ISS indexfiles."""
import pvl
import pandas as pd
from pathlib import Path
import progressbar
class PVLColumn(object):
def __init__(self, pvlobj):
self.pvlobj = pvlobj
@property
def name(self):
return self.pvlobj['NAME']
@property
def name_as_lis... | Python | 0 | |
96cfe4d55ae6dd34cc30a72f19118aa66c65f7ca | add __main__ file to for python 2.7 entrypoint | selenium_odoo_qunit/__main__.py | selenium_odoo_qunit/__main__.py | if __name__ == '__main__':
from selenium_odoo_qunit import selenium_odoo_qunit as soq
soq.main()
| Python | 0.000007 | |
769f350802b78ffa9c74bc5b9a1e912b64ab718d | Add new package: py-asgiref (#16233) | var/spack/repos/builtin/packages/py-asgiref/package.py | var/spack/repos/builtin/packages/py-asgiref/package.py | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyAsgiref(PythonPackage):
"""ASGI specification and utilities."""
homepage = "https:/... | Python | 0 | |
e6e641e3beb2aad3e6d4eb1a37a7ee029006631b | add download_data.py for downloading data from nrao, it is not working yet | aws/download_data.py | aws/download_data.py | import sys
import os
import urllib
import urllib2
import webbrowser
from mechanize import ParseResponse, urlopen, urljoin, Browser
url = 'https://archive.nrao.edu/archive/advquery.jsp'
def download_with_mech(email, destination, file):
'''
download data from nrao archive. Now it only works for filling the form... | Python | 0 | |
f3ed5d434b83d7531aecd1431645267dedfecb45 | Create mqtt_sender.py | raspi/mqtt_sender.py | raspi/mqtt_sender.py | import paho.mqtt.publish as publish
MQTT_SERVER = "192.168.1.10"
MQTT_PATH = "test_channel"
publish.single(MQTT_PATH, "Hello World!", hostname=MQTT_SERVER)
| Python | 0.000002 | |
696402e5e292f52f96fc9dcd07457ac54387b21a | Remove fallback related code from backend interface. | redis_cache/cache.py | redis_cache/cache.py | # -*- coding: utf-8 -*-
from django.conf import settings
from django.core.cache.backends.base import BaseCache
from django.core.exceptions import ImproperlyConfigured
from django.core.cache import get_cache
from .util import load_class
from .exceptions import ConnectionInterrupted
import functools
DJANGO_REDIS_IGNO... | # -*- coding: utf-8 -*-
from django.conf import settings
from django.core.cache.backends.base import BaseCache
from django.core.exceptions import ImproperlyConfigured
from django.core.cache import get_cache
from .util import load_class
from .exceptions import ConnectionInterrupted
import functools
DJANGO_REDIS_IGNO... | Python | 0 |
a51a226dc0a134e01915e514e2146a664671d998 | Update dates for CFP | pyconcz_2017/proposals/pyconcz2016_config.py | pyconcz_2017/proposals/pyconcz2016_config.py | from datetime import datetime
from django.utils.timezone import get_current_timezone
from pyconcz_2017.proposals.models import Talk, Workshop, FinancialAid
tz = get_current_timezone()
class TalksConfig:
model = Talk
key = 'talks'
title = 'Talks'
cfp_title = 'Submit your talk'
template_about = '... | from datetime import datetime
from django.utils.timezone import get_current_timezone
from pyconcz_2017.proposals.models import Talk, Workshop, FinancialAid
tz = get_current_timezone()
class TalksConfig:
model = Talk
key = 'talks'
title = 'Talks'
cfp_title = 'Submit your talk'
template_about = '... | Python | 0.000001 |
ca842aee42fcb149e72a39334035cba81e969c65 | add clock | files/bin/bin/clock.py | files/bin/bin/clock.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
##############################################################################
#
# clock
# -----
#
# This script prints an icon representation of the time of day.
#
# Dependencies: python3, nerd-fonts
#
# :authors: J.P.H. Bruins Slot
# :date: 07-01-2019
# :version: 0.1... | Python | 0.000741 | |
0c09a85ff19a48dd69f44720823e8bb2cb75eef8 | add the visualization of the 1st conv layer kernels | chap9/visualize_conv1_kernels.py | chap9/visualize_conv1_kernels.py | import sys
import numpy as np
import matplotlib.pyplot as plt
import cv2
sys.path.append('/path/to/caffe/python')
import caffe
ZOOM_IN_SIZE = 50
PAD_SIZE = 4
WEIGHTS_FILE = 'freq_regression_iter_10000.caffemodel'
DEPLOY_FILE = 'deploy.prototxt'
net = caffe.Net(DEPLOY_FILE, WEIGHTS_FILE, caffe.TEST)
kernels = net.par... | Python | 0 | |
65546f4cd97331455a3309509d076825f07a078c | Add set_up file to run all tests | set_up.py | set_up.py | import os
import unittest2 as unittest
def suite():
return unittest.TestLoader().discover('tests','test_*.py')
if __name__ == '__main__':
unittest.main(defaultTest = 'suite') | Python | 0 | |
abea1f4598928fddf750358efcedbfaade019bf4 | Add migration to fix Attachment cache. | zerver/migrations/0386_fix_attachment_caches.py | zerver/migrations/0386_fix_attachment_caches.py | # Generated by Django 3.2.12 on 2022-03-23 04:32
from django.db import migrations, models
from django.db.backends.postgresql.schema import DatabaseSchemaEditor
from django.db.migrations.state import StateApps
from django.db.models import Exists, Model, OuterRef
def fix_attachment_caches(apps: StateApps, schema_edito... | Python | 0 | |
e7232c4050b4cae1302d2c638ed20f3ac69bf22c | comment out ui tests temporarily | tests/ui/test_login.py | tests/ui/test_login.py | # import unittest
# from tests.common.common import BASE_URL, USERNAME, PASSWORD
# from selenium import webdriver
# from selenium.webdriver.common.keys import Keys
# LOGIN_URL = BASE_URL + u'/accounts/login/'
# HOME_URL = BASE_URL + u'/home/my/'
# LOGOUT_URL = BASE_URL + u'/accounts/logout/'
# def get_logged_instance... | import unittest
from tests.common.common import BASE_URL, USERNAME, PASSWORD
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
LOGIN_URL = BASE_URL + u'/accounts/login/'
HOME_URL = BASE_URL + u'/home/my/'
LOGOUT_URL = BASE_URL + u'/accounts/logout/'
def get_logged_instance():
browser ... | Python | 0 |
f7c18c5718b775f6fd0e748a7f2b2f8c9bd87d77 | test suite for Routing.KEY_PARTITIONED, #1469 | test/python/topology/test2_parallel_key_partitioned.py | test/python/topology/test2_parallel_key_partitioned.py | # Licensed Materials - Property of IBM
# Copyright IBM Corp. 2020
import unittest
from streamsx.topology.tester import Tester
from streamsx.topology.topology import Topology
from streamsx.topology.topology import Routing
from streamsx.topology import context
from streamsx.topology.context import submit, ContextTypes, C... | Python | 0 | |
7b063825ca3fbd8a638d56a477d3b2380b7901be | Add tests for list_max_two | domaci-zadaci/06/test_list_max_two.py | domaci-zadaci/06/test_list_max_two.py | from solutions import list_max_two
import unittest
import random
class TestListMax(unittest.TestCase):
def test_two_equal_elements(self):
in_list = [random.randint(0, 1000)] * 2
expected = (in_list[0], in_list[1])
actual = list_max_two(in_list)
self.assertEqual(expected, actual)
... | Python | 0.00001 | |
bcb3948eea1903dc0127c8aee1b1decf11040496 | Add tolower simproc. | angr/procedures/libc/tolower.py | angr/procedures/libc/tolower.py | import angr
from angr.sim_type import SimTypeInt
import logging
l = logging.getLogger("angr.procedures.libc.tolower")
class tolower(angr.SimProcedure):
def run(self, c):
self.argument_types = {0: SimTypeInt(self.state.arch, True)}
self.return_type = SimTypeInt(self.state.arch, True)
if n... | Python | 0 | |
405bef33c1c68029b31ec6cb8f88b1edc28e2a6e | Create extract_wavelength tests module | tests/plantcv/hyperspectral/test_extract_wavelength.py | tests/plantcv/hyperspectral/test_extract_wavelength.py | import numpy as np
from plantcv.plantcv.hyperspectral import extract_wavelength
def test_extract_wavelength(hyperspectral_test_data):
new = extract_wavelength(spectral_data=hyperspectral_test_data.load_hsi(), wavelength=500)
assert np.shape(new.array_data) == (1, 1600)
| Python | 0 | |
d1abba72b79262c0b1462d7f7e42c798dc30003e | Create twinkle-status | twinkle-status/edit.py | twinkle-status/edit.py | # -*- coding: utf-8 -*-
import os
import re
os.environ['PYWIKIBOT_DIR'] = os.path.dirname(os.path.realpath(__file__))
import pywikibot
os.environ['TZ'] = 'UTC'
site = pywikibot.Site()
site.login()
with open('list.txt', 'r') as f:
for user in f:
user = user.strip()
page = pywikibot.Page(site, 'U... | Python | 0.000245 | |
af062396637c86e5f12fcbf2a8250d6189ac207b | Create flask_fysql_example.py | flask_fysql_example.py | flask_fysql_example.py | # -*- coding: utf-8 -*-
from fysql.databases import MySQLDatabase
from flask import current_app as app
class FySQL(object):
config = {}
name = ""
engine = MySQLDatabase
def __init__(self, app=None):
self.app = None
if app is not None:
self.init_app(app)
def init_app(s... | Python | 0.000032 | |
8b7c32f2058ce3c24ef3c19eb7d2d3f8d3154037 | Disable large profile startup benchmarks. | tools/perf/benchmarks/startup.py | tools/perf/benchmarks/startup.py | # Copyright 2013 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.
from telemetry import benchmark
from measurements import startup
import page_sets
class _StartupCold(benchmark.Benchmark):
"""Measures cold startup time... | # Copyright 2013 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.
from telemetry import benchmark
from measurements import startup
import page_sets
class _StartupCold(benchmark.Benchmark):
"""Measures cold startup time... | Python | 0.00002 |
2ec3614693e8343e04400e51326be5305b5abbf3 | Set a max_length for all snippets. Nobody needs more than 256k of space. | dpaste/forms.py | dpaste/forms.py | from django import forms
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from dpaste.models import Snippet
from dpaste.highlight import LEXER_LIST, LEXER_DEFAULT
import datetime
#===============================================================================
# Snippet Form and ... | from django import forms
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from dpaste.models import Snippet
from dpaste.highlight import LEXER_LIST, LEXER_DEFAULT
import datetime
#===============================================================================
# Snippet Form and ... | Python | 0 |
e13e714fa179544bef895274baf4f8ddb52ddd4a | add script to separate source columns to 6 columns with boolean values | python_scripts/seperating_source_column.py | python_scripts/seperating_source_column.py | """
seperating the Variant_Source column merged_v4.tsv into six columns:
Variant_in_ENIGMA
Variant_in_ClinVar
Variant_in_1000_Genomes
Variant_in_ExAC
Variant_in_LOVD
Variant_in_BIC
"""
COLUMNS = ["Variant_in_ENIGMA",
"Variant_in_ClinVar",
"Variant_in_1000_Genomes",
"Variant_in_ExAC",
... | Python | 0 | |
e0ab65f3877da992ac3705475ea0bdc520677cbe | Test CommandObjectMultiword functionality | packages/Python/lldbsuite/test/functionalities/multiword-commands/TestMultiWordCommands.py | packages/Python/lldbsuite/test/functionalities/multiword-commands/TestMultiWordCommands.py | """
Test multiword commands ('platform' in this case).
"""
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
class MultiwordCommandsTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@no_debug_info_test
def test_ambiguous_subcommand(self):
self.e... | Python | 0.000177 | |
a23e45a65221ec076059bd32cdb1d5bb787e123b | add less filter | dukpy/webassets/lessfilter.py | dukpy/webassets/lessfilter.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function
import os
from webassets.filter import Filter
import dukpy
__all__ = ('CompileLess', )
class CompileLess(Filter):
name = 'lessc'
max_debug_level = None
def setup(self):
self.less_includes = self.get_config('LIBSAS... | Python | 0.000001 | |
0f251e6c8620e19fc5e16e88b1ffbd5d51f7a7be | Add initial HDF storage class | gcmstools/datastore.py | gcmstools/datastore.py | import numpy as np
import pandas as pd
import tables as tb
class HDFStore(object):
def __init__(self, hdfname):
self.pdh5 = pd.HDFStore(hdfname, mode='a', complevel=9,
complib='blosc')
self.h5 = self.pdh5._handle
self._filters = tb.Filters(complevel=9, complib='blosc')
... | Python | 0 | |
585a5fa27321134623dcf431ebf80ba1dcd708de | add example script test equality of coefficients in two regression (basic example for onewaygls) | scikits/statsmodels/examples/try_2regress.py | scikits/statsmodels/examples/try_2regress.py | # -*- coding: utf-8 -*-
"""F test for null hypothesis that coefficients in two regressions are the same
see discussion in http://mail.scipy.org/pipermail/scipy-user/2010-March/024851.html
Created on Thu Mar 25 22:56:45 2010
Author: josef-pktd
"""
import numpy as np
from numpy.testing import assert_almost_equal
impor... | Python | 0 | |
06945ae360bdab9726ea78757d8e63b10ea252fe | Create cbalusek_02.py | Week01/Problem02/cbalusek_02.py | Week01/Problem02/cbalusek_02.py | """
Created on Fri Jul 21 10:17:21 2017
This short program will sum all of the even numbers in the fibonnacci
sequence less than 4 million.
@author: cbalusek3
"""
i1 = 1
i2 = 2
cum = 0
while i2 < 4000000:
itemp = i2
i2 += i1
i1 = itemp
if i2%2 == 0:
cum += i2
print(cum)
| Python | 0.000182 | |
5e42ed2908f6186db4da92f283ca9b9b30ac9e31 | Add executable file | bin/paxit.py | bin/paxit.py | #!/usr/bin/env python
from pax import pax
if __name__ == '__main__':
pax.Processor(input='DumbExample.DumbExampleInput',
transform='DumbExample.DumbExampleTransform',
output='DumbExample.DumbExampleOutput')
| Python | 0.000009 | |
74c2563f55c71ff8d3d2cbb7ff2b69a4be8767ec | Create client.py | client.py | client.py | #!/usr/bin/env python
# TODO take user choice for c2 method
# TODO start with pipe delimited HTTP POST data to test
# TODO loop and output to STDOUT
| Python | 0.000001 | |
6693c02315ba16c8a849c7a1892397bf819a2efd | Add meshDisplay commands | app/module/polygon/meshDisplay.py | app/module/polygon/meshDisplay.py | import maya.cmds as cmds
import maya.mel as mel
# class name must be 'Commands'
class Commands(object):
commandDict = {}
def _applyColor(self):
mel.eval("polyColorPerVertex -r 0.5 -g 0.5 -b 0.5 -a 1 -cdo;")
commandDict['applyColor'] = "polyApplyColor.png"
def _paintVertexColorT... | Python | 0.000001 | |
65df19a82df1432f72674eb35765937aa6c889eb | Add migration removing database columns following removal of FileUpload fields (#16035) | src/olympia/files/migrations/0005_auto_20201120_0926.py | src/olympia/files/migrations/0005_auto_20201120_0926.py | # Generated by Django 2.2.17 on 2020-11-20 09:26
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('files', '0004_auto_20200923_1808'),
]
operations = [
migrations.RemoveIndex(
model_name='fileupload',
name='file_uploads_af... | Python | 0 | |
48d7fc87c51cb15829e9cf161b38dc004affee9e | ADD example_sequential | example/example_sequential.py | example/example_sequential.py | import sklearn.cross_validation
import sklearn.datasets
import sklearn.metrics
import autosklearn.classification
def main():
digits = sklearn.datasets.load_digits()
X = digits.data
y = digits.target
X_train, X_test, y_train, y_test = \
sklearn.cross_validation.train_test_split(X, y, random_st... | Python | 0.000004 | |
3246873aad0482b9087663f452c2fe32c37daa36 | Add new migration | custom/icds_reports/migrations/0101_auto_20190227_1801.py | custom/icds_reports/migrations/0101_auto_20190227_1801.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-02-27 18:01
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('icds_reports', '0100_add_supervisor_id'),
]
operations = [
migrations.Alte... | Python | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.