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 |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
""" Validators for wx widgets.
Copyright (c) Karol Będkowski, 2006-2013
This file is part of wxGTD
This 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.
"""
__author... | KarolBedkowski/wxgtd | wxgtd/wxtools/validators/__init__.py | Python | gpl-2.0 | 638 |
##########################################################################
#
# Copyright (c) 2011, John Haddon. All rights reserved.
# Copyright (c) 2013, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that ... | cedriclaunay/gaffer | python/Gaffer/UndoContext.py | Python | bsd-3-clause | 2,289 |
#!/usr/bin/env python
#
# Raspberry Pi Garage door controller
# Main controller software
# $Id: ggpiod.py,v 1.2 2014/06/18 17:07:36 bob Exp $
#
# Author : Bob Rathbone
# Site : http://www.bobrathbone.com
#
# This interprets and executes garage door commands
#
# License: GNU V3, See https://www.gnu.org/copyleft/gpl.... | bobrathbone/ggpiod | cgi-bin/ggpiod.py | Python | gpl-3.0 | 6,261 |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import os
linhas = open('/Users/lflrocha/Desktop/t_voz_transcricao.txt','r').readlines()
saida = open('/Users/lflrocha/Desktop/t_voz_transcricao2.txt','w')
conteudo = {}
linhas = linhas.replace('\n',' ')
linhas = linhas.replace('<br> ','\n... | lflrocha/ebc.scripts | conteudos/tiraQuebraLinha.py | Python | unlicense | 581 |
import os, sys, subprocess, time, datetime
from neuralfingerprint import (build_morgan_deep_net, build_conv_deep_net,
normalize_array, adam, build_batched_grad,
mean_squared_error, binary_classification_nll,
load_data_slices, ... | HIPS/neural-fingerprint | experiment_scripts/eval_methods.py | Python | mit | 6,419 |
#!/usr/bin/env python
'''
Run brat using the built-in Python CGI server for testing purposes.
Author: Pontus Stenetorp <pontus stenetorp se>
Version: 2012-07-01
'''
from BaseHTTPServer import HTTPServer, test as simple_http_server_test
from CGIHTTPServer import CGIHTTPRequestHandler
# Note: It is a terribl... | wolfe-pack/moro | public/javascripts/brat/testserver.py | Python | bsd-2-clause | 2,109 |
# -*- coding: utf-8 -*-
from __future__ import with_statement
PUBLIC_APPIDS = '''
smartladder8|sandaojushi3|ftencentuck|baidufirefoxtieba|chromeichi|aitaiyokani|smartladder3|mzmzmz001|smartladder4|chrome360q|smartladder6|goagent-dup001|kawaiiushioplus|smartladdercanada|gongongid02|goagent-dup003|goagent-dup002|gon... | ivyswen/gargoyle | package/base-files/files/etc/wallproxy/src.zip/make_config.py | Python | gpl-2.0 | 34,828 |
from .. import api
from .. import mysql
| modulo-/knoydart | api/api_0/apiRequest/__init__.py | Python | apache-2.0 | 40 |
from django.contrib import admin
from partners.models import Partners
# Register your models here.
admin.site.register(Partners) | zqsun/Buybuybiz_pinax | partners/admin.py | Python | mit | 128 |
"""Extended file operations available in POSIX.
f = posixfile.open(filename, [mode, [bufsize]])
will create a new posixfile object
f = posixfile.fileopen(fileobject)
will create a posixfile object from a builtin file object
f.file()
will return the original builtin file object
f.dup()
will r... | huran2014/huran.github.io | wot_gateway/usr/lib/python2.7/posixfile.py | Python | gpl-2.0 | 8,003 |
# Copyright 2013 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 a... | maheshp/novatest | nova/tests/api/openstack/compute/contrib/test_evacuate.py | Python | apache-2.0 | 5,920 |
from queue import Queue
from bears.python.PEP8Bear import PEP8Bear
from tests.LocalBearTestHelper import LocalBearTestHelper
from coalib.settings.Section import Section
from coalib.settings.Setting import Setting
class PEP8BearTest(LocalBearTestHelper):
def setUp(self):
self.section = Section('name')
... | sims1253/coala-bears | tests/python/PEP8BearTest.py | Python | agpl-3.0 | 1,722 |
#!/bin/python
"""
4.6 Write a program to prompt the user for hours and rate per hour using
raw_input to compute gross pay. Award time-and-a-half for the hourly
rate for all hours worked above 40 hours. Put the logic to do the
computation of time-and-a-half in a function called computepay() and use
the function to do t... | Shashaankar/C_programs | src/Python/coursera/ass_4_6.py | Python | gpl-2.0 | 1,145 |
# Resource object code
#
# Created: Fri Jan 6 09:39:04 2006
# by: The Resource Compiler for PyQt (Qt v4.1.0)
#
# WARNING! All changes made in this file will be lost!
from PySide import QtCore
qt_resource_data = "\
\x00\x00\x03\x4c\
\x3c\
\xb8\x64\x18\xca\xef\x9c\x95\xcd\x21\x1c\xbf\x60\xa1\xbd\xdd\x42\
\x00\x00\... | Southpaw-TACTIC/Team | src/python/Lib/site-packages/PySide/examples/tools/i18n/i18n_rc.py | Python | epl-1.0 | 48,776 |
#
# Copyright (C) 2012-2013 Stanislav Bohm
#
# This file is part of Kaira.
#
# Kaira 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 3 of the License, or
# (at your option) any later ... | Palasekm/Kaira | gui/runinstance.py | Python | gpl-3.0 | 15,134 |
# Copyright (C) 2014, Red Hat, 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... | silenceli/nova | nova/tests/unit/objects/test_virtual_interface.py | Python | apache-2.0 | 4,623 |
###############################################################################
##
## Copyright (C) 2014-2016, New York University.
## Copyright (C) 2011-2014, NYU-Poly.
## Copyright (C) 2006-2011, University of Utah.
## All rights reserved.
## Contact: contact@vistrails.org
##
## This file is part of VisTrails.
##
## ... | VisTrails/VisTrails | vistrails/db/versions/v0_9_5/persistence/xml/auto_gen.py | Python | bsd-3-clause | 80,893 |
############# ############# ############# ############# #############
# precomputeIDF
# by JAG3
# maintained by JAG3 and ekimbrel
# v1.0 - precompute IDF vectors for a dataset(s)
#
############# ############# ############# ############# #############
from pyspark import SparkConf, SparkContext
from pyspark.sql import ... | Sotera/GEQE | geqe-ml/precomputeIDF.py | Python | unlicense | 3,753 |
# Copyright (c) 2006-2008 Mitch Garnaat http://garnaat.org/
#
# 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, modi... | carlgao/lenga | images/lenny64-peon/usr/share/python-support/python-boto/boto/ec2/zone.py | Python | mit | 1,667 |
"""
Django settings for learn_models project.
Generated by 'django-admin startproject' using Django 1.9.1.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import ... | lichengshuang/createvhost | python/others/django/learn_models/learn_models/settings.py | Python | apache-2.0 | 3,211 |
import hashlib
import hmac
from time import time
from typing import Dict, Optional, Union
class Clock:
@staticmethod
def now() -> float:
return time()
class SignatureVerifier:
def __init__(self, signing_secret: str, clock: Clock = Clock()):
"""Slack request signature verifier
Sl... | slackhq/python-slackclient | slack/signature/verifier.py | Python | mit | 2,373 |
"""templates.unix.ui.Shutdown Module"""
import cairn
from cairn import Options
def getClass():
return Shutdown()
class Shutdown(object):
def run(self, sysdef):
if Options.get("no-ui") or Options.get("ui") == "none":
return True
elif Options.get("ui") == "curses":
sysdef.moduleList.insertAfterMe("u... | redshodan/cairn | src/python/cairn/sysdefs/templates/unix/ui/Shutdown.py | Python | gpl-2.0 | 354 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# wf-api-client documentation build configuration file, created by
# sphinx-quickstart on Wed Jun 3 13:38:22 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in thi... | davidjcox/wf-api-client | wf-api-client/docs/conf.py | Python | bsd-3-clause | 11,287 |
# Copyright 2015 Rémy Lapeyrade <remy at lapeyrade dot net>
# Copyright 2015 LAAS-CNRS
#
#
# This file is part of TouSIX-Manager.
#
# TouSIX-Manager 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 Founda... | Baloc/TouSIX-Manager | tousix_manager/Rules_Generation/manager.py | Python | gpl-3.0 | 3,739 |
# -*- coding: UTF-8 -*-
# YaBlog
# (c) Regis FLORET
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the fol... | regisf/yablog | blog/templatetags/__init__.py | Python | bsd-3-clause | 1,525 |
##
# This file is part of Overkill-writers.
#
# Overkill-writers 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.
#
# ... | Stebalien/overkill-writers | overkill/extra/writers.py | Python | gpl-3.0 | 1,232 |
#
# 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... | holdenk/spark | python/pyspark/rdd.py | Python | apache-2.0 | 109,178 |
from django.test import RequestFactory
from test_plus.test import TestCase
from ..views import (
UserRedirectView,
UserUpdateView
)
class BaseUserTestCase(TestCase):
def setUp(self):
self.user = self.make_user()
self.factory = RequestFactory()
class TestUserRedirectView(BaseUserTestCa... | HandyCodeJob/hcj-django-temp | {{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/users/tests/test_views.py | Python | bsd-3-clause | 1,876 |
"""Signomial, Posynomial, Monomial, Constraint, & MonoEQCOnstraint classes"""
from collections import defaultdict
import numpy as np
from .core import Nomial
from .array import NomialArray
from .. import units
from ..constraints import SingleEquationConstraint
from ..globals import SignomialsEnabled
from ..small_classe... | hoburg/gpkit | gpkit/nomials/math.py | Python | mit | 26,707 |
# region gplv3preamble
# The Medical Simulation Markup Language (MSML) - Simplifying the biomechanical modeling workflow
#
# MSML has been developed in the framework of 'SFB TRR 125 Cognition-Guided Surgery'
#
# If you use this software in academic work, please cite the paper:
# S. Suwelack, M. Stoll, S. Schalck, N.S... | CognitionGuidedSurgery/msml | src/msmllab/__init__.py | Python | gpl-3.0 | 1,332 |
from django.conf.urls import url, include
from core.views import views
urlpatterns = [
url(r'^$', views.index, name='index'),
url(
r'^projects/',
include('core.urlincludes.projects')
),
url(
r'^experiments/',
include('core.urlincludes.experiments')
),
url(
r'^samples/',
include('core.urlincludes.samp... | slohr/paperlims | paperlims/core/urls.py | Python | mit | 402 |
"""
Print elements of a linked list in reverse order as standard output
head could be None as well for empty list
Node is defined as
class Node(object):
def __init__(self, data=None, next_node=None):
self.data = data
self.next = next_node
"""
def Reverse(head):
if head:
l = []
... | spradeepv/dive-into-python | hackerrank/domain/data_structures/linked_lists/print_in_reverse.py | Python | mit | 822 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib
import re
import urlparse
class LanguageStripper(object):
def __init__(self, languages=None, strip_query_variables=False):
self._strip_query_variables = []
if strip_query_variables:
self._strip_query_variables = [
... | ModernMT/DataCollection | baseline/languagestripper.py | Python | apache-2.0 | 9,168 |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# 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... | Akrog/cinder | cinder/tests/test_test.py | Python | apache-2.0 | 1,578 |
import math
ceil = lambda f: int(math.ceil(f))
from gi.repository import GObject
from gi.repository import Gtk
from gi.repository import Gdk
import cairo
from gi.repository import Pango
from gi.repository import PangoCairo
line = 10
curve = 60
dotSmall = 14
dotLarge = 24
lineprc = 1/7.
hpadding = 5
vpadding = 3
cla... | Aleks31/pychess | lib/pychess/widgets/SpotGraph.py | Python | gpl-3.0 | 18,644 |
# $Id$
#
from inc_cfg import *
ADD_PARAM = ""
if (HAS_SND_DEV == 0):
ADD_PARAM += "--null-audio"
# Call with Speex/8000 codec
test_param = TestParam(
"PESQ codec Speex NB",
[
InstanceParam("UA1", ADD_PARAM + " --max-calls=1 --add-codec speex/8000 --clock-rate 8000 --play-file wavs/input.8.wav"),
InstanceP... | Jopie64/pjsip | tests/pjsua/scripts-pesq/200_codec_speex_8000.py | Python | gpl-2.0 | 478 |
""" History related magics and functionality """
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
import atexit
import datetime
import os
import re
try:
import sqlite3
except ImportError:
try:
from pysqlite2 import dbapi2 as sqlite3
except Impor... | unnikrishnankgs/va | venv/lib/python3.5/site-packages/IPython/core/history.py | Python | bsd-2-clause | 32,904 |
import rclpy
from rcl_interfaces.msg import ParameterDescriptor
from rclpy.node import Node
from rclpy.qos import QoSProfile
from std_msgs.msg import String
class Listener(Node):
def __init__(self):
super().__init__("listener")
parameter = self.declare_parameter(
"exit_after_receive",... | chipaca/snapcraft | tests/spread/plugins/v1/colcon/snaps/colcon-talker-listener/src/listener_py/listener.py | Python | gpl-3.0 | 1,184 |
"""
"""
from abc import ABCMeta, abstractproperty, abstractmethod
from fractions import Fraction
from itertools import groupby
from operator import add, attrgetter, mul
from grendel import type_checking_enabled, sanity_checking_enabled
import string
import math
from grendel.gmath.tensor import Tensor
from grendel.util... | spring01/libPSI | lib/python/grendel/differentiation/finite_difference.py | Python | gpl-2.0 | 20,260 |
#(C) Copyright Syd Logan 2016-2019
#(C) Copyright Thousand Smiles Foundation 2016-2019
#
#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 req... | slogan621/tscharts | patient/views.py | Python | apache-2.0 | 14,344 |
from priorityqueueset import PriorityQueueSet
class PathFinder(object):
""" Computes a path in a graph using the A* algorithm.
Initialize the object and then repeatedly compute_path to
get the path between a start point and an end point.
The points on a graph are required to... | xzmagic/code-for-blog | 2009/pygame_creeps_game/pathfinder.py | Python | unlicense | 5,242 |
'''
A condition
'''
from compares.const import register_compare, Const as const
from compares.simple import Exact
from collections import OrderedDict
from inspect import isclass, ismethod
calldict = {}
class Stack(const):
def stack_add(self, cb, cbargs):
'''
Pass the values of which would be pro... | Strangemother/python-state-machine | scatter/conditions.py | Python | mit | 10,942 |
import copy
import tempfile
import xmlsec
from tests import base
consts = xmlsec.constants
class TestKeys(base.TestMemoryLeaks):
def test_key_from_memory(self):
key = xmlsec.Key.from_memory(self.load("rsakey.pem"), format=consts.KeyDataFormatPem)
self.assertIsNotNone(key)
def test_key_from_... | mehcode/python-xmlsec | tests/test_keys.py | Python | mit | 10,026 |
## NIFTY (Numerical Information Field Theory) has been developed at the
## Max-Planck-Institute for Astrophysics.
##
## Copyright (C) 2014 Max-Planck-Society
##
## Author: Maksim Greiner, Marco Selig
## Project homepage: <http://www.mpa-garching.mpg.de/ift/nifty/>
##
## This program is free software: you can redistribu... | ultimanet/nifty | lm/nifty_power_conversion_lm.py | Python | gpl-3.0 | 5,320 |
#!/usr/bin/env/python
# _*_ coding:utf-8_*_
from handlers.ExceptionHandler import ExceptionHandler
def process_message(twitter_api, telegram_message):
try:
# TODO: Remove the user from somewhere
# user_id = telegram_message.message.message_from.id
user_first_name = telegram_message.messag... | CorunaDevelopers/teleTweetBot | teleTweetBot/commands/StopCommand.py | Python | gpl-3.0 | 487 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as 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 'Product.structure'
db.add_column(u'catalogue_product', 's... | jinnykoo/christmas | src/oscar/apps/catalogue/south_migrations/0025_auto__add_field_product_structure.py | Python | bsd-3-clause | 11,627 |
from time import sleep
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
ControlPin = [7,8,9,10]
seq = [ [1,0,0,0],
[1,1,0,0],
[0,1,0,0],
[0,1,1,0],
[0,0,1,0],
[0,0,1,1],
[0,0,0,1],
[1,0,0,1]]
def init():
GPIO.setwarnings(False)
for pin in ControlPin:
... | gilesp/quickdrawmcgraw | obsolete/stepper_old.py | Python | mit | 1,024 |
#!/usr/bin/python
# -*- coding:UTF-8 -*-
################################################################################
#
# Copyright 2010-2014 Carlos Ramisch, Vitor De Araujo, Silvio Ricardo Cordeiro,
# Sandra Castellanos
#
# xml2arff.py is part of mwetoolkit
#
# mwetoolkit is free software: you can redistribute it... | KWARC/mwetoolkit | bin/old/xml2arff.py | Python | gpl-3.0 | 3,443 |
#!/usr/bin/env python3
from knc import device
boards = device.open_boards()
print(boards[0].get_status()) | mborodin/pyknc | examples/get_status.py | Python | gpl-2.0 | 107 |
import json
import random
import uuid
import codecs
PRIOR = 0.4
MATCH_ITEMS = ['personAge', 'hairColor', 'eyeColor', 'name']
MATCHPROBS = {}
TOTALS = {}
RELATIVE_FREQS = {}
class EntityClusterer(object):
def __init__(self):
global PRIOR
## PROBABILITY TABLES
global MATCH_ITEMS
glo... | usc-isi-i2/dig-entity-clustering | src/clustering/EntityClusterer.py | Python | gpl-2.0 | 11,885 |
#David Sanchez Pinsach
#Alex Pardo Fernandez
#Script to download demonyms from Wikipedia and to show the histogram of the
import rules as r
import wpDownload as wp
FILENAME = 'demonyms.csv'
skipIrregulars = True
quiet = True
th = 1
wp.download(FILENAME, skipIrregulars)
r.showHistogram(FILENAME, th, quiet) | alex-pardo/ANLP-PROJECT | main.py | Python | apache-2.0 | 310 |
import os, sys; sys.path.insert(0, os.path.join("..", ".."))
import unittest
import time
import re
import random
from pattern import search
from pattern.en import Sentence, parse
#---------------------------------------------------------------------------------------------------
class TestUtilityFunctions(unittes... | piskvorky/pattern | test/test_search.py | Python | bsd-3-clause | 24,100 |
# Copyright 2017 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... | chemelnucfin/tensorflow | tensorflow/contrib/summary/summary.py | Python | apache-2.0 | 3,803 |
################################################################################
# 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... | rmetzger/flink | flink-python/pyflink/table/statement_set.py | Python | apache-2.0 | 3,677 |
from math import *
import random
"""
Representation: Permutation of {0..n-1}
Parenthood Selection: Ternary tournament (3 individuals)
Mutation: Random swap of two indices
Crossover: Order crossover
Survival Selection: Replace single worst entity with new one
Fitness: Cost of the cycle I_0 I_1 .. I_n I_0 for an individ... | 5outh/evolve | tsp.py | Python | mit | 3,712 |
class StartAt:
""" Represents the Start At CLI parameter """
def check(self, context):
""" Return if this CLI should be used """
return context.config.startAt is not None
def build(self, context):
""" Return the string parameters to add to the command string "... | cloew/Kaovert | kaovert/conversion/hbclis/start_at.py | Python | mit | 377 |
# -*- coding: utf-8 -*-
import pytest
import sys
import random
from .test_base_class import TestBaseClass
from aerospike import exception as e
aerospike = pytest.importorskip("aerospike")
try:
import aerospike
except:
print("Please install aerospike python client.")
sys.exit(1)
class TestListPopRange(obj... | aerospike/aerospike-client-python | test/new_tests/test_list_pop_range.py | Python | apache-2.0 | 7,305 |
# Copyright (c) 2018 China Telecom Corporation
# 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
#
# Un... | openstack/python-openstackclient | openstackclient/tests/unit/network/v2/test_floating_ip_port_forwarding.py | Python | apache-2.0 | 17,923 |
# Copyright (c) 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import unittest
from tracing.mre import threaded_work_queue
class ThreadedWorkQueueTests(unittest.TestCase):
def testSingleThreaded(self):
wq = ... | benschmaus/catapult | tracing/tracing/mre/threaded_work_queue_unittest.py | Python | bsd-3-clause | 843 |
# Copyright 2011 OpenStack LLC.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | citrix-openstack-build/cinder | cinder/tests/api/contrib/test_types_manage.py | Python | apache-2.0 | 4,194 |
import shlex
from typing import Callable
def cmp_to_key(comparator: Callable):
class KeyCmpWrapper:
def __init__(self, obj, *args):
self.obj = obj
def __lt__(self, other):
return comparator(self.obj, other.obj) < 0
def __gt__(self, other):
return compa... | abacusresearch/gitflow | gitflow/utils.py | Python | mit | 2,073 |
# -*- coding: utf-8 -*-
from xmlrpclib import Fault
from django.contrib.auth.models import User
from django.test import TestCase
from tcms.xmlrpc.api import build
from tcms.xmlrpc.tests.utils import make_http_request
class AssertMessage(object):
NOT_VALIDATE_ARGS = "Missing validations for args."
NOT_VALIDA... | ShaolongHu/Nitrate | tcms/xmlrpc/tests/test_testbuild.py | Python | gpl-2.0 | 17,281 |
import pprint
import sys
import os
import unittest
from DictDiffer import DictDiffer;
if os.path.exists("./jiraclient/"):
sys.path.insert(0,"./jiraclient/")
import jiraclient
pp = pprint.PrettyPrinter(depth=4,stream=sys.stdout)
class TestUnit(unittest.TestCase):
def setUp(self):
self.c = jiraclient.Jiracl... | mcallaway/jiraclient | test/testTemplate.py | Python | gpl-3.0 | 4,858 |
#!/usr/bin/python
#
# ----------------------------------------------------------------------------------------------------
#
# Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute... | kevinmcain/graal | mxtool/mx.py | Python | gpl-2.0 | 148,173 |
# Copyright (C) 2022 Lunatixz
#
#
# This file is part of PseudoTV Live.
#
# PseudoTV Live 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 vers... | PseudoTV/PseudoTV_Live | plugin.video.pseudotv.live/resources/lib/fillers.py | Python | gpl-3.0 | 14,573 |
class ComplexClause(object):
type_string = ''
def __init__(self, *args):
self.clauses = args
self.add_prefix(self.type_string)
def is_matrix(self):
for c in self.clauses:
if not c.is_matrix():
return False
return True
def involves(self, an... | PhonologicalCorpusTools/PolyglotDB | polyglotdb/query/base/complex.py | Python | mit | 2,772 |
#!/usr/bin/env python
import rospy
import math
from nav_msgs.msg import Odometry
from geometry_msgs.msg import Twist
odom1 = None
def callbacallback_odom1(odom):
global odom1
odom1 = odom
"""
Estimate the friction force
"""
def listener():
global pub1, pub2, pub3
rospy.init_node('ramping', anony... | dsaldana/gmodrotor | gmodrotor_control/scripts/test_friction.py | Python | gpl-3.0 | 1,252 |
config = {
"pretty-name": "Short-Piesome",
"server-host": "0.0.0.0",
"server-port": 8080,
"server": "wsgiref",
"base-url": "http://localhost:8080/",
"backend": {
"name": "redis",
"host": "localhost",
"port": 6379
},
"hashids-salt": "E1pVf785RbBNftdy8xwdtTWcvlAu7R3... | JuhaniImberg/short-piesome | short/config.py | Python | mit | 455 |
#!/usr/bin/env python
import random
import sys
import drinks.manual_db
# MUST MAP TO ORDER OF PHYSICAL VALVES
INGREDIENTS_ORDERED = (
"angostura bitters",
"lime juice",
"lemon juice",
"grenadine", # brown bottle dark liquid
"agave syrup", # clear bottle amber liquid
"simple syrup",
"kahl... | markstev/nebree8 | config/ingredients.py | Python | gpl-2.0 | 435 |
def settings(dictionary):
with open('data/settings.json') as data_file:
settingsjsonold = json.load(data_file)
settingsjsonnew = {}
answerwrong = True
while answerwrong:
settingsanswer = input('Run Settingsprogramm? (yes/no/exit)')
if settingsanswer == "exit":
sys.exi... | kingrodriguez/oni-optimizer | settings.py | Python | gpl-3.0 | 1,579 |
#!/usr/bin/env python
# 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
# "Li... | jasonz93/python-tordatahub | setup.py | Python | apache-2.0 | 2,165 |
from . import TweetAdapter
from ttp import ttp
import re
def breakMessage(messageToBreak, tweetId, userId, userDataStrategy):
if len(messageToBreak) <= 140:
return [ messageToBreak ]
username = TweetAdapter.getUsernameForTweet(tweetId, userId, userDataStrategy)
splitMessageList = []
urls = getUr... | kiriappeee/reply-later | src/core/messager/MessageBreaker.py | Python | mit | 2,071 |
# QTLAB class for remote access of an TIP temperature control server version 2,
# Author: HR @ KIT 2019-
import time
import types
from numpy import arange, size, linspace, sqrt, ones, delete, append, argmin, array, abs
import logging
import zmq
import json
import qkit
from qkit.core.instrument_base import Instrument
... | qkitgroup/qkit | qkit/drivers/tip2_client.py | Python | gpl-2.0 | 10,763 |
# 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 may ... | Azure/azure-sdk-for-python | sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/aio/_container_service_client.py | Python | mit | 4,623 |
"""Synchronization primitives."""
__all__ = ('Lock', 'Event', 'Condition', 'Semaphore', 'BoundedSemaphore')
import collections
import warnings
from . import events
from . import futures
from .coroutines import coroutine
class _ContextManager:
"""Context manager.
This enables the following idiom for acquir... | FFMG/myoddweb.piger | monitor/api/python/Python-3.7.2/Lib/asyncio/locks.py | Python | gpl-2.0 | 15,913 |
from gunviolence import app
import argparse
import os
import sys
def main():
# app.run(debug=True)
port = int(os.environ.get("PORT", 33507))
app.run(debug=True, host='0.0.0.0', port=port, passthrough_errors=False)
def parse_args():
parser = argparse.ArgumentParser(description="Chicago_Data")
parse... | afenichel/ENGI4800-CAPSTONE | runserver.py | Python | apache-2.0 | 985 |
#! /usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2013 Simone F. <groppo8@gmail.com>
#
# This file is part of wikipedia-tags-in-osm.
# wikipedia-tags-in-osm 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 Foun... | simone-f/wikipedia-tags-in-osm | launch_script.py | Python | gpl-3.0 | 32,261 |
# Copyright 2017 Tonis Piip, Rumma & Ko Ltd
#
# License: GNU Affero General Public License v3 (see file COPYING for details)
"""Adds a radicale caldav server to the application.
Requires radicale to be installed.
.. autosummary::
:toctree:
views
"""
import logging
from lino import ad
from django.utils.t... | lino-framework/xl | lino_xl/lib/caldav/__init__.py | Python | bsd-2-clause | 3,354 |
# Copyright 2013 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 ... | jonnary/keystone | keystone/tests/unit/test_config.py | Python | apache-2.0 | 3,118 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 OpenStack Foundation
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Versio... | shhui/horizon | openstack_dashboard/dashboards/admin/auditlog/views.py | Python | apache-2.0 | 12,068 |
mapping = {
'cannot_access_config_file': 1,
'invalid_yaml_file': 2,
'excluded_paths_must_be_a_list': 3,
'string_failed_to_expand': 4,
'no_paths_configured': 5,
'file_not_found': 6,
'type_path_collision': 7,
'to_file_requires_explicit_path': 8,
'validate_before_must_be_boolean': 9,
... | cloudify-cosmo/packman | packman/codes.py | Python | apache-2.0 | 1,434 |
from __future__ import print_function
import websocket
if __name__ == "__main__":
websocket.enableTrace(True)
ws = websocket.create_connection("ws://nasutoma-here.cgfm.jp:8000/demo")
# ws = websocket.create_connection("ws://nasutoma-here.cgfm.jp:8000", http_proxy_port=8000)
print("Sending 'Hello, World'... | Garyuten/nasutoma_switch | examples/echo_client.py | Python | mit | 472 |
"""Tests for distutils.command.install_scripts."""
import os
import unittest
from distutils.command.install_scripts import install_scripts
from distutils.core import Distribution
from distutils.tests import support
from test.test_support import run_unittest
class InstallScriptsTestCase(support.TempdirManager,
... | gusai-francelabs/datafari | windows/python/Lib/distutils/tests/test_install_scripts.py | Python | apache-2.0 | 2,630 |
#!/usr/bin/env python
"""import_sample_data.py - script for importing sample data"""
from collectionbatchtool import *
apply_user_settings('settings.cfg') # change to your own config-file!
agt = AgentDataset()
agt.from_csv('agent_sample.csv', quiet=False)
agt.to_database(defaults={'agenttype': 1}, quiet=False)
lo... | jmenglund/CollectionBatchTool | docs/source/_static/import_sample_data.py | Python | mit | 1,322 |
#!/usr/bin/env python3
# The MIT License (MIT)
# Copyright (c) 2016 Michael Sasser <Michael.Sasser@Real-Instruments.de>
#
# 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... | Real-Instruments/fflib | fflib/peer.py | Python | agpl-3.0 | 26,829 |
import pytest
from citrination_client.models.columns import *
from citrination_client.base.errors import *
class TestCategoricalColumn(object):
@classmethod
def setup_class(self):
self.name = "Property Band gap"
self.role = "Input"
self.group_by_key = False
self.units = "eV"
... | CitrineInformatics/python-citrination-client | citrination_client/models/columns/tests/test_categorical.py | Python | apache-2.0 | 1,707 |
import contextlib
from decimal import Decimal
import importlib
import unittest
from dependency_injector.wiring import (
wire,
Provide,
Provider,
Closing,
register_loader_containers,
unregister_loader_containers,
)
from dependency_injector import errors
# Runtime import to avoid syntax errors i... | rmk135/objects | tests/unit/wiring/test_wiring_py36.py | Python | bsd-3-clause | 15,706 |
"""
Cartoon+texture IPOL demo web app
"""
from .app import app
| juan-cardelino/matlab_demos | ipol_demo-light-1025b85/app_available/103/__init__.py | Python | gpl-2.0 | 64 |
import ast
from taichi.lang.exception import TaichiSyntaxError
from taichi.lang.shell import oinspect
class KernelSimplicityASTChecker(ast.NodeVisitor):
class ScopeGuard:
def __init__(self, checker):
self.c = checker
self._allows_for_loop = True
self._allows_more_stmt ... | yuanming-hu/taichi | python/taichi/lang/ast/checkers.py | Python | mit | 3,791 |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: t -*-
# vi: set ft=python sts=4 ts=4 sw=4 noet :
# This file is part of Fail2Ban.
#
# Fail2Ban 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;... | ActualizeInMaterial/gentooskyline | system/Z575/OSes/gentoo/in_virtualbox/filesystem_now/gentoo/etc/fail2ban/action.d/smtp.py | Python | unlicense | 6,021 |
from fractions import Fraction
from typing import Tuple
from .base import list_to_number
Representation = Tuple[Tuple[int, int], Tuple[int, int]]
def unit_fraction_to_representation(denominator: int,
base: int=10) -> Representation:
return fraction_to_representation(Fractio... | cryvate/project-euler | project_euler/library/fraction_representation.py | Python | mit | 2,055 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from __future__ import print_function, unicode_literals
import os
import platform
import subprocess
import sys
from dis... | catchmrbharath/servo | python/mach_bootstrap.py | Python | mpl-2.0 | 7,079 |
""":mod:`asuka.services.wsgi` --- WSGI server
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
It supports the following servers through `Green Unicorn`_:
``sync`` (default)
It should handle most 'normal' types of workloads.
You'll want to read http://gunicorn.org/design.html for information
on when you might w... | crosspop/asuka | asuka/services/wsgi.py | Python | mit | 10,209 |
"""
145. Binary Tree Postorder Traversal
https://leetcode.com/problems/binary-tree-postorder-traversal/
"""
from typing import Optional
# Definition for a binary tree node.
class TreeNode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right... | pisskidney/leetcode | easy/145.py | Python | mit | 737 |
# coding=utf-8
from tkinter import *
import random
WIDTH = 800
HEIGHT = 600
BALL_RADIUS = 3
BALL_SPEED = 1
root = Tk()
root.title("Tkinter demo")
# область анимации
c = Canvas(root, width=WIDTH, height=HEIGHT, background="#ffffff")
c.pack()
mover = c.create_oval(WIDTH/2-BALL_RADIUS/2,
HEIGHT... | sejros/The-Nature-of-Python-Examples | introduction/0 Intro.py | Python | mit | 848 |
from __future__ import division
from __future__ import print_function
import os
import sys
import functools
# Update path
root = os.path.join(os.getcwd().split('proj1')[0], 'proj1')
if root not in sys.path:
sys.path.append(root)
import numpy as np
import pandas as pd
import multiprocessing
from pdb import set_tra... | rahlk/CSC579__Computer_Performance_Modeling | simulation/proj1/tasks/task5.py | Python | mit | 2,063 |
from collections import OrderedDict
from tasks.meta import OBSColumn
from tasks.base_tasks import ColumnsTask
class POIColumns(ColumnsTask):
def version(self):
return 3
def columns(self):
return OrderedDict([
('house_number', OBSColumn(type='Text',
... | CartoDB/bigmetadata | tasks/poi.py | Python | bsd-3-clause | 833 |
#--*-- coding:utf-8 --*--
'''
Created on 2015��5��20��
@author: stm
'''
from model.viosmachine import VIOSMachineRecord, IP_ID, NAME_ID, SN_ID, PHASE,\
DATA_COLS, PROGRESS, SEL_ID, IP_FOR_NIMINSTALL, IP_GW_FOR_NIMINSTALL
from utils import DebugLog
from base.msgcodec import MsgCodec
from base.cmdmsg impor... | xhan-shannon/SystemControlView | model/dataentity.py | Python | gpl-2.0 | 11,293 |
"""
Module Overview
---------------
Generic **views** the extend the Django REST Framework's generics to
easily integrate with Ember Data and the JSON API.
Let's discuss the some of the important design choices in this module.
JsonApiView
^^^^^^^^^^^
The ``JsonApiView`` derives from DRF's ``GenericAPIView``. It se... | symfonico/drf-ember | drf_ember/generics.py | Python | mit | 13,215 |
from tornado import web,ioloop
import os
from pymongo import *
class user_checkHandler(web.RequestHandler):
def get(self):
self.set_header("Access-Control-Allow-Origin", "*")
self.set_header("Access-Control-Allow-Headers", "x-requested-with")
self.set_header('Access-Control-Allow-Methods', 'POST, GET, OPTIONS'... | ezamlee/live-chat | registration.py | Python | gpl-3.0 | 825 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.