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 |
|---|---|---|---|---|---|
"""
feed_entry_dedupe
~~~~~~~~~~~~~~~~~
Deduplicate entries for the same feed.
Duplicates are entries with the same title *and* summary/content.
If the old entry is read, the new one will be too.
If the old entry is unread, it will be marked as read in favor of the new one.
To load::
READER_PLUGIN='reader.plug... | kushalbhola/MyStuff | Practice/PythonApplication/env/Lib/site-packages/reader/plugins/feed_entry_dedupe.py | Python | apache-2.0 | 2,706 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-02-01 19:23
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('blog', '0002_auto_20160201_1842'),
]
operations = [
migrations.AddField(
... | janusnic/dj-21v | unit_15/mysite/blog/migrations/0003_auto_20160201_1923.py | Python | mit | 990 |
# Generated by Django 3.1.3 on 2021-01-02 13:46
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('manager', '0009_auto_20201202_1559'),
]
operations = [
migrations.AlterField(
model_name='setting',
name='rir',
... | wger-project/wger | wger/manager/migrations/0010_auto_20210102_1446.py | Python | agpl-3.0 | 1,194 |
#!/usr/bin/env python
"""
Copyright 2012 GroupDocs.
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... | liosha2007/temporary-groupdocs-python-sdk | groupdocs/models/AddQuestionnaireCollectorResponse.py | Python | apache-2.0 | 1,193 |
import RPi.GPIO as GPIO
import time
print '#' * 20
print 'HELLO WORLD'
print '#' * 20
GPIO.setmode(GPIO.BOARD)
# Front left
GPIO.setup(15,GPIO.OUT)
GPIO.setup(11,GPIO.OUT)
GPIO.setup(13,GPIO.OUT)
# Front right
GPIO.setup(19,GPIO.OUT)
GPIO.setup(21,GPIO.OUT)
GPIO.setup(23,GPIO.OUT)
RUN_TIME = raw_input('RUN TIME: ')... | voostar/Jiva | motor_draft/motor01.py | Python | mit | 1,643 |
# Copyright 2016 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... | quickresolve/accel.ai | flask-aws/lib/python2.7/site-packages/ebcli/lib/elbv2.py | Python | mit | 2,545 |
from __future__ import absolute_import
from pony.py23compat import PY2, iteritems, basestring, unicode, buffer, int_types
import os
os.environ["NLS_LANG"] = "AMERICAN_AMERICA.UTF8"
from datetime import datetime, date, time, timedelta
from decimal import Decimal
from uuid import UUID
import cx_Oracle
fro... | compiteing/flask-ponypermission | venv/lib/python2.7/site-packages/pony/orm/dbproviders/oracle.py | Python | mit | 23,505 |
"""
Utilities for generating random numbers, random sequences, and
random selections.
"""
# Copyright (C) 2004-2011 by
# Aric Hagberg <hagberg@lanl.gov>
# Dan Schult <dschult@colgate.edu>
# Pieter Swart <swart@lanl.gov>
# All rights reserved.
# BSD license.
import random
import sys
import networkx a... | valiantljk/graph-partition | utils/random_sequence.py | Python | gpl-2.0 | 6,428 |
import os
from pygame import RLEACCEL
from pygame import image as py_image
from pygame import error as py_error
def load_image(name, colorkey=None):
fullname = os.path.join('images', name)
try:
image = py_image.load_basic(fullname)
except py_error as message:
print('Cannot load image:', n... | TurBoss/HostilPlanet | lib/utilities.py | Python | gpl-2.0 | 569 |
#!/usr/bin/python
#
# This file is part of Ansible
#
# Ansible 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.
#
# Ansible is distribut... | alxgu/ansible | lib/ansible/modules/network/cloudengine/ce_aaa_server_host.py | Python | gpl-3.0 | 104,262 |
#!/usr/bin/python3
import os
try:
from dateutil import parser
du = 1
except:
du = 0
print ("No dateutl!" )
if du == 0:
os.system("sudo pip install python-dateutil")
else:
print ("date util already installed")
| mikehankey/fireball_camera | update-install.py | Python | gpl-3.0 | 231 |
"""Device discovery functions for Zigbee Home Automation."""
from __future__ import annotations
from collections import Counter
import logging
from typing import Callable
from homeassistant import const as ha_const
from homeassistant.core import callback
from homeassistant.helpers.dispatcher import (
async_dispat... | w1ll1am23/home-assistant | homeassistant/components/zha/core/discovery.py | Python | apache-2.0 | 9,849 |
# 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 agree... | deepmind/diplomacy | environment/observation_transformation.py | Python | apache-2.0 | 18,827 |
#!/usr/bin/env python3
import stegpng
from sys import argv
img = stegpng.open(argv[1], ignore_signature=False)
#for chunk in img.chunks:
#print(chunk.type)
#print(chunk.is_supported())
#print('='*50)
def png_chunk_summary(chunk):
print(chunk.type)
if not chunk.is_supported():
print('Uns... | WHGhost/stegPNG | tests/summarize.py | Python | gpl-3.0 | 1,122 |
from spydht.spydht import DHT
import nacl.signing
import time
import hashlib
host1, port1 = 'localhost', 31000
key2 = nacl.signing.SigningKey.generate()
host2, port2 = 'localhost', 3101
dht2 = DHT(host2, port2, key2, boot_host=host1, boot_port=port1, wan_ip="127.0.0.1")
time.sleep(5)
content = "x"
id = "test"
d... | robertsdotpm/spydht | node_2.py | Python | bsd-2-clause | 889 |
import sys
sys.path.insert(1, "../../")
import h2o, tests
def metric_accessors():
cars = h2o.import_file(path=tests.locate("smalldata/junit/cars_20mpg.csv"))
r = cars[0].runif()
train = cars[r > .2]
valid = cars[r <= .2]
# regression
response_col = "economy"
distribution = "gaussian"
... | kyoren/https-github.com-h2oai-h2o-3 | h2o-py/tests/testdir_misc/pyunit_metric_accessors.py | Python | apache-2.0 | 42,219 |
import logging
from django.core.management.base import BaseCommand
from waldur_rancher.utils import SyncUser
logger = logging.getLogger(__name__)
class Command(BaseCommand):
help = """Sync users from Waldur to Rancher."""
def handle(self, *args, **options):
def print_message(count, action, name='u... | opennode/nodeconductor-assembly-waldur | src/waldur_rancher/management/commands/sync_users.py | Python | mit | 986 |
# Author: Yiheng Zhu
# Date: 31/08/2017
# Description:
# The bandit class
# import libraries
import numpy
class Bandit:
def __init__(self, true_mean):
self.true_mean = true_mean
self.sample_number = 0
self.estimated_mean = 0
# pull the lever of the slot machine
def pull_lever(self):
# return true mean ... | GitYiheng/reinforcement_learning_test | test00_previous_files/Bandit.py | Python | mit | 901 |
from datetime import datetime
from datetime import timedelta
class timecycle:
# describes the type
typeDescription = 'Creates a timeable instance we can use for timing cycles of things'
def __init__(self):
self.wait_time = 15
self.alarm_start = datetime.now()
self.wait_time_delta ... | headstrongsolutions/Jarvis_Screen | timecycle.py | Python | mit | 1,206 |
#!/usr/bin/env python2.7
import signal
import sys
import threading
from time import sleep
from uthportal import UthPortal
from uthportal.logger import get_logger
from uthportal.networking import ThreadedSocketServer
uth_portal = None
socket_server = None
def signal_handler(signal, frame):
if uth_portal:
... | kkanellis/uthportal-server | uth-portal.py | Python | gpl-3.0 | 1,371 |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
'''
# Shortest Word题目地址:https://www.codewars.com/kata/57cebe1dc6fdc20c57000ac9/train/python
'''
import unittest
class TestCases(unittest.TestCase):
def setUp(self):
pass
def test1(self):self.assertEqual(find_short("bitcoin take over the world maybe who knows ... | karchi/codewars_kata | 已完成/Shortest Word.py | Python | mit | 936 |
# -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import
from numba.nodes import *
#----------------------------------------------------------------------------
# User-extensible nodes
#----------------------------------------------------------------------------
class UserNodeMeta(type... | shiquanwang/numba | numba/nodes/usernode.py | Python | bsd-2-clause | 2,475 |
import json
import os
import numpy as np
import pytest
from hyperspy import signals
from hyperspy.io import load
from hyperspy.misc.test_utils import assert_deep_almost_equal
test_files = ['30x30_instructively_packed_16bit_compressed.bcf',
'16x16_12bit_packed_8bit.bcf',
'P45_the_default_j... | erh3cq/hyperspy | hyperspy/tests/io/test_bruker.py | Python | gpl-3.0 | 9,549 |
#-*- coding: utf-8 -*-
# stino/serial.py
import os
import threading
import time
from . import constant
from . import pyserial
class SerialListener:
def __init__(self, menu):
self.menu = menu
self.serial_list = []
self.is_alive = False
def start(self):
if not self.is_alive:
self.is_alive = True
liste... | kierangraham/dotfiles | Sublime/Packages/Arduino-like IDE/app/serial.py | Python | bsd-2-clause | 2,193 |
# This file is part of the sos project: https://github.com/sosreport/sos
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# version 2 of the GNU General Public License.
#
# See the LICENSE file in the source distribution ... | BryanQuigley/sos | sos/report/plugins/ceph.py | Python | gpl-2.0 | 3,783 |
def __load():
import imp, os, sys
ext = 'pygame/font.so'
for path in sys.path:
if not path.endswith('lib-dynload'):
continue
ext_path = os.path.join(path, ext)
if os.path.exists(ext_path):
mod = imp.load_dynamic(__name__, ext_path)
break
else:... | mokuki082/EggDrop | code/build/bdist.macosx-10.6-intel/python3.4-standalone/app/temp/pygame/font.py | Python | gpl-3.0 | 393 |
#
# Broker peering simulation (part 2) in Python
# Prototypes the request-reply flow
#
# While this example runs in a single process, that is just to make
# it easier to start and stop the example. Each thread has its own
# context and conceptually acts as a separate process.
#
# Author : Min RK
# Contact... | krattai/noo-ebs | docs/zeroMQ-guide2/examples/Python/peering2.py | Python | bsd-2-clause | 5,525 |
# Copyright (c) 2015, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
from __future__ import absolute_... | is00hcw/mcrouter | mcrouter/test/test_routing_prefixes.py | Python | bsd-3-clause | 3,332 |
#!/usr/bin/env python
import shutil
import os
import glob
import textwrap
from Bio import SeqIO
import fasta_statter
"""
Generic assembler template for writing assembly bindings. Assembly Dispatch provides
a number of relevant arguments (mostly geared around the requirements of Velvet, but
this has proved to b... | crashfrog/Dispatch | worst_assembler.py | Python | unlicense | 3,511 |
#! /usr/bin/env python
# encoding: utf-8
# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
from waflib.Tools import ccroot,ar
from waflib.Configure import conf
@conf
def find_scc(conf):
v=conf.env
cc=conf.find_program('cc',var='CC')
try:
conf.cmd_and_log(cc+['-flags'])
except Excepti... | Gnurou/glmark2 | waflib/Tools/suncc.py | Python | gpl-3.0 | 1,111 |
import os
import sys
import numpy as np
sys.path.insert(0, os.getcwd() + '/../../tools/')
import wb
import lstm
def data(tskdir):
train = tskdir + 'data/train.txt'
valid = tskdir + 'data/valid.txt'
test = tskdir + 'data/test.txt'
return data_verfy([train, valid, test]) + data_wsj92nbest()
def data_... | wbengine/SPMILM | egs/1-billion/run_lstm.py | Python | apache-2.0 | 3,239 |
#!/usr/bin/env python
# Copyright 2010-2012 RethinkDB, all rights reserved.
import sys, os
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir, 'common')))
import memcached_workload_common
# TODO: This readline function is copied and pasted from big_values.py.
def readline(s):
bu... | krahman/rethinkdb | test/memcached_workloads/unappend_unprepend.py | Python | agpl-3.0 | 1,720 |
import os
import sys
import yaml
import pivotaltracker
from pivotaltracker._termcolor import styled
from pivotaltracker._helpers import command, choose_command
__CONFPATH = os.path.join(os.path.expanduser("~"), ".pivotaltracker")
def required_style(msg):
return styled(" %s " % msg, attrs=["reverse"])
def optiona... | harperreed/pivotaltracker | pivotaltracker/tool.py | Python | bsd-3-clause | 5,691 |
"""utils.
Usage:
cvrminer.utils make-data-directory
"""
from __future__ import absolute_import, division, print_function
import errno
from os import makedirs
from os.path import join
from .config import data_directory
def make_data_directory(*args):
"""Make data directory.
The data_directory is by de... | fnielsen/cvrminer | cvrminer/utils.py | Python | apache-2.0 | 988 |
import sys
import numpy as np
# compute sigmoid nonlinearity
def sigmoid(x):
output = 1/(1+np.exp(-x))
return output
# convert output of sigmoid function to its derivative
def sigmoid_output_to_derivative(output):
return output*(1-output)
# input dataset
X = np.array([ [0,1],
[0,1],
... | jatinmistry13/StochasticGradientDescentNeuralNetwork | two_layer_neural_network.py | Python | mit | 1,126 |
"""
Queue class
"""
class Queue:
"""
A simple implementation of a FIFO queue.
"""
def __init__(self):
"""
Initialize the queue.
"""
self._items = []
def __len__(self):
"""
Return the number of items in the queue.
"""
... | maistrovas/My-Courses-Solutions | Coursera Principles of Computing (Part 1, 2)/week_6/Queue_Class.py | Python | mit | 1,054 |
# Generated from tools/antlr/Fcl.g4 by ANTLR 4.5.3
# encoding: utf-8
from __future__ import print_function
from antlr4 import *
from io import StringIO
def serializedATN():
with StringIO() as buf:
buf.write(u"\3\u0430\ud6d1\u8206\uad2d\u4417\uaef1\u8d80\uaadd\2")
buf.write(u"_\u0306\b\1\4\2\t\2\4\... | arruda/scikit_fuzzy_fcl | scikit_fuzzy_fcl/py2_parser/FclLexer.py | Python | mit | 31,626 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models, utils
from django.conf import settings
class Migration(DataMigration):
def forwards(self, orm):
"Write your forwards methods here."
try:
for player in orm.PlayerD... | YourCyborg/Sun-RPI | src/players/migrations/0005_adding_player_cmdset.py | Python | bsd-3-clause | 7,810 |
import torch.nn as nn
import math
import torch.utils.model_zoo as model_zoo
__all__ = ['ResNet', 'resnet18', 'resnet34', 'resnet50', 'resnet101',
'resnet152']
model_urls = {
'resnet18': 'https://download.pytorch.org/models/resnet18-5c106cde.pth',
'resnet34': 'https://download.pytorch.org/models/r... | csyhhu/L-OBS | PyTorch/ImageNet/models/resnet_layer_input.py | Python | mit | 10,119 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file '/home/mte90/Desktop/Prog/LearnHotkeys/defdialog.ui'
#
# Created: Tue Dec 18 17:51:54 2012
# by: PyQt4 UI code generator 4.9.3
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 ... | Mte90/LearnHotkeys | ui_defdialog.py | Python | gpl-3.0 | 3,312 |
# Copyright 2014 Diamond Light Source Ltd.
#
# 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 t... | FedeMPouzols/Savu | savu/plugins/reconstructions/simple_recon.py | Python | gpl-3.0 | 4,028 |
# -*- coding: utf-8 -*-
import logging
import json
from copy import deepcopy
import time
import uuid
from .queue import factory
class Client(object):
job_tpl = {'id': None,
'msg': None,
'create_time': None,
'timeout': None,
'fin... | gosom/proteraios-queue | proteraios/client.py | Python | mit | 2,327 |
#!/usr/bin/env python
# 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 ... | indashnet/InDashNet.Open.UN2000 | android/external/chromium_org/third_party/WebKit/Source/core/scripts/make_token_matcher.py | Python | apache-2.0 | 9,695 |
#!/usr/bin/env python
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
__license__ = 'GPL v3'
__copyright__ = '2010, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
import time
from functools import partial
from PyQt4.Qt import QTimer, QDialog, QDialogButtonBox, QCheckBox, QVBoxLayout, ... | insomnia-lab/calibre | src/calibre/gui2/actions/tweak_epub.py | Python | gpl-3.0 | 5,580 |
"""
noop_returner
~~~~~~~~~~~~~
A returner that does nothing which is used to test the salt-master `event_return` functionality
"""
import logging
import salt.utils.jid
log = logging.getLogger(__name__)
__virtualname__ = "runtests_noop"
def __virtual__():
return True
def event_return(events):
log.debu... | saltstack/salt | tests/integration/files/returners/noop_returner.py | Python | apache-2.0 | 704 |
"""
cur_callback and goal_callback are invoked to detimine what actions should be taken
to reach convergence. Should return a dict where the keys are the set, and the values are a
context to use when adding or removing items.
"""
def enforce(cur_callback, goal_callback, add_callback, remove_callback):
converged = Tru... | Livefyre/enforcer | enforcer/__init__.py | Python | mit | 636 |
# Directory tree dictionaries to be used with create_dtree() test tool.
example_home_dir = {
# Mock home directory including duplicate directory names and no uniform naming
# convention for directories.
'Desktop': None,
'devel': {
'c': {
'ch1': None
},
'django': {
... | cgmcintyr/jumpdir | tests/example_dtrees.py | Python | mit | 2,506 |
from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
def register_types(module):
root_module = module.get_root()
## simple-ref-count.h: ns3::SimpleRefCount<ns3::dot11s::IeBeaconTimingUnit, ns3::empty, ns3::DefaultDeleter<ns3::dot11s::IeBeaconTimingUnit> > [class]
module.ad... | ciprian-radu/unimap.ns-3noc | bindings/python/apidefs/gcc-ILP32/ns3_module_dot11s.py | Python | gpl-2.0 | 49,784 |
from django.test import TestCase
from ..models import AwareModel, NaiveModel
from boardinghouse.templatetags.boardinghouse import schema_name, is_schema_aware, is_shared_model
from boardinghouse.models import Schema
class TestTemplateTags(TestCase):
def test_is_schema_aware_filter(self):
self.assertTrue(i... | luzfcb/django-boardinghouse | tests/tests/test_template_tag.py | Python | bsd-3-clause | 1,094 |
from rest_framework import generics
from api import *
from serializers import StudentDiscussionSerializer, CourseDiscussionSerializer
from rest_framework.permissions import IsAdminUser
from django.http import Http404
from rest_framework.authentication import BasicAuthentication, SessionAuthentication
from oauth2_provid... | jaygoswami2303/course_dashboard_api | v2/DiscussionAPI/views.py | Python | mit | 5,468 |
#!/usr/bin/env python
from loginsightwebhookdemo import app, parse, callapi
from flask import request, json
import logging
__author__ = "Steve Flanders"
__license__ = "Apache v2"
__verion__ = "1.0"
# zendesk parameters
ZENDESKURL = '' # required
ZENDESKUSER = '' # required if not passed in URL
ZENDESKPASS = '' # r... | vmw-loginsight/webhook-shims | loginsightwebhookdemo/zendesk.py | Python | apache-2.0 | 3,385 |
from django.db import models
from django_comments.signals import comment_was_posted
from django.core.mail import send_mail
# Signals
def notify_user_about_comment(sender, **kwargs):
try:
comment = kwargs['comment']
# Only send on GM comment
if not comment.user.is_staff:
return... | TreacheryLarp/downtime | gamemaster/models.py | Python | gpl-3.0 | 1,444 |
# -*- coding: utf-8 -*-
# --------------------------------------------------------------------------
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2012-Today Serpent Consulting Services PVT. LTD.
# (<http://www.serpentcs.com>)
#
# This program is free software: you can redistribute it and/or ... | vileopratama/vitech | src/addons/hotel/wizard/hotel_wizard.py | Python | mit | 1,573 |
"""
Unit tests for ProgramEnrollment models.
"""
from uuid import uuid4
import ddt
from django.db.utils import IntegrityError
from django.test import TestCase
from edx_django_utils.cache import RequestCache
from opaque_keys.edx.keys import CourseKey
from course_modes.models import CourseMode
from lms.djangoapps.pro... | cpennington/edx-platform | lms/djangoapps/program_enrollments/tests/test_models.py | Python | agpl-3.0 | 6,137 |
#!/usr/bin/env python
import re
from time import sleep
import telnetlib
HOST = 'localhost'
PORT = 4242
prompt = [r'repl\d*> '] # list of regular expressions
def get_page(url, wait=3):
tn = telnetlib.Telnet(HOST, PORT)
tn.expect(prompt)
cmd = "content.location.href = '{url}'".format(url=url)
tn.wr... | jabbalaci/jabbapylib | demos/browser_automation/moz_repl.py | Python | gpl-3.0 | 1,160 |
# Copyright The OpenTelemetry 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 ... | open-telemetry/opentelemetry-python | exporter/opentelemetry-exporter-zipkin-json/src/opentelemetry/exporter/zipkin/json/v1/__init__.py | Python | apache-2.0 | 2,951 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
#
# Copyright © 2012 eNovance <licensing@enovance.com>
#
# Author: Guillaume Pernot <gpernot@praksys.org>
#
# 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 ... | citrix-openstack-build/ceilometer | tests/objectstore/test_swift.py | Python | apache-2.0 | 5,534 |
from datetime import datetime
from wdim.util import pack
from wdim.orm import fields
from wdim.orm import Storable
from wdim.client.actions import Action
class Journal(Storable):
_id = fields.ObjectIdField()
action = fields.EnumField(Action)
record_id = fields.StringField()
created_by = fields.Str... | chrisseto/Still | wdim/client/journal.py | Python | mit | 2,481 |
"""
This package contains visualization helpers for the geometric primitives
in use in ``phantomas``.
"""
__all__ = ["views"]
| oesteban/phantomas | phantomas/visu/__init__.py | Python | bsd-3-clause | 126 |
# coding=UTF-8
"""
Tests for signal handling in commerce djangoapp.
"""
from __future__ import unicode_literals
import base64
import json
from urlparse import urljoin
import ddt
from django.contrib.auth.models import AnonymousUser
from django.test import TestCase
from django.test.utils import override_settings
import... | synergeticsedx/deployment-wipro | lms/djangoapps/commerce/tests/test_signals.py | Python | agpl-3.0 | 12,240 |
# coding: utf-8
"""
Wavefront REST API
<p>The Wavefront REST API enables you to interact with Wavefront servers using standard REST API tools. You can use the REST API to automate commonly executed operations such as automatically tagging sources.</p><p>When you make REST API calls outside the Wavefront REST ... | wavefrontHQ/python-client | test/test_derived_metric_definition.py | Python | apache-2.0 | 1,356 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'ComicSite.header_image'
db.add_column('comicmodels_comicsite', 'header_image',
... | cpatrick/comic-django | django/comicmodels/migrations/0014_auto__add_field_comicsite_header_image.py | Python | apache-2.0 | 8,212 |
"""
Given two arrays, write a function to compute their intersection.
Example:
Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2].
Note:
Each element in the result must be unique.
The result can be in any order.
"""
class Solution(object):
def intersection(self, nums1, nums2):
"""
... | ufjfeng/leetcode-jf-soln | python/349_intersection_of_two_arrays.py | Python | mit | 526 |
from openerp import models, fields, api
from openerp.tools.translate import _
import logging
_logger = logging.getLogger(__name__)
class ModelsXMLExport(models.Model):
_name = 'setting.connect'
node_address = fields.Char(string="Node Address")
privat_key = fields.Text(string="Privat Key")
ass... | stanta/darfchain | darfchain_docker_vagrant/addons/darfchain/models/models.py | Python | gpl-3.0 | 531 |
#!/usr/bin/python
# Copyright (C) 2010 Ryan Kavanagh <ryanakca@kubuntu.org>
#
# Slingshot 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 versio... | ryanakca/slingshot | setup.py | Python | gpl-2.0 | 2,424 |
# Copyright (C) 2012-2021 Germar Reitze
#
# 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 pro... | bit-team/backintime | qt/icon.py | Python | gpl-2.0 | 3,799 |
# -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2016, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import unicode_literals
import logging
from django import ... | hrayr-artunyan/shuup | shuup/notify/actions/email.py | Python | agpl-3.0 | 3,323 |
# This file is part of VoltDB.
# Copyright (C) 2008-2014 VoltDB Inc.
#
# This file contains original code and/or modifications of original code.
# Any modifications made by VoltDB Inc. are licensed under the following
# terms and conditions:
#
# Permission is hereby granted, free of charge, to any person obtaining
# a... | eoneil1942/voltdb-4.7fix | lib/python/voltcli/voltdb.d/rejoin.py | Python | agpl-3.0 | 1,711 |
# -*- coding: utf-8 -*-
"""Subliminal custom utils."""
from __future__ import unicode_literals
import hashlib
def hash_itasa(video_path):
"""Compute a hash using ItaSA's algorithm.
:param str video_path: path of the video.
:return: the hash.
:rtype: str
"""
readsize = 1024 * 1024 * 10
wi... | fernandog/Medusa | medusa/subtitle_providers/utils.py | Python | gpl-3.0 | 425 |
# -*- coding: utf-8 -*-
#
# This file is part of Zenodo.
# Copyright (C) 2015 CERN.
#
# Zenodo 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 v... | drjova/zenodo | zenodo/modules/pages/__init__.py | Python | gpl-3.0 | 898 |
# -*- 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... | diogocs1/comps | web/addons/stock_account/wizard/stock_invoice_onshipping.py | Python | apache-2.0 | 6,111 |
import os
from deveba.shell import shell
from deveba import utils
from deveba.handler import Handler, HandlerError, HandlerConflictError
class GitStatus(object):
"""
Parses the output of git status --porcelain -z into usable fields
"""
__slots__ = ["modified_files", "new_files", "conflicting_files"]
... | agateau/deveba | deveba/githandler.py | Python | gpl-3.0 | 5,359 |
# Copyright 2021 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | tensorflow/tensorflow | tensorflow/compiler/mlir/tfrt/python_tests/multiple_results_test.py | Python | apache-2.0 | 3,867 |
"""
# A Better Where
WHERE2 is a near-linear time top-down clustering alogithm.
WHERE2 updated an older where with new Python tricks.
## Standard Header Stuff
"""
from __future__ import division, print_function
from pdb import set_trace
import sys
import types
from demos import *
from libWhere import *
from nas... | ai-se/Tree-Learner | _imports/where2.py | Python | unlicense | 11,309 |
# Copyright (c) 2015 OpenStack Foundation
#
# 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 ... | psachin/swift | swift/common/middleware/copy.py | Python | apache-2.0 | 24,612 |
from itertools import combinations_with_replacement
import pytest
from aioredis.errors import ReplyError
@pytest.mark.asyncio
async def test_sadd(redis):
ret = await redis.sadd("foo", "bar")
assert ret == 1
assert redis._redis.smembers("foo") == {b"bar"}
@pytest.mark.asyncio
async def test_sadd_many(re... | kblin/mockaioredis | tests/test_set.py | Python | apache-2.0 | 11,392 |
# Copyright 2020 Zadara Storage, Inc.
# Originally authored by Jeremy Brown - https://github.com/jwbrown77
#
# 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... | zadarastorage/zadarapy | zadarapy/vpsaos/container.py | Python | apache-2.0 | 7,130 |
"""empty message
Revision ID: 05ef92815fbd
Revises: d6a54eeeaeb9
Create Date: 2020-12-28 12:29:49.628089
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '05ef92815fbd'
down_revision = 'd6a54eeeaeb9'
branch_labels = None
depends_on = None
def upgrade():
# ... | hashview/hashview | migrations/versions/05ef92815fbd_.py | Python | gpl-3.0 | 1,053 |
import os
from admin_scripts.tests import AdminScriptTestCase
from django.apps import apps
from django.core import management
from django.core.management import BaseCommand, CommandError, find_commands
from django.core.management.utils import find_command, popen_wrapper
from django.db import connection
from django.te... | filias/django | tests/user_commands/tests.py | Python | bsd-3-clause | 8,086 |
import errno
import os
import pwd
import shutil
import sys
from jinja2 import Environment, FileSystemLoader
class TutorialEnv:
LOCAL_MACHINE = ("Local Machine Condor Pool", "submit-host")
USC_HPCC_CLUSTER = ("USC HPCC Cluster", "usc-hpcc")
OSG_FROM_ISI = ("OSG from ISI submit node", "osg")
XSEDE_BOSC... | pegasus-isi/pegasus | packages/pegasus-python/src/Pegasus/init-old.py | Python | apache-2.0 | 14,973 |
from __future__ import print_function, division, absolute_import
import numpy as np
from numba import cuda, float32, float64, int32
from numba.cuda.testing import unittest
@cuda.jit(argtypes=[float32[:, :], int32, int32])
def div(grid, l_x, l_y):
for x in range(l_x):
for y in range(l_y):
grid[... | GaZ3ll3/numba | numba/cuda/tests/cudapy/test_idiv.py | Python | bsd-2-clause | 1,025 |
from shinymud.lib.world import World
from shinymud.models import Model, Column, model_list
from shinymud.models.shiny_types import *
from shinymud.models.item_types import ITEM_TYPES
from shinymud.models import Model, Column, model_list
from shinymud.models.shiny_types import *
from shinymud.data.config import CURRENCY... | shinymud/ShinyMUD | src/shinymud/models/npc_ai_packs.py | Python | mit | 18,537 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import unittest, frappe
from frappe.utils import flt
from erpnext.accounts.utils import get_actual_expense, BudgetError, get_fiscal_year
from erpnext.ex... | aruizramon/alec_erpnext | erpnext/accounts/doctype/journal_entry/test_journal_entry.py | Python | agpl-3.0 | 9,838 |
from time import time
import sys as s
import re
import subprocess as sb
import numpy as np
import array
integer = re.compile("[0-9]+")
#Returns the pair (identifier of patient a.k.a. @filename,list of identifiers of sequences matching a read in this patient)
def parseMatch(filename,i):
number = int(sb.check_outpu... | kuredatan/taxocluster | parsingMatch.py | Python | mit | 1,859 |
# -*- 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... | camptocamp/ngo-addons-backport | addons/stock/stock.py | Python | agpl-3.0 | 168,440 |
import os
import platform
from twisted.internet import defer
from .. import data, helper
from p2pool.util import pack
P2P_PREFIX = 'fbc0b6db'.decode('hex') #pchmessagestart
P2P_PORT = 52112
ADDRESS_VERSION = 23 #pubkey_address
RPC_PORT = 52111
RPC_CHECK = defer.inlineCallbacks(lambda bitcoind: defer.returnValue(
... | ptcrypto/p2pool-adaptive | p2pool/bitcoin/networks/aliencoin.py | Python | gpl-3.0 | 1,202 |
from django import forms
from django.utils.dateparse import parse_date, parse_datetime, parse_time
def deserialize_by_field(value, field):
"""
Some types get serialized to JSON, as strings.
If we know what they are supposed to be, we can deserialize them
"""
if isinstance(field, forms.DateTimeFiel... | CTPUG/wafer | wafer/kv/utils.py | Python | isc | 537 |
"""Helpers to execute scripts."""
import asyncio
from datetime import datetime, timedelta
from functools import partial
import itertools
import logging
from types import MappingProxyType
from typing import (
Any,
Callable,
Dict,
List,
Optional,
Sequence,
Set,
Tuple,
Union,
cast,
... | sdague/home-assistant | homeassistant/helpers/script.py | Python | apache-2.0 | 38,558 |
# -*- coding: utf-8 -*-
# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class QualityCheck(Document):
pass
| VisheshHanda/production_backup | erpnext/stock/doctype/quality_check/quality_check.py | Python | gpl-3.0 | 278 |
#!/usr/bin/python
# File Name: StartConveyor.py
# Author: Saad Qazi
# Date: 2017/3/30
#
# Description: this python script will run the stepper motor contiuosly until
# an object is detected by the PIR motion sensor. Once an object is
# detected the conveyor belt will stop ie the st... | saadq12/saadq12.github.io | raspberrypi_scripts/StartConveyor.py | Python | lgpl-3.0 | 2,290 |
#pragma repy restrictions.fewevents
# More than two events are not allowed:
# This tests that two (of two allowed) events can be consumed after
# the 'initialize' event ends (that is, it ending should free up an
# event).
def bar():
sleep(0.5)
def foo():
settimer(0,bar,[])
sleep(0.1)
if callfunc == 'initia... | sburnett/seattle | repy/tests/ut_repytests_fewevents-justenoughevents.py | Python | mit | 348 |
import re
USE_RAW_PREFIX = "regexp:"
def regexify(pattern):
"""
Normalize the wildcard pattern into a valid regex, or just strip prefix if the prefix matches USE_RAW_PREFIX
:param pattern:
:return:
"""
if pattern.strip().startswith(USE_RAW_PREFIX):
# Use raw
return pattern[le... | anchore/anchore-engine | anchore_engine/util/matcher.py | Python | apache-2.0 | 866 |
# Copyright (c) 2012 NetApp, Inc.
# Copyright (c) 2014 Red Hat, 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... | mahak/cinder | cinder/volume/drivers/remotefs.py | Python | apache-2.0 | 91,429 |
#
# 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... | nathanielvarona/airflow | airflow/example_dags/example_branch_labels.py | Python | apache-2.0 | 1,697 |
""" Tests for the api_admin app's views. """
import json
import ddt
import httpretty
from django.conf import settings
from django.core.urlresolvers import reverse
from django.test import TestCase
from django.test.utils import override_settings
from oauth2_provider.models import get_application_model
from openedx.cor... | fintech-circle/edx-platform | openedx/core/djangoapps/api_admin/tests/test_views.py | Python | agpl-3.0 | 16,144 |
from rest_framework.throttling import SimpleRateThrottle
from django.contrib.auth.models import User
class UserLoginRateThrottle(SimpleRateThrottle):
scope = 'auth'
def get_cache_key(self, request, view):
user = User.objects.filter(username=request.data.get('username'))
ident = user[0].pk if ... | gaiaresources/biosys | biosys/apps/main/api/throttling.py | Python | apache-2.0 | 462 |
# -*- coding: utf-8 -*-
# Copyright (c) 2013-2015 CoNWeT Lab., Universidad Politécnica de Madrid
# This file is part of Wirecloud.
# Wirecloud is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either v... | rockneurotiko/wirecloud | src/wirecloud/oauth2provider/plugins.py | Python | agpl-3.0 | 1,710 |
from flask import Flask, abort
from flask.ext import restful
from flask.ext.restful import reqparse
import requests
import json
from common.puppetdb import PuppetDB
from common.fab import Fabber
class HbaseCompactResultsAPI(restful.Resource):
def __init__(self):
self.parser = reqparse.RequestParser()
... | nerd0/operator | resources/hbase.py | Python | mit | 1,288 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('django_comments', '__first__'),
]
operations = [
migrations.CreateModel(
name='FluentComment',
field... | steventimberman/masterDebater | venv/lib/python2.7/site-packages/fluent_comments/migrations/0001_initial.py | Python | mit | 506 |
#!/usr/bin/python
##########################################################
# * Python code for Driving a Stepper Motor Card using
# * Beaglebone Black running Debian 7 Linux distribution
##########################################################
import sys
import time
import select
from stepperpins impor... | souravsingh/beaglebone-codes | 09stepper_python/stepper.py | Python | apache-2.0 | 2,749 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.