code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
# Copyright 2016 Pinterest, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... | pinterest/teletraan | deploy-board/deploy_board/webapp/webhook_views.py | Python | apache-2.0 | 3,330 |
#!/usr/bin/env python
import sys, os, os.path, signal
import jsshellhelper
from optparse import OptionParser
from subprocess import Popen, PIPE, STDOUT
# Uses jsshell https://developer.mozilla.org/en/Introduction_to_the_JavaScript_shell
class Packer(object):
toolsdir = os.path.dirname(os.path.abspath(__file__))
... | edsfault/Edsfault-processing.js | tools/packer.py | Python | mit | 1,163 |
"""Test KNX number."""
from unittest.mock import patch
import pytest
from homeassistant.components.knx.const import CONF_RESPOND_TO_READ, KNX_ADDRESS
from homeassistant.components.knx.schema import NumberSchema
from homeassistant.const import CONF_NAME, CONF_TYPE
from homeassistant.core import HomeAssistant, State
f... | jawilson/home-assistant | tests/components/knx/test_number.py | Python | apache-2.0 | 3,253 |
# -*- coding: utf-8 -*-
# Aualé oware graphic user interface.
# Copyright (C) 2014-2020 Joan Sala Soler <contact@joansala.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3... | joansalasoler/auale | src/auale/gui/actors/mosaic.py | Python | gpl-3.0 | 2,185 |
"""
Use DeepFool to craft adversarials on MNIST.
"""
import os
import numpy as np
import matplotlib
matplotlib.use('Agg') # noqa: E402
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
import tensorflow as tf
from attacks import deepfool
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
im... | gongzhitaao/tensorflow-adversarial | example/deepfool_noise.py | Python | mit | 8,528 |
# Copyright 2021 DeepMind Technologies Limited
#
# 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 agr... | deepmind/alphafold | alphafold/data/tools/hhsearch.py | Python | apache-2.0 | 3,601 |
import io
from django.contrib import messages
from django.http import HttpResponseRedirect
from django.urls import reverse
from django.utils.translation import ugettext as _
from couchexport.export import export_raw
from couchexport.models import Format
from couchexport.shortcuts import export_response
from dimagi.ut... | dimagi/commcare-hq | corehq/apps/translations/views.py | Python | bsd-3-clause | 6,118 |
import logging
import os,string,sys
from AZutilities import dataUtilities
import random
import bbrc
import orange
from cinfony import rdk
logging.basicConfig()
log = logging.getLogger(__name__)
log.setLevel(logging.INFO)
class BBRC(object):
def __init__(self, verbose = 0):
self.iniDir = os.getcwd()
... | JonnaStalring/AZOrange | azorange/AZutilities/getBBRCDesc.py | Python | lgpl-3.0 | 12,011 |
"""add Account negate_ofx_amounts field
Revision ID: a8f1228af250
Revises: 7477ff15e8c4
Create Date: 2017-04-19 22:20:31.876889
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'a8f1228af250'
down_revision = '7477ff15e8c4'
branch_labels = None
depends_on = None
... | jantman/biweeklybudget | biweeklybudget/alembic/versions/a8f1228af250_add_account_negate_ofx_amounts_field.py | Python | agpl-3.0 | 501 |
from django.conf.urls import url
from blog.views import *
urlpatterns = [
url(r'^$', ArticleListView.as_view(), name='blog_list'),
url(r'^tags/$', TagListView.as_view(), name='blog_tag_list'),
url(r'^tag/(?P<tag>.*)$', TaggedArticleListView.as_view(), name='blog_tagged_list'),
url(r'^(?P<key>.*)$', A... | hamtamtots/website | matt_site/blog/urls.py | Python | mit | 367 |
# This is sample models
# Note Meta() class inside model - it is define form fields for CRUD
# and templates for list/new/edit/delete operations.
# Default templates located inside /templates/admin/
# To subclass template: create a folder inside /templates/admin/
# with model name lowercase.
from google.appengi... | vsergeyev/ndbadmin | models.py | Python | mit | 2,262 |
from .html2kirby import HTML2Kirby
__all__ = [
'HTML2Kirby'
]
| liip/html2kirby | html2kirby/__init__.py | Python | mit | 67 |
"""Tests for Climacell weather entity."""
from __future__ import annotations
from datetime import datetime
import logging
from typing import Any
from unittest.mock import patch
import pytest
from homeassistant.components.climacell.config_flow import (
_get_config_schema,
_get_unique_id,
)
from homeassistant.... | kennedyshead/home-assistant | tests/components/climacell/test_weather.py | Python | apache-2.0 | 15,479 |
#!/usr/bin/env python2
'''
Usages:
./plot.py type output.img src.input1 src.input2...
'''
import sys
import os, os.path
import re
import pprint
import traceback
import random
import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
class Fail(Exception):
def __init__(self, msg, ... | wenshao/oceanbase | tools/deploy/plot.py | Python | gpl-2.0 | 3,269 |
import random
def noReplacementSimulation(numTrials):
'''
Runs numTrials trials of a Monte Carlo simulation
of drawing 3 balls out of a bucket containing
3 red and 3 green balls. Balls are not replaced once
drawn. Returns the a decimal - the fraction of times 3
balls of the same color were dra... | johntauber/MITx6.00.2x | Unit3/Lecture8Exercise4.py | Python | mit | 665 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.12 on 2017-02-06 16:30
from __future__ import unicode_literals
from django.db import migrations
def refactor_schedule_times(apps, schema_editor):
"""Change the JSON data in OfficeHours.schedule so that it goes from this:
{'DAY': [[from, to], [from, to], .... | tndatacommons/tndata_backend | tndata_backend/officehours/migrations/0004_revise_schedule_format.py | Python | mit | 1,178 |
import time
import subprocess
from nxtools import logging, decode_if_py3
class BaseProcessor():
default_args = []
class Sox(BaseProcessor):
def __init__(self, *args, **kwargs):
self.kwargs = kwargs
self.args = ["sox", "-S"]
for arg in args:
self.args.append(str(arg))
... | martastain/themis | themis/sox.py | Python | gpl-3.0 | 1,631 |
"""Tests for lexical_illusions.misc check."""
from proselint.checks.lexical_illusions import misc as chk
from .check import Check
class TestCheck(Check):
"""The test class for lexical_illusions.misc."""
__test__ = True
@property
def this_check(self):
"""Boilerplate."""
return chk
... | amperser/proselint | tests/test_lexical_illusions.py | Python | bsd-3-clause | 968 |
from __future__ import unicode_literals
from django.conf import settings
from django.contrib.sites.models import Site, RequestSite, get_current_site
from django.core.exceptions import ObjectDoesNotExist, ValidationError
from django.http import HttpRequest
from django.test import TestCase
from django.test.utils import ... | edisonlz/fruit | web_project/base/site-packages/django/contrib/sites/tests.py | Python | apache-2.0 | 3,406 |
import datetime
import pyPdf
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User
from djcelery.models import TaskMeta
from scanning.models import Scan
from scanning import tasks
def new_scan(filename=None, uploaded_file=None, uploader_id=None, scan_id=None):
"""
Given an ... | yourcelf/btb | scanblog/scanning/utils.py | Python | agpl-3.0 | 1,754 |
from discord.ext import commands
import config
def is_owner():
def predicate(author_id):
try:
return author_id in config.owner_ids
except NameError:
return False
return commands.check(lambda ctx: predicate(ctx.message.author.id))
| andrewlin16/duckbot | app/checks.py | Python | mit | 282 |
"""@file mfcc.py
contains the fbank feature computer"""
import numpy as np
import base
import feature_computer
from sigproc import snip
class Mfcc(feature_computer.FeatureComputer):
"""the feature computer class to compute MFCC features"""
def comp_feat(self, sig, rate):
"""
compute the feat... | JeroenZegers/Nabu-MSSS | nabu/processing/feature_computers/mfcc.py | Python | mit | 1,611 |
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use ... | ClusterHQ/libcloud | libcloud/test/test_httplib_ssl.py | Python | apache-2.0 | 11,091 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2011 S2S Network Consultoria e Tecnologia da Informacao LTDA
#
# Authors: Zhongjie Wang <wzj401@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by... | umitproject/openmonitor-desktop-agent | umit/icm/agent/logger.py | Python | gpl-2.0 | 1,434 |
"""
Tests for parse_nci60_targets.py.
"""
import cPickle
import glob
import gzip
import os
import shutil
import tempfile
import unittest
from vs_utils.scripts.datasets.parse_nci60_targets import main, parse_args
class TestParseNci60Targets(unittest.TestCase):
"""
Tests for parse_pcba_targets.py.
"""
... | rbharath/vs-utils | vs_utils/scripts/datasets/tests/test_parse_nci60_targets.py | Python | gpl-3.0 | 1,659 |
# drizzle/base.py
# Copyright (C) 2005-2013 the SQLAlchemy authors and contributors <see AUTHORS file>
# Copyright (C) 2010-2011 Monty Taylor <mordred@inaugust.com>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""
.. dialect:: drizz... | Drvanon/Game | venv/lib/python3.3/site-packages/sqlalchemy/dialects/drizzle/base.py | Python | apache-2.0 | 15,008 |
# -*- coding: utf-8 -*-
from __future__ import print_function
import threading
import time
import re
import sys
import six
import logging
logger = logging.getLogger('TeleBot')
formatter = logging.Formatter(
'%(asctime)s (%(filename)s:%(lineno)d %(threadName)s) %(levelname)s - %(name)s: "%(message)s"'
)
console_... | tr00m1k/zagruzki | telebot/__init__.py | Python | gpl-2.0 | 47,548 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import argparse
import logging
import os
import sys
import traceback
from betternotifications.config import BNConfigParser
from jinja2 import Template
def get_config():
cfg = BNConfigParser()
cfg.read(['backends.cfg', '/etc/better-notifications/backends.cfg'])
retur... | ercpe/better-notifications | src/betternotifications/better-notify.py | Python | gpl-2.0 | 4,710 |
# Copyright 2021 Google LLC
#
# 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, ... | GoogleCloudPlatform/public-datasets-pipelines | datasets/covid19_tracking/pipelines/city_level_cases_and_deaths/custom/csv_transform.py | Python | apache-2.0 | 2,331 |
#-*- coding:utf-8 -*-
import os
import subprocess
import linecache
import sys
import json
import cPickle as pickle
import smtplib
import numpy as np
import matplotlib.pyplot as plt
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from email.mime.base import MIMEBase
from email import ... | luismack1997/PrograMate201603126 | Practica/Codigo.py | Python | gpl-3.0 | 30,257 |
from rx import Observable, AnonymousObservable
from rx.concurrency import timeout_scheduler
from rx.internal import extensionmethod
@extensionmethod(Observable)
def skip_last_with_time(self, duration, scheduler):
"""Skips elements for the specified duration from the end of the
observable source sequence, usin... | dbrattli/RxPY | rx/linq/observable/skiplastwithtime.py | Python | apache-2.0 | 1,934 |
# Copyright 2013 OpenStack Foundation
# 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 requ... | neoareslinux/neutron | neutron/tests/tempest/services/identity/v3/json/identity_client.py | Python | apache-2.0 | 21,732 |
import tempfile
import types
import caffe
import udl.caffei.models.caffe_pb2 as pb2
from udl.caffei.models.layers.layer import set
from udl.caffei.models.utils import get4D
import numpy as np
__author__ = 'haitham'
# def set_train_data(self, X, Y):
# # TODO find better way to assign data, support batches
# ... | marakeby/udl | udl/caffei/trainers/SGDTrainer.py | Python | bsd-2-clause | 3,627 |
# ninfo-plugin-ieeedb repo
from ninfo import PluginBase
from ninfo import util
class ieeedb_plug(PluginBase):
"""This plugin looks up OUI in a SQL database"""
name = 'ieeedb'
title = 'Ieeedb'
description = 'Retrieve information from SQL database'
cache_timeout = 60*60
types = ['mac']
... | kraigu/ninfo-plugin-ieeedb | ninfo-plugin-ieeedb/__init__.py | Python | bsd-3-clause | 1,084 |
# Copyright 2014 Google Inc. All Rights Reserved.
"""Command for starting an instance."""
from googlecloudsdk.compute.lib import base_classes
from googlecloudsdk.compute.lib import utils
class Start(base_classes.NoOutputAsyncMutator):
"""Start a stopped virtual machine instance.
*{command}* is used to start a st... | wemanuel/smry | smry/server-auth/ls/google-cloud-sdk/lib/googlecloudsdk/compute/subcommands/instances/start.py | Python | apache-2.0 | 1,484 |
# -*- coding: utf-8 -*-
#
# 'choices' tuples for forms and models
#
# Supported languages
LANGUAGES = (('en','English'),
('fr','French'),
('de','German'),
('es','Spanish'))
# CSS layout specifications
LAYOUT = (('rtl','Right-to-left'),
('ltr','Left-to-right'))
# UI c... | stanfordnlp/phrasal | ptm/tm/tmapp/choices.py | Python | gpl-3.0 | 9,237 |
"""
Ansible action plugin to execute health checks in OpenShift clusters.
"""
# pylint: disable=wrong-import-position,missing-docstring,invalid-name
import sys
import os
from collections import defaultdict
try:
from __main__ import display
except ImportError:
from ansible.utils.display import Display
displ... | rhdedgar/openshift-tools | openshift/installer/vendored/openshift-ansible-3.6.173.0.27/roles/openshift_health_checker/action_plugins/openshift_health_check.py | Python | apache-2.0 | 5,424 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from os.path import join, split
from pipes import quote
from bundlewrap.exceptions import BundleError
from bundlewrap.items import Item
from bundlewrap.utils.text import mark_for_translation as _
def pkg_install(node, pkgname, version=None):
if ver... | timbuchwaldt/bundlewrap | bundlewrap/items/pkg_pip.py | Python | gpl-3.0 | 3,573 |
import re
import sys
import biocode.things
import biocode.annotation
import biocode.utils
from urllib.parse import unquote, quote
def build_column_9( id=None, parent=None, other=None ):
## either the id or parent must be defined
if id is None and parent is None:
raise Exception("ERROR: attempt to buil... | jorvis/biocode | lib/biocode/gff.py | Python | mit | 31,182 |
# Copyright 2013 IBM Corp.
# 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 app... | afaheem88/tempest_neutron | tempest/services/image/v1/json/image_client.py | Python | apache-2.0 | 11,416 |
"""LaTeX printing tests."""
import pytest
from diofant import (CC, FF, QQ, ZZ, Abs, Add, Adjoint, And, BlockMatrix, Chi,
Ci, Complement, Contains, CosineTransform, Dict,
DiracDelta, Dummy, Ei, Eq, Equivalent, FallingFactorial,
FiniteSet, Float, FourierTra... | diofant/diofant | diofant/tests/printing/test_latex.py | Python | bsd-3-clause | 62,902 |
# Copyright (C) 2011 Canonical Ltd
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in ... | Distrotech/bzr | bzrlib/plugins/launchpad/lp_api_lite.py | Python | gpl-2.0 | 10,795 |
from file_1 import *
def target_func(x=func1, y=func2(), z=lambda: func3, w=lambda: func4()):
p1 = lambda: func5()
p2 = lambda: func6
p1(), p2()
def inner(ix=func7, iy=func8(), iz=lambda: func9, iw=lambda: func10()):
func11()
ip = lambda: func12()
ip()
func13()
inner(fu... | Lekanich/intellij-community | python/testData/hierarchy/call/Static/Lambda/main.py | Python | apache-2.0 | 411 |
import unittest
import datetime
import time
from .context import time_utilities as t_utils
from . import mock_dt
MOCK_TIMESTAMP = '2000-01-01 00:00:00'
class TimeUtilitiesTests(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
##########################################... | gannon93/gkit_utils | tests/test_time_utilities.py | Python | mit | 2,307 |
"""
Python Interchangeable Virtual Instrument Library
Copyright (c) 2012-2014 Alex Forencich
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... | sephalon/python-ivi | ivi/agilent/agilentBaseInfiniium.py | Python | mit | 12,761 |
"""Support for HomeKit Controller locks."""
from __future__ import annotations
from typing import Any
from aiohomekit.model.characteristics import CharacteristicsTypes
from aiohomekit.model.services import Service, ServicesTypes
from homeassistant.components.lock import STATE_JAMMED, LockEntity
from homeassistant.co... | rohitranjan1991/home-assistant | homeassistant/components/homekit_controller/lock.py | Python | mit | 4,317 |
"""Unit tests for the io module."""
# Tests of io are scattered over the test suite:
# * test_bufio - tests file buffering
# * test_memoryio - tests BytesIO and StringIO
# * test_fileio - tests FileIO
# * test_file - tests the file interface
# * test_io - tests everything else in the io module
# * test_univnewlines - ... | batermj/algorithm-challenger | code-analysis/programming_anguage/python/source_codes/Python3.5.9/Python-3.5.9/Lib/test/test_io.py | Python | apache-2.0 | 148,268 |
import unittest
import pkg
import os
import shutil
import shelve
class TestOpenPackage(unittest.TestCase):
def test_file_doesnt_exist(self):
with self.assertRaises(pkg.PackageException):
pkg.Package("test-data/file-doesnt-exist.tar")
def test_file_no_pkginfo(self):
with self.assert... | pta2002/pypkg | test.py | Python | mit | 7,234 |
# Copyright (c) 2017-2018 {Flair Inc.} WESLEY PENG
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | WesleyPeng/uiXautomation | src/main/python/taf/foundation/api/plugins/baseplugin.py | Python | apache-2.0 | 1,170 |
#!/usr/bin/env python3
# coding: utf-8
#
# Trololio documentation build configuration file, created by
# sphinx-quickstart on Sat Sep 6 22:50:29 2014.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogener... | ThinkChaos/Trololio | docs/conf.py | Python | mit | 8,390 |
def printDendrogram(T, sep=3):
"""Print dendrogram of a binary tree. Each tree node is represented by a length-2 tuple."""
def isPair(T):
return type(T) == tuple and len(T) == 2
def maxHeight(T):
if isPair(T):
h = max(maxHeight(T[0]), maxHeight(T[1]))
else:
... | ActiveState/code | recipes/Python/139422_Dendrogram_drawing/recipe-139422.py | Python | mit | 1,178 |
from __future__ import absolute_import
from __future__ import print_function
from typing import Any
from argparse import ArgumentParser
from optparse import make_option
from django.core.management.base import BaseCommand
from zerver.lib.actions import do_deactivate_user, user_sessions
from zerver.models import get_... | cosmicAsymmetry/zulip | zerver/management/commands/deactivate_user.py | Python | apache-2.0 | 1,991 |
"""
Functions for threshold detection
"""
import os
import logging
import numpy as np
from scipy.signal import argrelmin
def voltage_threshold(recording, threshold, order=5):
T, C = recording.shape
spike_index = np.zeros((0, 2), 'int32')
energy = np.zeros(0, 'float32')
for c in range(C):
sing... | paninski-lab/yass | src/yass/threshold/detect.py | Python | apache-2.0 | 790 |
#!/usr/bin/env python
######################################################################################
# --- odom.py Version 1.0
# --- This module establish transformation from odom frame to base frame.
# ---
# --- Copyright 2001, Mark V Automation Corp.
# ---
# --- 11/01/16 GYJ Initial cod... | guangyingjiang/Mapping_and_Navigation | src/odom.py | Python | gpl-3.0 | 1,356 |
import sys
from PyQt4 import QtCore, QtGui, uic
import light
qtCreatorFile = "pythonlight.ui" # Enter file here.
Ui_MainWindow, QtBaseClass = uic.loadUiType(qtCreatorFile)
class LightApp(QtGui.QMainWindow, Ui_MainWindow):
def __init__(self):
QtGui.QMainWindow.__init__(self)
Ui_MainWindow.__init__... | chrfrantz/op-papers | oosd/week07/light/pythonlight.py | Python | gpl-3.0 | 737 |
#!/usr/bin/python
# vim: tabstop=4 softtabstop=4 shiftwidth=4 noexpandtab
import binascii
import code
import os
import platform
import random
import select
import socket
import struct
import subprocess
import sys
import threading
import time
import traceback
try:
import ctypes
except ImportError:
has_windll = False
... | cSploit/android.MSF | data/meterpreter/meterpreter.py | Python | gpl-3.0 | 36,817 |
# Copyright 2011, VMware, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | openstack/tacker | tacker/common/utils.py | Python | apache-2.0 | 22,465 |
# Copyright (C) {2017} {Bota Viorel}
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This prog... | VBota1/pinano | scripts/updategitreadme.py | Python | gpl-3.0 | 2,046 |
#!/usr/bin/env python
"""Test the various collection objects."""
import itertools
import math
from grr.lib import aff4
from grr.lib import config_lib
from grr.lib import data_store
from grr.lib import flags
from grr.lib import rdfvalue
from grr.lib import test_lib
from grr.lib import utils
from grr.lib.aff4_objects ... | pidydx/grr | grr/lib/aff4_objects/collects_test.py | Python | apache-2.0 | 42,614 |
import rpyc
conn = rpyc.classic.connect('localhost')
| rkarlberg/opencog | opencog/python/rpyc_connection.py | Python | agpl-3.0 | 54 |
"""131. Palindrome Partitioning
https://leetcode.com/problems/palindrome-partitioning/description/
Given a string s, partition s such that every substring of the partition is a
palindrome. Return all possible palindrome partitioning of s.
A palindrome string is a string that reads the same backward as forward.
Examp... | isudox/leetcode-solution | python-algorithm/leetcode/problem_131.py | Python | mit | 1,863 |
x, y = map(int, input().split())
print(max(x, y))
| y-sira/atcoder | abc002/a.py | Python | mit | 51 |
"""
Support for Coinbase sensors.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.coinbase/
"""
from homeassistant.const import ATTR_ATTRIBUTION
from homeassistant.helpers.entity import Entity
ATTR_NATIVE_BALANCE = "Balance in native currency"
CU... | HydrelioxGitHub/home-assistant | homeassistant/components/sensor/coinbase.py | Python | apache-2.0 | 4,341 |
from ovito.io import import_file
from ovito.modifiers import *
# Load a simulation file.
node = import_file('simulation.dump')
# Set up modification pipeline, which selects and deletes all particle of type 2.
node.modifiers.append(SelectParticleTypeModifier(property='Particle Type', types={2}))
node.modifiers.append(D... | srinath-chakravarthy/ovito | doc/python/example_snippets/mutable_array.py | Python | gpl-3.0 | 1,230 |
import _plotly_utils.basevalidators
class SeparatethousandsValidator(_plotly_utils.basevalidators.BooleanValidator):
def __init__(
self,
plotly_name="separatethousands",
parent_name="layout.ternary.aaxis",
**kwargs
):
super(SeparatethousandsValidator, self).__init__(
... | plotly/python-api | packages/python/plotly/plotly/validators/layout/ternary/aaxis/_separatethousands.py | Python | mit | 524 |
from .settings import VERSIONED_APP
# TODO: look into dynamic from X import *
if VERSIONED_APP == "v5":
from django_ixpmgr.v5.models import *
elif VERSIONED_APP == "v3":
from django_ixpmgr.v3.models import *
else:
raise ValueError(
f"Could not load models for version {VERSIONED_APP}"
)
| 20c/django-ixpmgr | src/django_ixpmgr/models.py | Python | apache-2.0 | 313 |
#
# This file is part of CasADi.
#
# CasADi -- A symbolic framework for dynamic optimization.
# Copyright (C) 2010-2014 Joel Andersson, Joris Gillis, Moritz Diehl,
# K.U. Leuven. All rights reserved.
# Copyright (C) 2011-2014 Greg Horn
#
# CasADi is free software; you can... | andrescodas/casadi | docs/examples/python/lqr_control.py | Python | lgpl-3.0 | 17,381 |
import numpy as np
import matplotlib.pyplot as plt
import CalcMSD as MSD
def split(data,cutoff,wanted = [1,1,1,1],showloss = True):
#wanted: 0: List of Trajectories as lists of particle positions; 1:trajectory length info, minimum, maximum, average;
# 2: List of Frame numbers for each particle in each trajectory; 3:... | mdaddysman/Insulin-Tracking | MisPartAnlysis.py | Python | gpl-3.0 | 9,449 |
import os
import sys
from string import Template
from pathutil import *
from parseimage import *
SCREEN_SCALE = 16
PICTURE = """
{
type = "picture",
id = $id,
$export
{ tex = $tex, src = {$src}, screen = {$screen} },
},"""
def _range(v, scale):
x,y,w,h=v
if scale != 1:
x,y,w,h = x*sca... | lvshaco/ejoy2d | tool/uipack/imagepack.py | Python | mit | 1,546 |
"""
Django AppConfig module for the Gating app
"""
from django.apps import AppConfig
class GatingConfig(AppConfig):
"""
Django AppConfig class for the gating app
"""
name = 'gating'
def ready(self):
# Import signals to wire up the signal handlers contained within
from gating imp... | edx-solutions/edx-platform | lms/djangoapps/gating/apps.py | Python | agpl-3.0 | 365 |
class Arc2Sync:
def __init__(self):
# Get settings from command line arguments or default.py
from lib.questioner.Args import Args
from lib.questioner.Combiner import Combiner
from lib.questioner.File import File
self.settings = Combiner(sources=[Args(), File()])
# Bu... | sqweelygig/Arc2_Sync | Arc2Sync.py | Python | gpl-3.0 | 7,633 |
#!/usr/bin/env python
"""API renderers for accessing config."""
from grr.gui import api_call_renderers
from grr.gui import api_value_renderers
from grr.lib import config_lib
from grr.lib import rdfvalue
from grr.lib import type_info
from grr.lib import utils
class ApiConfigRenderer(api_call_renderers.ApiCallRendere... | darrenbilby/grr | gui/api_plugins/config.py | Python | apache-2.0 | 2,988 |
from itertools import cycle
import logging
from kafka.common import ProduceRequest
from kafka.protocol import create_message
log = logging.getLogger("kafka")
class SimpleProducer(object):
"""
A simple, round-robbin producer. Each message goes to exactly one partition
"""
def __init__(self, client, t... | suxor42/kafka-python | kafka/producer.py | Python | apache-2.0 | 776 |
import randomcolor
RANDOMIZER = randomcolor.RandomColor()
def randcolor():
cols = RANDOMIZER.generate(luminosity="bright", format_="rgb")
col = cols[0][4:-1]
return tuple(int(x) for x in col.split(", "))
| mikand/pySmartMirror | utils.py | Python | apache-2.0 | 218 |
"""container for Block"""
import random
import logging
from collections import deque
from .libtcodpy import _lib
put_char_ex = _lib.TCOD_console_put_char_ex
from . import entities
from . import hidden_map_handler
from . import gen_map
generate_map = gen_map.gen_map
generate_obstacle_map = gen_map.generate_obstacle_m... | brycepg/cave-dweller | cave_dweller/block.py | Python | gpl-3.0 | 16,933 |
#!/usr/bin/env python2
"""
Copyright (c) 2014 Alex Forencich
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, mer... | alexforencich/hdg2000 | fpga/tb/test_mcb.py | Python | mit | 6,160 |
# -*- coding: utf-8 -*-
"""
Created on Mon Apr 3 16:08:47 2017
@author: AmatVictoriaCuramIII
"""
#lock and load
#import numpy as np
#from pandas_datareader import data
import pandas as pd
import time as t
import numpy as np
from pandas_datareader import data
from DefModADXStratOpt import DefModADXStratOpt
from ModADX... | adamrvfisher/TechnicalAnalysisLibrary | ADXMultiperiod.py | Python | apache-2.0 | 6,558 |
import usocket as socket
import ustruct as struct
from ubinascii import hexlify
class MQTTException(Exception):
pass
class MQTTClient:
def __init__(self, client_id, server, port=0, user=None, password=None, keepalive=0,
ssl=False, ssl_params={}):
if port == 0:
port = 8883... | pyaiot/pyaiot | utils/pycom/libs/umqtt.py | Python | bsd-3-clause | 6,136 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Parse org-mode agendas, task lists, etc. and return simple reminders
to be included in environment status bar or shell.
"""
import re
import datetime as dt
import os
import orgnode
import itertools
from collections import defaultdict
from config import *
def load_d... | blaa/org2todotxt | org2todotxt.py | Python | mit | 5,562 |
# python imports
import locale
import re
# django imports
from django.conf import settings
from django.core.cache import cache
from django.contrib.auth.models import User
from django.db import models
from django.utils.translation import ugettext_lazy as _
# lfs imports
import lfs.catalog.utils
from lfs.catalog.models... | leadbrick/django-lfs | lfs/cart/models.py | Python | bsd-3-clause | 15,091 |
#!/usr/bin/env python
# Copyright (C) 2012 OpenStack, LLC.
#
# 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... | gforcada/jenkins-job-builder | jenkins_jobs/cache.py | Python | apache-2.0 | 5,063 |
from unittest.mock import patch
from tornado.testing import gen_test
from pokerserver.database import PlayersRelation, TableConfig, TablesRelation
from pokerserver.models import Round, Statistics, Table, get_all_cards
from tests.utils import IntegrationHttpTestCase
class TestFullMatch(IntegrationHttpTestCase):
... | MartinAltmayer/pokerserver | tests/integration/controllers/test_full_match.py | Python | gpl-3.0 | 22,462 |
from flask import Flask, request, render_template
app = Flask(__name__)
@app.route('/exec01', methods=['GET', 'POST'])
def index():
if request.method == 'POST':
name = request.form.get('name')
passwd = request.form.get('passwd')
print name, passwd
if name == 'admin' and passwd == 'a... | seerjk/reboot06 | 06/exec-01.py | Python | mit | 511 |
# This file is part of Buildbot. Buildbot is free software: you can
# redistribute it and/or modify it under the terms of the GNU General Public
# License as published by the Free Software Foundation, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... | zozo123/buildbot | master/buildbot/db/migrate/versions/035_remove_changes_is_dir_column.py | Python | gpl-3.0 | 3,680 |
import core.manager as manager
from nose.tools import assert_equal
from nose.tools import assert_not_equal
from nose.tools import assert_raises
from nose.tools import raises
from nose.tools import assert_true
from nose.tools import assert_false
import datetime
from util import *
from core.fileSystemModule import FileSy... | vguzmanp/cloud-in-one | test/test_exceptions.py | Python | mit | 18,153 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.8 on 2017-12-16 16:40
from __future__ import unicode_literals
from django.db import migrations
def is_editor(user):
if not user:
return False
if user.is_superuser or \
user.team_memberships.exclude(categories__isnull=True)\
... | Zahajamaan/Fudulbank | exams/migrations/0058_fill_explanation_is_contribution.py | Python | agpl-3.0 | 2,201 |
from django import template
from django.utils.safestring import mark_safe
from django.contrib.messages import constants as message_constants
register = template.Library()
ERROR_LEVEL_MAPPING = {
message_constants.DEBUG: 'secondary',
message_constants.INFO: '',
message_constants.SUCCESS: 'success',
m... | recipi/recipi | src/recipi/core/templatetags/foundation.py | Python | isc | 728 |
# -*- coding: utf-8 -*-
# Copyright 2007-2020 The HyperSpy developers
#
# This file is part of HyperSpy.
#
# HyperSpy is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at... | dnjohnstone/hyperspy | hyperspy/models/model1d.py | Python | gpl-3.0 | 36,896 |
import hashlib
import json
import os
from random import randrange
import uuid
import ddt
import falcon
from mock import patch
import msgpack
from six.moves.urllib.parse import urlparse, parse_qs
from deuce import conf
from deuce.model import Vault
from deuce.util.misc import set_qs, relative_uri
from deuce.tests impo... | rackerlabs/deuce | deuce/tests/test_blocks.py | Python | apache-2.0 | 23,426 |
#!/usr/bin/env python
#-*-*- encoding: utf-8 -*-*-
#
# Copyright (C) 2005 onwards University of Deusto
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
#
# This software consists of contributions made by many individual... | morelab/weblabdeusto | server/src/weblab/core/coordinator/store.py | Python | bsd-2-clause | 3,799 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import ConfigParser
class TestUnit():
def __init__(self, chemin = None):
self.variables = {}
# Chargement des valeurs par défaut dans un premier temps
self.chargeUnit("./tests/default.unit")
# Chargement des valeurs de l'unit pour écr... | Tailszefox/LoupsGarous | testunit.py | Python | cc0-1.0 | 1,043 |
#!/usr/bin/env python
# This script extracts the VPlan digraphs from the vectoriser debug messages
# and saves them in individual dot files (one for each plan). Optionally, and
# providing 'dot' is installed, it can also render the dot into a PNG file.
from __future__ import print_function
import sys
import re
impor... | google/llvm-propeller | llvm/utils/extract_vplan.py | Python | apache-2.0 | 1,612 |
# Copyright 2022 The SeqIO Authors.
#
# 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 wr... | google/seqio | seqio/dataset_providers.py | Python | apache-2.0 | 63,287 |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | iemejia/incubator-beam | sdks/python/apache_beam/io/watermark_estimators.py | Python | apache-2.0 | 5,431 |
from equipment import Spell, Weapon
from units import Unit, Hero, Enemy
class Fight():
def __init__(self, hero, enemy, distance):
self.hero = hero
self.enemy = enemy
self.distance = distance
self.unit_on_turn = None
self.victim = None
def deal_damage(self, damage, unit... | int3l/dungeons-and-pythons | fight.py | Python | mit | 792 |
import sublime, sublime_plugin
from sublime_lib.path import root_at_packages
COMPLETIONS_SYNTAX_DEF = "Packages/AAAPackageDev/Support/Sublime Completions.tmLanguage"
TPL = """{
"scope": "source.${1:off}",
"completions": [
{ "trigger": "${2:some_trigger}", "contents": "${3:Hint: Use f, ff a... | fhchina/boxstarter | BuildPackages/example/sublime/Packages/AAAPackageDev/completions_dev.py | Python | apache-2.0 | 676 |
'''
Test for deleting and expunge vol template check vol created from template ops.
The key step:
-add iso
-create vm from iso
-create data vol1 from template
-create template2 from data vol1
-create data vol2 from template2
-delete template2
-do data vol all ops test on data vol2
-expunge template2
-do data vol all o... | zstackio/zstack-woodpecker | integrationtest/vm/multihosts/bs/test_del_expunge_template_dvol_template_ops.py | Python | apache-2.0 | 4,369 |
from django.conf.urls.defaults import *
from shoppy.support.views import *
urlpatterns = patterns('',
(r'^contactus/$',contactus,{}, 'shoppy_support_contactus'),
(r'^contactus/done$',contactusDone,{}, 'shoppy_support_contactus_done'),
) | pocketone/django-shoppy | shoppy/support/urls.py | Python | bsd-3-clause | 246 |
import imp
import os
from django.conf import settings
from django.conf.urls import include, url
urlpatterns = [
url(r'^', include('cripts.core.urls')), # Core
url(r'^dashboards/', include('cripts.dashboards.urls')), # Dashboard
url(r'^comments/', include('cripts.comments.urls... | lakiw/cripts | cripts/urls.py | Python | mit | 3,033 |
import sqlite3, struct, socket, time
from twisted.internet.protocol import DatagramProtocol
from twisted.internet.task import LoopingCall
from twisted.internet import reactor
class AOEServerFinder (DatagramProtocol):
def startProtocol (self):
pass
def createDatabase (self):
pass
d... | lakyran/GameServerFinder | workers/AOEServerFinder.py | Python | gpl-3.0 | 529 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.