code stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 226 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k |
|---|---|---|---|---|---|
"""List iSCSI Snapshots."""
# :license: MIT, see LICENSE for more details.
import SoftLayer
from SoftLayer.CLI import environment
from SoftLayer.CLI import formatting
from SoftLayer.CLI import helpers
from SoftLayer import utils
import click
@click.command()
@click.argument('iscsi-identifier')
@environment.pass_env... | cloudify-cosmo/softlayer-python | SoftLayer/CLI/snapshot/list.py | Python | mit | 1,122 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This code is the correct implementation about constant.
"""
from const.base import Base
class Apple(Base):
__attrs__ = ["id", "name"]
def __init__(self, id=None, name=None):
self.id = id
self.name = name
class Banana(Base):
__attrs__ =... | MacHu-GWU/constant-project | constant/test/dev/food_example.py | Python | mit | 2,617 |
# coding=utf-8
import glob
import os
class File(object):
def __init__(self, path):
self.original = path
self.abspath = os.path.abspath(path)
def __str__(self):
prefix = ''
if self.isfile:
prefix = 'file: '
elif self.isdir:
prefix = 'dir: '
... | anderscui/nails | nails/filesystem.py | Python | mit | 2,608 |
from django.template.loader import render_to_string
from tasks.const import STATUS_SUCCESS
from .base import library
@library.register('coverage')
def coverage_violation(data):
"""Coverage violation parser
:param data: task data
:type data: dict
:returns: dict
"""
data['status'] = STATUS_SUCC... | nvbn/coviolations_web | violations/coverage.py | Python | mit | 1,087 |
from .pypvwatts import PVWatts
from .pvwattserror import PVWattsValidationError
| mpaolino/pypvwatts | pypvwatts/__init__.py | Python | mit | 80 |
from __future__ import absolute_import
# Copyright (c) 2010-2015 openpyxl
import datetime
import decimal
from io import BytesIO
from openpyxl.xml.functions import tostring, xmlfile
from openpyxl.utils.indexed_list import IndexedList
from openpyxl.utils.datetime import CALENDAR_WINDOWS_1900
from openpyxl.styles im... | Darthkpo/xtt | openpyxl/writer/tests/test_dump.py | Python | mit | 8,954 |
## Need to find a library | jacksarick/My-Code | Python/python challenges/euler/017_number_letter_counts.py | Python | mit | 25 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
class Queue:
def __init__(self):
self.queue = []
def enqueue(self, item):
self.queue.append(item)
def dequeue(self, item):
return self.queue.pop(0) | goldsborough/algs4 | stacks-queues/python/queue.py | Python | mit | 205 |
#coding:utf-8
'''
第一种方式:使用os模块中的fork方式实现多进程
import os
if __name__ == '__main__':
print 'current Process (%s) start ...'%(os.getpid())
pid = os.fork()
if pid < 0:
print 'error in fork'
elif pid == 0:
print 'I am child process(%s) and my parent process is (%s)',(os.getpid(),os.getppid())
... | qiyeboy/SpiderBook | ch01/1.4.1.py | Python | mit | 3,126 |
import collections
import itertools
from marnadi.utils import cached_property, CachedDescriptor
class Header(collections.Mapping):
__slots__ = 'value', 'params'
def __init__(self, *value, **params):
assert len(value) == 1
self.value = value[0]
self.params = params
def __hash__(... | renskiy/marnadi | marnadi/http/headers.py | Python | mit | 3,678 |
# -*- coding: utf-8 -*-
from folium.plugins.marker_cluster import MarkerCluster
from folium.utilities import if_pandas_df_convert_to_numpy, validate_location
from jinja2 import Template
class FastMarkerCluster(MarkerCluster):
"""
Add marker clusters to a map using in-browser rendering.
Using FastMarkerC... | ocefpaf/folium | folium/plugins/fast_marker_cluster.py | Python | mit | 3,954 |
from django.core import validators
from django.utils.deconstruct import deconstructible
from django.utils.translation import gettext_lazy as _
@deconstructible
class UsernameValidator(validators.RegexValidator):
regex = r'^[\w.]+$'
message = _(
'Enter a valid username. This value may contain only lett... | apirobot/shmitter | backend/shmitter/users/validators.py | Python | mit | 377 |
from __future__ import print_function, absolute_import, division
import sys
sys.path.append('../')
import numpy as np
import tt
from tt.eigb import *
import time
""" This code computes many eigenvalus of the Laplacian operator """
d = 8
f = 8
A = tt.qlaplace_dd([d]*f)
#A = (-1)*A
#A = tt.eye(2,d)
n = [2] *(d * f)
r =... | oseledets/ttpy | examples/test_eigb.py | Python | mit | 544 |
# -*- coding: utf-8 -*-
from argparse import ArgumentParser
from ansible_playbook_wrapper.command.play import PlayCommand
def main():
parser = ArgumentParser()
sub_parsers = parser.add_subparsers(help='commands')
play_parser = sub_parsers.add_parser('play', help='play playbook')
for arg_info in P... | succhiello/ansible-playbook-wrapper | ansible_playbook_wrapper/__init__.py | Python | mit | 556 |
from logbook import Logger
from ..core.local import get_current_conf
from ..core.connection import autoccontext
from .. import db
from datetime import timedelta, datetime
log = Logger(__name__)
def del_inactive_queries():
conf = get_current_conf()
with autoccontext(commit=True) as conn:
before = db.... | Answeror/torabot | torabot/tasks/delete.py | Python | mit | 1,277 |
import os
import re
import codecs
import subprocess
import tempfile
import shutil
from .tylogger import logger
DEFAULT_ENCODING = 'utf16'
class Strings(object):
def __init__(self, encoding=DEFAULT_ENCODING, aliases=None):
self.encoding = encoding if encoding else DEFAULT_ENCODING
self.__reference... | luckytianyiyan/TyStrings | tystrings/strings.py | Python | mit | 6,149 |
from import_export import fields, resources
class GamesPlayedResource(resources.Resource):
game = fields.Field(attribute='game__name', column_name='game')
time = fields.Field(attribute='time', column_name='time (hours)')
num_players = fields.Field(attribute='num_players', column_name='num_players')
... | sergei-maertens/discord-bot | bot/plugins/stats/resources.py | Python | mit | 619 |
"""linter_test_project URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='hom... | David-Wobrock/django-fake-database-backends | tests/test_project/test_project/urls.py | Python | mit | 776 |
"""Main urls.py for the ``pythonsingapore.com`` project."""
from django.conf import settings
from django.conf.urls.defaults import patterns, include, url
from django.conf.urls.static import static
from django.contrib import admin
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from cms.sitemaps imp... | pythonsingapore/pythonsingapore | website/webapps/django/myproject/myproject/urls.py | Python | mit | 1,625 |
# -*- coding: utf-8 -*-
"""anagram_solver.__main__: executed when directory is called as script."""
from .anagram_solver import main
main()
| patrickleweryharris/anagram-solver | anagram_solver/__main__.py | Python | mit | 145 |
import constants as c
from gui.windows import VideoStream
import socket
import cv2
import urllib
import numpy as np
class Robot(object):
def __init__(self, connection):
self.connection = connection
""" @type : Connections.ConnectionProcessEnd.RobotConnection """
self.socket = None
... | kahvel/VEP-BCI | src/Robot.py | Python | mit | 4,342 |
#!/usr/bin/env python
#-------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#----------------------------------------------------------------... | Azure/azure-sdk-for-python | sdk/servicefabric/azure-mgmt-servicefabric/setup.py | Python | mit | 2,683 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-03-30 22:11
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('wordproject', '0001_initial'),
]
operations = [
migrations.AlterField(
... | OtagoPolytechnic/LanguageCards | admin/wordproject/migrations/0002_auto_20160331_1111.py | Python | mit | 464 |
from django.contrib import admin
# Register your models here.
from polls.models import Question,Choice
class ChoiceInline(admin.TabularInline):
model = Choice
extra = 3
class QuestionAdmin(admin.ModelAdmin):
fields = ["question_text", "pub_date"]
inlines = [ChoiceInline]
list_display = ('question_te... | Tassemble/jewelry | polls/admin.py | Python | mit | 475 |
"""
Django settings for webserver project.
Generated by 'django-admin startproject' using Django 1.11.5.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
import ... | we-inc/mms-snow-white-and-the-seven-pandas | webserver/config/settings.py | Python | mit | 4,453 |
import datetime
import queue
import multiprocessing
import pytest
from honcho.printer import Message
from honcho.manager import Manager
from honcho.manager import SYSTEM_PRINTER_NAME
HISTORIES = {
'one': {
'processes': {'foo': {}},
'messages': (('foo', 'start', {'pid': 123}),
... | nickstenning/honcho | tests/test_manager.py | Python | mit | 8,625 |
# Graphical paste and save GUI for adding members
from Tkinter import *
import os
import pdb
import datetime
lday = 04
lmonth = 10
class myDate:
def __init__(self, year, month, day):
self.date = datetime.datetime(year, month, day)
self.updateString()
def getMonthDay(self):
lday = for... | marev711/scripts | medlemsinput.py | Python | mit | 2,300 |
# coding=utf-8
import pytest
@pytest.fixture
def dns_sd():
from pymachinetalk import dns_sd
return dns_sd
@pytest.fixture
def sd():
from pymachinetalk import dns_sd
sd = dns_sd.ServiceDiscovery()
return sd
def test_registeringServicesFromServiceContainerWorks(dns_sd, sd):
service = dns_s... | strahlex/pymachinetalk | pymachinetalk/tests/test_dns_sd.py | Python | mit | 13,743 |
import typing
import twittback
TweetSequence = typing.Sequence[twittback.Tweet]
UserSequence = typing.Sequence[twittback.User]
| dmerejkowsky/twittback | twittback/types.py | Python | mit | 130 |
# -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
from scrapyproject.models import (Cinema, Showing, ShowingBooking, Movie,
db_connect, drop_tab... | gas1121/JapanCinemaStatusSpider | scrapyproject/pipelines.py | Python | mit | 6,140 |
"""Test methods for `zcode/math/math_core.py`.
Can be run with:
$ nosetests math/tests/test_math_core.py
$ nosetests math/tests/test_math_core.py:TestMathCore.test_around
$ python math/tests/test_math_core.py
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import nu... | lzkelley/zcode | zcode/math/tests/test_math_core.py | Python | mit | 31,267 |
'''
Unit tests for MergeTracker.py
Verification tracking of which comps have been merged already
works as expected and produces valid models.
'''
import numpy as np
import unittest
from bnpy.learnalg import MergeTracker
class TestMergeTracker(unittest.TestCase):
def shortDescription(self):
return None
de... | daeilkim/refinery | refinery/bnpy/bnpy-dev/tests/merge/TestMergeTracker.py | Python | mit | 4,171 |
"""
A pretty lame implementation of a memoryview object for Python 2.6.
"""
from collections import Iterable
from numbers import Integral
import string
from future.utils import istext, isbytes, PY3, with_metaclass
from future.types import no, issubset
# class BaseNewBytes(type):
# def __instancecheck__(cls, ins... | thonkify/thonkify | src/lib/future/types/newmemoryview.py | Python | mit | 654 |
# Author: Sungchul Choi, sc82.choi at gachon.ac.kr
# Version: 0.1
# Description
# 가천대학교 프로그래밍 입문 시간에 활용되는 "숙제 자동 채점 프로그램"의 Client 프로그램입니다.
#
# HUMAN KNOWLEDGE BELONGS TO THE WORLD. -- From the movie "Antitrust"
# Copyright (C) 2015 TeamLab@Gachon University
import argparse
import pickle
import os
import types
import r... | TeamLab/Gachon_CS50_OR_KMOOC | gurobi_quiz/product_mix/submit.py | Python | mit | 8,554 |
import json
import os
import time
from rottentomatoes import RT
BOX_OFFICE_COUNTRIES = [
"us",
"in",
"uk",
"nl",
]
LIMIT = 50 # max allowed by rotten tomatoes
OUTPUT_FILE = "download/more_movies.json"
def main():
assert os.environ["RT_KEY"], "Your Rotten Tomatoes API key sh... | indirectlylit/whattowatch | data-utils/_fetch_new_rt_data.py | Python | mit | 1,292 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | lmazuel/azure-sdk-for-python | azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/models/storage_profile_py3.py | Python | mit | 2,421 |
import hashlib
from typing import BinaryIO
def get_fp_sha256(fp: BinaryIO) -> str:
"""
Get the SHA-256 checksum of the data in the file `fp`.
:return: hex string
"""
fp.seek(0)
hasher = hashlib.sha256()
while True:
chunk = fp.read(524288)
if not chunk:
break
... | valohai/valohai-cli | valohai_cli/utils/hashing.py | Python | mit | 377 |
from setuptools import setup
setup(name='decision_tree',
version='0.04',
description='Practice implementation of a classification decision tree',
classifiers=[
'Development Status :: 2 - Pre-Alpha',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 2.7',
... | metjush/decision_tree | setup.py | Python | mit | 734 |
import os
from redlib.api.system import sys_command, CronDBus, CronDBusError, is_linux, is_windows
from ..util.logger import log
from . import Desktop, DesktopError
from . import gnome_desktop
from . import feh_desktop
if is_windows():
from .windows_desktop import WindowsDesktop
def load_optional_module(module, pa... | amol9/wallp | wallp/desktop/desktop_factory.py | Python | mit | 1,362 |
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
setup(
name='lkd',
version='2',
packages=['lkd', 'tests'],
author='Karan Goel',
author_email='karan@goel.im',
maintainer='Karan Goel',
maintainer_email='karan@goel.im',
url='http://www.goel.im... | karan/py-lkd.to | setup.py | Python | mit | 1,225 |
#!/usr/bin/env python3
"""
http://adventofcode.com/day/17
Part 1
------
The elves bought too much eggnog again - 150 liters this time. To
fit it all into your refrigerator, you'll need to move it into
smaller containers. You take an inventory of the capacities of
the available containers.
For example, suppose you hav... | rnelson/adventofcode | advent2015/day17.py | Python | mit | 2,152 |
from __future__ import absolute_import, division, print_function, unicode_literals
import numpy as np
class Unicorn(object):
def __init__(self):
import unicornhathd as unicorn
unicorn.rotation(180)
unicorn.brightness(0.75)
def write_pixels(self, data):
import unicornhath... | Spooner/pixel-table | pixel_table/external/unicorn.py | Python | mit | 513 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from unittest import TestCase, main
from pitchpx.mlbam_util import MlbamUtil, MlbAmHttpNotFound
__author__ = 'Shinichi Nakagawa'
class TestMlbamUtil(TestCase):
"""
MLBAM Util Class Test
"""
def setUp(self):
pass
def tearDown(self):
p... | Shinichi-Nakagawa/pitchpx | tests/pitchpx/test_mlbam_util.py | Python | mit | 3,194 |
# -*- coding: utf-8 -*-
from django.conf.urls.defaults import patterns, url
from . import tasks
from . import views
urlpatterns = patterns('',
url(r'^$', views.index, name='layoutdemo_index'),
)
# Local Variables:
# indent-tabs-mode: nil
# End:
# vim: ai et sw=4 ts=4
| rentalita/django-layoutdemo | src/python/layoutdemo/default/urls.py | Python | mit | 276 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2011-2015 Slack
#
# 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
... | Slack06/yadg | descgen/tests.py | Python | mit | 429,432 |
# -*- coding: utf-8 -*-
#
# -----------------------------------------------------------------------------------
# Copyright (c) Microsoft Open Technologies (Shanghai) Co. Ltd. All rights reserved.
#
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this softw... | xunxunzgq/open-hackathon-bak_01 | open-hackathon-server/src/hackathon/docker/hosted_docker.py | Python | mit | 24,562 |
# Human friendly input/output in Python.
#
# Author: Peter Odding <peter@peterodding.com>
# Last Change: March 2, 2020
# URL: https://humanfriendly.readthedocs.io
"""
Support for deprecation warnings when importing names from old locations.
When software evolves, things tend to move around. This is usually detrimenta... | xolox/python-humanfriendly | humanfriendly/deprecation.py | Python | mit | 9,499 |
import sys
sys.path.append("..")
from data_mining.association_rule.base import rules, lift, support
from data_mining.association_rule.apriori import apriori
from data_mining.association_rule.liftmin import apriorilift
from pat_data_association_rules import compare
LE = "leite"
PA = "pao"
SU = "suco"
OV = "ovos"
CA =... | JoaoFelipe/data-mining-algorithms | examples/custom_association_rules.py | Python | mit | 560 |
from django.conf import settings
BACKEND_CLASS = getattr(
settings, "COURRIERS_BACKEND_CLASS", "courriers.backends.simple.SimpleBackend"
)
MAILCHIMP_API_KEY = getattr(settings, "COURRIERS_MAILCHIMP_API_KEY", "")
MAILJET_API_KEY = getattr(settings, "COURRIERS_MAILJET_API_KEY", "")
MAILJET_CONTACTSLIST_LIMIT = g... | ulule/django-courriers | courriers/settings.py | Python | mit | 1,595 |
import numpy as np
import logic
from unittest import TestCase
import graphs
import sympy
from collections import namedtuple
import random
from attractors import find_num_attractors_onestage, \
vertex_model_impact_scores, stochastic_vertex_model_impact_scores, find_num_steady_states, \
find_attractors_dubrova, f... | arielbro/attractor_learning | testing/test_attractors.py | Python | mit | 179,258 |
import sys
import os
import warnings
import ruamel.yaml as yaml
from fnmatch import fnmatch
__author__ = "Pymatgen Development Team"
__email__ ="pymatgen@googlegroups.com"
__maintainer__ = "Shyue Ping Ong"
__maintainer_email__ ="shyuep@gmail.com"
__version__ = "2019.7.2"
SETTINGS_FILE = os.path.join(os.path.expandu... | blondegeek/pymatgen | pymatgen/__init__.py | Python | mit | 3,203 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import math
import re
from hub.formats import Format, Formatter
from hub.structures.file import File
from hub.structures.frame import OdhType
class InterlisModelFormat(Format):
name = 'INTERLIS1Model'
label = 'INTERLIS 1 Modell'
description... | hsr-ba-fs15-dat/opendatahub | src/main/python/hub/formats/interlis_model.py | Python | mit | 6,028 |
import json
import os
import glob
import sys
import logging
from watson_developer_cloud import WatsonException
if '__file__' in globals():
sys.path.insert(0, os.path.join(os.path.abspath(__file__), 'scripts'))
else:
sys.path.insert(0, os.path.join(os.path.abspath(os.getcwd()), 'scripts'))
from discovery_setup... | watson-developer-cloud/discovery-starter-kit | notebooks/scripts/upload_training_data.py | Python | mit | 3,238 |
row_key = "Rows"
column_key = "Cols"
special_keywords = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov',
'dec', 'january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september',
'october', 'november', 'december', 'q1', 'q2', '... | usc-isi-i2/etk | etk/timeseries/annotation/utility.py | Python | mit | 566 |
import sys
from PyQt4 import QtGui
from PyQt4 import QtCore
from PyQt4.QtGui import *
import os
class Window(QtGui.QMainWindow):
def __init__(self):
super(Window, self).__init__()
self.filename = None
self.initUI()
def initUI(self):
self.italic_flag = False
... | PyKudos/KudoEdit | KudoEdit/KudoEdit.py | Python | mit | 12,273 |
from unittest import TestCase
from PyProjManCore.task import Task
class TestTaskOperationsExceptions(TestCase):
"""Test Exceptions for Task operations"""
def test_append_duplicate_prereq(self):
"""Test appending duplicate prerequisites to a task, it should be unique"""
root = Task("Root Task"... | aawadall/PyProjMan | UnitTesting/test_task_exceptions.py | Python | mit | 1,048 |
"""
https://leetcode.com/explore/interview/card/top-interview-questions-hard/116/array-and-strings/827/
"""
from unittest import TestCase
from kevin.leet.product_except_self import Solution, SolutionOptimized
class TestProductExceptSelf(TestCase):
def _base_test_product_except_self(self, nums, expected):
... | kalyons11/kevin | kevin/tests/leet/test_product_except_self.py | Python | mit | 678 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10a1 on 2016-06-21 09:08
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('discussions', '0004_post_a... | Udayraj123/dashboard_IITG | Binder/discussions/migrations/0005_auto_20160621_1438.py | Python | mit | 572 |
##################################################################
# Copyright 2018 Open Source Geospatial Foundation and others #
# licensed under MIT, Please consult LICENSE.txt for details #
##################################################################
from pywps import Process
from pywps.inout import L... | bird-house/PyWPS | tests/processes/__init__.py | Python | mit | 2,519 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "CMS.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| IEEEDTU/CMS | manage.py | Python | mit | 246 |
from RGT.XML.SVG.basicSvgNode import BasicSvgNode
from RGT.XML.SVG.Attribs.conditionalProcessingAttributes import ConditionalProcessingAttributes
from RGT.XML.SVG.Attribs.xlinkAttributes import XlinkAttributes
from RGT.XML.SVG.Attribs.animationTimingAttributes import AnimationTimingAttributes
class BaseAnimatio... | danrg/RGT-tool | src/RGT/XML/SVG/Animation/baseAnimationNode.py | Python | mit | 1,499 |
from __future__ import unicode_literals
from django.apps import AppConfig
from django.db.models import signals
from django.contrib.auth import get_user_model
def populate_users(sender, **kwargs):
User = get_user_model()
for i in range(10):
username = "user_{}".format(i+1)
email = "{}@example.c... | nav/presence | presence/apps/presence/apps.py | Python | mit | 836 |
import json
import numpy as np
import pytest
import requests
from mipframework.testutils import get_test_params
from tests import vm_url
from tests.algorithm_tests.test_logistic_regression import expected_file
headers = {"Content-type": "application/json", "Accept": "text/plain"}
url = vm_url + "LOGISTIC_REGRESSION"
... | madgik/exareme | Exareme-Docker/src/mip-algorithms/tests/integration_tests/test_exareme_integration_logistic_regression.py | Python | mit | 894 |
# To install another language:
# - update default_bridges below
# - update languages.cson in seamless/compiler
from ...highlevel.Environment import ContextEnvironment, Environment
from . import r
_default_bridges = {
"r": {
"code": r.bridge_r,
"params": r.default_bridge_parameters,
"envir... | sjdv1982/seamless | seamless/metalevel/python_bridges/__init__.py | Python | mit | 1,180 |
r"""
Utilities and helper classes/functions
======================================
This module contains two very important classes (Project and Workspace)
as well as a number of helper classes.
"""
import logging as logging
from .misc import *
from ._settings import *
from ._workspace import *
from ._project import ... | PMEAL/OpenPNM | openpnm/utils/__init__.py | Python | mit | 983 |
import logging
from pajbot.apiwrappers.response_cache import ListSerializer
from pajbot.apiwrappers.twitch.base import BaseTwitchAPI
from pajbot.models.emote import Emote
log = logging.getLogger(__name__)
class TwitchKrakenV5API(BaseTwitchAPI):
authorization_header_prefix = "OAuth"
def __init__(self, clien... | pajlada/tyggbot | pajbot/apiwrappers/twitch/kraken_v5.py | Python | mit | 2,893 |
import os
from .input import VaspInput
__author__ = "Guillermo Avendano-Franco"
__copyright__ = "Copyright 2016"
__version__ = "0.1"
__maintainer__ = "Guillermo Avendano-Franco"
__email__ = "gtux.gaf@gmail.com"
__status__ = "Development"
__date__ = "May 13, 2016"
def read_incar(filename='INCAR'):
"""
Load t... | MaterialsDiscovery/PyChemia | pychemia/code/vasp/incar.py | Python | mit | 1,272 |
import _plotly_utils.basevalidators
class OpacitysrcValidator(_plotly_utils.basevalidators.SrcValidator):
def __init__(
self, plotly_name="opacitysrc", parent_name="scattercarpet.marker", **kwargs
):
super(OpacitysrcValidator, self).__init__(
plotly_name=plotly_name,
pa... | plotly/python-api | packages/python/plotly/plotly/validators/scattercarpet/marker/_opacitysrc.py | Python | mit | 474 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('umibukela', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='SurveyType',
fields=[
... | Code4SA/umibukela | umibukela/migrations/0002_auto_20160120_1337.py | Python | mit | 1,080 |
import os
from invoke import task
@task
def test():
os.system('coverage run --source tryagain -m py.test')
os.system('coverage report')
@task
def register(production=False):
target = 'pypi' if production else 'pypitest'
os.system('python3 setup.py register -r %s' % target)
@task
def upload(product... | tfeldmann/tryagain | tasks.py | Python | mit | 450 |
# -*- coding:utf-8 -*-
import os
site_title = 'plum.J'
site_description = '\'s blog'
site_url = 'http://plumj.com'
static_url = 'static'
theme_name = 'sealscript'
google_analytics = ''
catsup_path = os.path.dirname(__file__)
posts_path = os.path.join(catsup_path, '_posts')
theme_path = os.path.join(catsup_path, 'the... | plumJ/catsup | config.py | Python | mit | 1,211 |
from kaneda.backends import LoggerBackend, ElasticsearchBackend
from kaneda.queues import CeleryQueue
from django_kaneda import settings # NOQA
class TestDjango(object):
def test_django_kaneda_with_backend(self, mocker, django_settings_backend):
mocker.patch('django_kaneda.settings', django_settings_bac... | APSL/kaneda | tests/integration/django/test_django.py | Python | mit | 1,213 |
# coding: utf-8
"""
/properties/
/properties/:id/
/properties/groups/
/properties/groups/:id/
/properties/groups/:name/
"""
from django.test import TestCase
from django.core.urlresolvers import reverse
from rest_framework import status
from rest_framework.test import APITestCase
from ..models import Property, PropertyG... | baffolobill/mb_test_1 | src/mbtest1/erp_test/tests/test_properties.py | Python | mit | 3,376 |
# -*- coding: utf-8 -*-
""" Forms for the votes application. """
# standard library
# django
from django import forms
# models
from .models import Vote
# views
from base.forms import BaseModelForm
class VoteForm(BaseModelForm):
"""
Form Vote model.
"""
score = forms.IntegerField(required=True)
... | Angoreher/xcero | votes/forms.py | Python | mit | 488 |
'''
Usage:
manager puzzle_load (--file <filename>) [--url <url>]
manager puzzle_del (--name <name>) [--url <url>]
manager puzzles [--url <url>]
manager puzzleboards_clear [--url <url>]
manager puzzleboard_consume [--async-url <url>] (--name <name>) [--size <size>]
manager puzzleboard_pop (--name... | klmcwhirter/huntwords | manager/__main__.py | Python | mit | 1,563 |
__author__ = 'Jason Mehring'
#
# This module is only used with WingIDE debugger for testing code within
# The debugging environment
#
# Stage 1: bind /srv/...modules to cache/extmods. No sync will take place
# since files are bound
# BIND
# True : bind custom modules
# False : do not bind custom module... | DockerNAS/yamlscript-formula | src/salt-call.py | Python | mit | 7,810 |
import json, codecs, re
from abc import ABCMeta, abstractmethod
from PIL import Image, ExifTags
from witica.util import throw, sstr, suni
#regular expressions regarding item ids
RE_METAFILE = r'^meta\/[^\n]+$'
RE_FIRST_ITEMID = r'(?!meta\/)[^\n?@.]+'
RE_ITEMFILE_EXTENSION = r'[^\n?@\/]+'
RE_ITEMID = r'^' + RE_FIRST_... | bitsteller/witica | witica/metadata/extractor.py | Python | mit | 7,072 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import pytest
from tinyrpc.protocols.jsonrpc import JSONRPCProtocol
from tinyrpc import RPCErrorResponse
@pytest.fixture(params=['jsonrpc'])
def protocol(request):
if 'jsonrpc':
return JSONRPCProtocol()
raise RuntimeError('Bad protocol name in test case... | mbr/tinyrpc | tests/test_protocols.py | Python | mit | 1,721 |
'''
Nonlinear optimization by use of Affine DualAveraging
@author: Maximilian Balandat
@date: May 13, 2015
'''
import numpy as np
from .Domains import nBox
class NLoptProblem():
""" Basic class describing a Nonlinear Optimization problem. """
def __init__(self, domain, objective):
""" Construct... | Balandat/cont_no_regret | old_code/NLopt.py | Python | mit | 1,667 |
from celery.task import Task
from ..notifications.contextmanagers import BatchNotifications
class AsyncBadgeAward(Task):
ignore_result = True
def run(self, badge, state, **kwargs):
# from celery.contrib import rdb; rdb.set_trace()
with BatchNotifications():
badge.actually_possibl... | fgmacedo/django-awards | awards/tasks.py | Python | mit | 337 |
class Solution(object):
def intersect(self, nums1, nums2):
"""
:type nums1: List[int]
:type nums2: List[int]
:rtype: List[int]
"""
from collections import Counter
nums2 = Counter(nums2)
nums1 = Counter(nums1)
ret = []
for i in nums1:
... | xingjian-f/Leetcode-solution | 357. Count Numbers with Unique Digits.py | Python | mit | 482 |
# This code is licensed under the MIT License (see LICENSE file for details)
from PyQt5 import Qt
class ViewportRectItem(Qt.QGraphicsObject):
size_changed = Qt.pyqtSignal(Qt.QSizeF)
def __init__(self):
super().__init__()
self.setFlags(
Qt.QGraphicsItem.ItemIgnoresTransformations |... | zpincus/RisWidget | ris_widget/qgraphicsitems/viewport_rect_item.py | Python | mit | 1,046 |
'''
usage: scrapy runspider recursive_link_results.py (or from root folder: scrapy crawl scrapy_spyder_recursive)
'''
#from scrapy.spider import Spider
from scrapy.selector import Selector
from scrapy.contrib.spiders import CrawlSpider, Rule
from scrapy.linkextractors import LinkExtractor
from scrapy.http import Reque... | xianjunzhengbackup/code | data science/machine_learning_for_the_web/chapter_8/movie_reviews_analizer_app/scrapy_spider/spiders/recursive_link_results.py | Python | mit | 2,856 |
# This example is designed to be paired with example file 31-bridge-out.py
# Run the two with DIFFERENT DEVICE TOKENS.
# (They can be either in same "project" or separate projects as set at phone. Just use different tokens.)
# This "in" bridge receives data directly from other RPi.
# Our display shows incoming messag... | BLavery/PiBlynk | PiBlynk-py/32-bridge-in.py | Python | mit | 1,523 |
#class SVNRepo:
# @classmethod
# def isBadVersion(cls, id)
# # Run unit tests to check whether verison `id` is a bad version
# # return true if unit tests passed else false.
# You can use SVNRepo.isBadVersion(10) to check whether version 10 is a
# bad version.
class Solution:
"""
@param n:... | Rhadow/leetcode | lintcode/Medium/074_First_Bad_Version.py | Python | mit | 742 |
import socket
import time
import random
import threading
import re
import json
import sys
import os
import platform
import notify2
from urllib import request
g_rid= b'265352'
g_username= b'visitor42'
g_ip= b'danmu.douyutv.com'
g_port= 8601
g_gid= b'0'
g_exit= False
sysinfo = platform.system()
def notify(title, messag... | zephyrzoom/douyu | test/comment-douyu.py | Python | mit | 8,896 |
# -*- coding: utf-8 -*-
import aaargh
from app import Negi
app = aaargh.App(description="Jinja2+JSON powered static HTML build tool")
@app.cmd(help='Parse JSON and build HTML')
@app.cmd_arg('-d','--data_dir',default='./data',help='JSON data dirctory(default:./data')
@app.cmd_arg('-t','--tmpl_dir',default='./template... | zk33/negi | negi/main.py | Python | mit | 798 |
from django.conf import settings
from . import defaults
__title__ = 'fobi.contrib.plugins.form_elements.fields.' \
'select_multiple_with_max.conf'
__author__ = 'Artur Barseghyan <artur.barseghyan@gmail.com>'
__copyright__ = '2014-2017 Artur Barseghyan'
__license__ = 'GPL 2.0/LGPL 2.1'
__all__ = ('get_sett... | mansonul/events | events/contrib/plugins/form_elements/fields/select_multiple_with_max/conf.py | Python | mit | 1,127 |
import logging
from queue import Queue
from gi.repository import GObject
from lib.commands import ControlServerCommands
from lib.tcpmulticonnection import TCPMultiConnection
from lib.response import NotifyResponse
class ControlServer(TCPMultiConnection):
def __init__(self, pipeline):
'''Initialize serve... | h01ger/voctomix | voctocore/lib/controlserver.py | Python | mit | 5,365 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.Create... | genonfire/portality | accounts/migrations/0001_initial.py | Python | mit | 730 |
from gameinfo import *
from porkglobals import *
def genGameMap():
"""This is an "abstract function" to hold this docstring and information.
A GameMap function defines Places and connects all the Places it defines in
a graph, but simpler graph than CommandGraph. It simply uses Place.nextnodes.
A... | phorust/pork | game/game.py | Python | mit | 2,596 |
"""tidy_up_latent
Tidy up a latent migration not previously picked up by alembic or ignored.
Revision ID: 1280
Revises: 1270
Create Date: 2019-06-10 15:51:48.661665
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '1280'
down_revision = '1270'
def upgrade():... | alphagov/digitalmarketplace-api | migrations/versions/1280_tidy_up_latent.py | Python | mit | 633 |
import base64
from dataclasses import dataclass
from typing import Any, List, Tuple, Union
import flask
import sqlalchemy as sa
from marshmallow import ValidationError, fields
from flask_resty.sorting import FieldOrderings, FieldSortingBase
from flask_resty.view import ModelView
from . import meta
from .exceptions i... | taion/flask-jsonapiview | flask_resty/pagination.py | Python | mit | 23,769 |
# sequences.py
# strings
>>> # 4 ways to make a string
>>> str1 = 'This is a string. We built it with single quotes.'
>>> str2 = "This is also a string, but built with double quotes."
>>> str3 = '''This is built using triple quotes,
... so it can span multiple lines.'''
>>> str4 = """This too
... is a multiline one
.... | mkhuthir/learnPython | Book_learning-python-r1.1/ch2/sequences.py | Python | mit | 1,614 |
__all__ = ["user_controller", "plant_controller"] | CHrycyna/LandscapeTracker | app/controllers/__init__.py | Python | mit | 49 |
# 统计一下提交代码量
import os
import subprocess
import pandas as pd
os.chdir('../')
# %%
start_dt = '2019-05-01'
end_dt = '2019-06-20'
commits = subprocess.check_output(
"git log --after={start_dt} --before={end_dt} --format='%s%cr'".
format(start_dt=start_dt, end_dt=end_dt),
shell=True)
commits = commits.d... | guofei9987/guofei9987.github.io | reading/tools/commit_stats.py | Python | mit | 825 |
import collections
class Solution:
def arrangeWords(self, text: str) -> str:
words = text.split()
table = collections.defaultdict(list)
for word in words:
table[len(word)].append(word)
result = []
for key in sorted(table):
result.extend(table[key])
... | jiadaizhao/LeetCode | 1401-1500/1451-Rearrange Words in a Sentence/1451-Rearrange Words in a Sentence.py | Python | mit | 513 |
# =============================================================================
# COPYRIGHT 2013 Brain Corporation.
# License under MIT license (see LICENSE file)
# =============================================================================
import doctest
import logging
import os
import pytest
import robustus
from r... | braincorp/robustus | robustus/tests/test_robustus.py | Python | mit | 8,887 |
#!/usr/bin/python
from __future__ import print_function
import RPi.GPIO as GPIO
import time
import Queue # https://pymotw.com/2/Queue/
#GPIO pins
Taster1 = 24
Taster2 = 27
# GPIO-Nummer als Pinreferenz waehlen
GPIO.setmode(GPIO.BCM)
# GPIO vom SoC als Input deklarieren und Pull-Down Widerstand aktivieren
#PULL = G... | meigrafd/Sample-Code | interrupt_pause_script.py | Python | mit | 1,638 |
#!/usr/bin/env python3
import numpy as np
import matplotlib.pyplot as plt
import re
rootPath = "/Users/jeff/work/debug/20181216_hard_fe2k_15fps/"
finalLogFile = "rosout.log.2"
def appendTimestamps(arr, start, stop, flag):
#flag = True
d = stop - start
if flag or (d > -10 and d < 2000):
arr.append... | yejingfu/samples | tensorflow/pyplot03.py | Python | mit | 3,650 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.