repo_name stringlengths 5 104 | path stringlengths 4 248 | content stringlengths 102 99.9k |
|---|---|---|
Comunitea/CMNT_004_15 | project-addons/custom_account/models/payment.py | # Copyright 2019 Omar Castiñeira, Comunitea Servicios Tecnológicos S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import models, fields, api
class PaymentOrderLine(models.Model):
_inherit = 'account.payment.line'
_order = 'partner_name'
partner_name = fields.Char(relate... |
pixelated/puppet-pixelated | files/functional-tests/page_objects/maillist_actions.py | #
# Copyright (c) 2015 ThoughtWorks, Inc.
#
# Pixelated 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 version 3 of the License, or
# (at your option) any later version.
#
# Pixelated is distrib... |
wger-project/wger | wger/weight/views.py | # -*- coding: utf-8 -*-
# This file is part of wger Workout Manager.
#
# wger Workout Manager 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 version 3 of the License, or
# (at your option) any ... |
sharbeldahlan/cv-generator | main.py | #!/usr/bin/env python3
import cherrypy
import weasyprint
from jinja2 import Template, FileSystemLoader, Environment
from base64 import b64encode
import os
import json
import random
import psycopg2
import base64
class App(object):
def __init__(self):
loader = FileSystemLoader('templates')
self.tem... |
p4u/projecte_frigos | client.py | #!/usr/bin/env python2.7
import sys
import connection as CN
import serial
import os
import time
import argparse
import logging
serial_device_basename = "/dev/ttyACM"
serial_device_init = 0
def set_log(logname):
logging.basicConfig(filename=logname,
filemode='a',
... |
jodal/comics | comics/comics/wulffmorgenthaler.py | from comics.aggregator.crawler import CrawlerBase, CrawlerImage
from comics.core.comic_data import ComicDataBase
class ComicData(ComicDataBase):
name = "Wumo"
language = "en"
url = "http://wumo.com/wumo/"
start_date = "2001-01-01"
rights = "Mikael Wulff & Anders Morgenthaler"
class Crawler(Crawl... |
PabloCastellano/libreborme | borme/tests/test_http.py | from django.core.management import call_command
from django.urls import reverse
from django.test.client import Client
from django.utils.six import StringIO
from django.conf import settings
from borme.models import Anuncio, Borme, Config, Company, Person
from django.test import TestCase
#from django.contrib.auth.model... |
Micronaet/micronaet-order | order_reminder/__openerp__.py | ###############################################################################
#
# Copyright (C) 2001-2014 Micronaet SRL (<http://www.micronaet.it>).
#
# This program 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 ... |
troyhirni/pyro | fs/csv.py | """
Copyright 2014-2017 Troy Hirni
This file is part of the pyrox project, distributed under
the terms of the GNU Affero General Public License.
CSV - File and Reader for CSV *** EXPERIMENTAL ***
CSV works pretty well, but has some quirks that need to be worked
out. Write doesn't work; csv has to be written a... |
amiv-eth/amivapi | amivapi/tests/events/test_model.py | # -*- coding: utf-8 -*-
#
# license: AGPLv3, see LICENSE for details. In addition we strongly encourage
# you to buy us beer if we meet and you like the software.
"""Test event model specific validators."""
import json
from amivapi.tests.utils import WebTestNoAuth
class EventModelTest(WebTestNoAuth):
... |
DemocracyClub/yournextrepresentative | ynr/apps/official_documents/migrations/0009_officialdocument_document_post.py | from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("popolo", "0002_update_models_from_upstream"),
("official_documents", "0008_set_default_election"),
]
operations = [
migrations.AddField(
model_name="officialdocument",
... |
OpusVL/odoo | addons/l10n_ca/__openerp__.py | # -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the G... |
acsone/mozaik | mozaik_base/__init__.py | # -*- coding: utf-8 -*-
##############################################################################
#
# This file is part of mozaik_base, an Odoo module.
#
# Copyright (c) 2015 ACSONE SA/NV (<http://acsone.eu>)
#
# mozaik_base is free software:
# you can redistribute it and/or
# modify it under t... |
taigaio/taiga-contrib-letschat | back/taiga_contrib_letschat/models.py | # Copyright (C) 2014-2017 Andrey Antukh <niwi@niwi.nz>
# Copyright (C) 2014-2017 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014-2017 David Barragán <bameda@dbarragan.com>
# Copyright (C) 2014-2017 Alejandro Alonso <alejandro.alonso@kaleidos.net>
# Copyright (C) 2014-2017 Andrea Stagi <stagi.andrea@gmail.com>
# ... |
CommonsDev/dataserver | dataserver/urls.py | from django.conf import settings
from django.conf.urls import patterns, include, url
from django.conf.urls.static import static
from django.contrib import admin
from tastypie.api import Api
from accounts.api import UserResource, GroupResource, ProfileResource, ObjectProfileLinkResource
# from alambic.api import RoomR... |
dibaunaumh/fcs-skateboard | fcs_aux/fconveys/actions/extract_metadata/extract_article_metadata.py | import logging
from schemato import Schemato
from schemato.distillery import ParselyDistiller, NewsDistiller
from mies.celery import app
@app.task(name='extract-article-metadata')
def extract_article_metadata_action(input_payload):
logging.info("Extracting article metadata")
logging.info(input_payload)
a... |
B-MOOC/edx-platform | cms/djangoapps/models/settings/course_details.py | import re
import logging
import datetime
import json
from json.encoder import JSONEncoder
from django.conf import settings
from opaque_keys.edx.locations import Location
from xmodule.modulestore.exceptions import ItemNotFoundError
from contentstore.utils import course_image_url, has_active_web_certificate
from models... |
FinalsClub/karmaworld | karmaworld/utils/ajax_utils.py | import json
from django.core.exceptions import ObjectDoesNotExist
from django.http import HttpResponseBadRequest, HttpResponseNotFound, HttpResponse
def format_session_increment_field(cls, id, field):
return cls.__name__ + '-' + field + '-' + str(id)
def ajax_base(request, event_processor, allowed_methods):
... |
DannyArends/genenetwork2 | scripts/maintenance/delete_phenotypes.py | import sys
import csv
import utilities
import datastructure
import phenotypes
def main(argv):
# config
config = utilities.get_config(argv[1])
print "config:"
for item in config.items('config'):
print "\t%s" % (str(item))
# var
print "variable:"
inbredsetid = config.get('config', 'i... |
gem/oq-engine | openquake/engine/export/__init__.py | # -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (C) 2010-2022 GEM Foundation
#
# OpenQuake 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 version 3 of the Licen... |
TsinghuaX/edx-platform | lms/envs/devstack.py | """
Specific overrides to the base prod settings to make development easier.
"""
from .aws import * # pylint: disable=wildcard-import, unused-wildcard-import
DEBUG = True
USE_I18N = True
TEMPLATE_DEBUG = True
# By default don't use a worker, execute tasks as if they were local functions
CELERY_ALWAYS_EAGER = True
#... |
lepistone/vertical-ngo | __unported__/logistic_requisition/tests/__init__.py | # -*- coding: utf-8 -*-
##############################################################################
#
# Author: Nicolas Bessi
# Copyright 2013 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# publi... |
rogerhil/cdpc | cdpc/main.py | # -*- coding: utf-8; Mode: Python -*-
#
# Copyright (C) 2010 Lincoln de Sousa <lincoln@comum.org>
# Copyright (C) 2010 Rogério Hilbert Lima <rogerhil@gmail.com>
#
# This program 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 ... |
ema/pycodicefiscale | tests.py | from __future__ import print_function
import unittest
import datetime
import locale
from codicefiscale import isvalid, get_birthday, get_sex, control_code, build
class TestRepos(unittest.TestCase):
def test_isvalid(self):
invalid = [ None, True, 16, "RCCMNL",
# the first 'I' sh... |
crookedreyes/py4e-specialization | course-3/chapter-13/twitter/twitter1.py | import urllib.request, urllib.parse, urllib.error
import twurl
import ssl
# https://apps.twitter.com/
# Create App and get the four strings, put then in hidden.py
TWITTER_URL = 'https://api.twitter.com/1.1/statuses/user_timeline.json'
# Ignore SSL certificate errors
ctx = ssl.create_default_context()
ctx.check_host... |
bparzella/secsgem | secsgem/secs/functions/s10f01.py | #####################################################################
# s10f01.py
#
# (c) Copyright 2021, Benjamin Parzella. All rights reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Fou... |
lcm-proj/lcm | test/python/lcm_file_test.py | #!/usr/bin/python
import os
import random
import tempfile
import unittest
import lcm
import client
class TestLcmFile(unittest.TestCase):
def setUp(self):
# tempfile.mktemp() is deprecated, so make our own random filename :-/
self.log_filename = os.path.join(tempfile.gettempdir(),
"lcm_... |
pombredanne/https-git.fedorahosted.org-git-kobo | tests/run_tests.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Run tests in current directory.
"""
import os
import sys
# prepare environment for tests
PROJECT_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
os.environ["PYTHONPATH"] = PROJECT_DIR
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
sys.path.insert... |
lylejohnson/FXPy | examples/groupbox.py | #! /usr/bin/env python
from FXPy.fox import *
from thread import start_new_thread
from time import localtime, sleep, strftime, time, localtime
import os
def updateClock(clockLabel):
"""Continuously updates the clock label"""
while 1:
clockLabel.setText(strftime("%I:%M:%S %p", localtime(time())))
... |
gallandarakhneorg/autolatex | tests/autolatex2tests/config/clean_test.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (C) 1998-2021 Stephane Galland <galland@arakhne.org>
#
# This program is free library; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation; either version 3 of the
... |
TEAM-HRA/hra_suite | HRAGUI/src/hra_gui/qt/wizards/pages/choose_datasource_page.py | '''
Created on 03-11-2012
@author: jurek
'''
from hra_core.special import ImportErrorMessage
try:
import os
import sys
from PyQt4.QtCore import * # @UnusedWildImport
from PyQt4.QtGui import * # @UnusedWildImport
from hra_core.io_utils import is_text_file
from hra_gui.qt.utils.qt_i18n import t... |
n17r4m/mmm.coffee | old-lib/geometry/xxx-LineIntersection.py |
class LineIntersection(object):
""" Line Intersection Class. initiates with lines
[(x1,y1), (x2, y2)] to be converted to labeled
endpoints [(x,y), label]. Main test for gen.
line intersection uses sweep-line algorithm.
"""
def __init__(self, data):
self.count = 0
self.lines = {}
self.sweeps = [... |
rayosborn/pycal | scripts/EditEditor.py | #!/usr/bin/env python
# PyCal - Python web calendar
#
# Copyright (C) 2004 Ray Osborn
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your opt... |
DStauffman/dstauffman | dstauffman/tests/test_estimation_smoother.py | r"""
Test file for the `smoother` module of the "dstauffman.estimation" library.
Notes
-----
#. Written by David C. Stauffer in July 2020.
"""
#%% Imports
import unittest
from dstauffman import HAVE_NUMPY
from dstauffman.aerospace import KfRecord
import dstauffman.estimation as estm
if HAVE_NUMPY:
import nump... |
jkettleb/iris | lib/iris/_cube_coord_common.py | # (C) British Crown Copyright 2010 - 2015, Met Office
#
# This file is part of Iris.
#
# Iris is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the
# Free Software Foundation, either version 3 of the License, or
# (at your option) any l... |
massimovassalli/epz | epz/core/skelDataRec.py | # EPZ 1.0
# Skeleton to create a DATA receiver object (counterpart of the DATA object)
# The class is designed to extend a threading class in standard python3 or a QtThread in Qt
# use the corresponding implementations, not this skeleton.
import zmq
import queue
from .epz import epzobject
from .data import DATA
class... |
Spacecraft-Code/SPELL | src/spell/spell/lib/adapter/databases/dbfile.py | ###################################################################################
## MODULE : spell.lib.adapter.databases.dbfile
## DATE : Mar 18, 2011
## PROJECT : SPELL
## DESCRIPTION: Database based on local text files
## --------------------------------------------------------------------------------... |
calmofthestorm/aenea | server/linux_x11/x11_libxdo.py | #!/usr/bin/python
# This file is part of Aenea
#
# Aenea is free software: you can redistribute it and/or modify it under
# the terms of version 3 of the GNU Lesser General Public License as
# published by the Free Software Foundation.
#
# Aenea is distributed in the hope that it will be useful, but WITHOUT
# ANY WARR... |
viur-framework/server | render/xml/__init__.py | # -*- coding: utf-8 -*-
from .default import DefaultRender as default, serializeXML
from .user import UserRender as user
from .file import FileRender as file
from server import conf
from server import securitykey
import datetime
__all__=[ default ]
def genSkey( *args, **kwargs ):
return( "<securityKey>%s</securit... |
leandrotoledo/python-telegram-bot | tests/test_meta.py | #!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2021
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
#... |
cbclab/MDT | mdt/cli_scripts/mdt_init_user_settings.py | #!/usr/bin/env python
# PYTHON_ARGCOMPLETE_OK
"""This script is meant to update your home folder with the latest MDT models."""
import argparse
import textwrap
import mdt
from mdt.lib.shell_utils import BasicShellApplication
__author__ = 'Robbert Harms'
__date__ = "2015-08-18"
__maintainer__ = "Robbert Harms"
__email_... |
Orav/kbengine | kbe/res/scripts/common/Lib/site-packages/setuptools/command/egg_info.py | """setuptools.command.egg_info
Create a distribution's .egg-info directory and contents"""
import os
import re
import sys
from setuptools import Command
import distutils.errors
from distutils import log
from setuptools.command.sdist import sdist
from setuptools.compat import basestring
from setuptools i... |
OptimalDesignLab/Kona | src/kona/test/test_optimizer.py | import unittest
import numpy
import kona
class OptimizerTestCase(unittest.TestCase):
def test_rosenbrock(self):
'''Optimizer controller'''
num_design = 2
solver = kona.examples.Rosenbrock(num_design)
optns = {
'opt_tol' : 1e-12,
}
algorithm = kona.algor... |
gph82/PyEMMA | pyemma/coordinates/estimators/covar/running_moments.py |
# This file is part of PyEMMA.
#
# Copyright (c) 2015, 2014 Computational Molecular Biology Group, Freie Universitaet Berlin (GER)
#
# PyEMMA is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either vers... |
rdussurget/py-altimetry | bin/cdf_merge.py | #!/usr/bin/env python
# encoding: utf-8
'''
altimetry.tools.cdf_merge -- shortdesc
altimetry.tools.cdf_merge is a description
It defines classes_and_methods
@author: user_name
@copyright: 2013 organization_name. All rights reserved.
@contact: user_renaud.dussurget@gmail.com
'''
imp... |
selectel/pyxs | pyxs/_compat.py | # -*- coding: utf-8 -*-
"""
pyxs._compat
~~~~~~~~~~~~
This module implements compatibility interface for scripts,
using ``xen.lowlevel.xs``.
:copyright: (c) 2011 by Selectel.
:copyright: (c) 2016 by pyxs authors and contributors, see AUTHORS
for more details.
:license: LGPL... |
qstokkink/py-ipv8 | ipv8/test/messaging/anonymization/test_community.py | from asyncio import Future
from collections import defaultdict
from ...base import TestBase
from ...mocking.endpoint import MockEndpointListener
from ...mocking.exit_socket import MockTunnelExitSocket
from ...mocking.ipv8 import MockIPv8
from ....messaging.anonymization.community import TunnelCommunity, TunnelSettings... |
akshmakov/Dolfin-Fijee-Fork | test/unit/mesh/python/SubMesh.py | "Unit tests for the mesh library"
# Copyright (C) 2006 Anders Logg
#
# This file is part of DOLFIN.
#
# DOLFIN is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at ... |
buguen/pylayers | pylayers/location/localization.py | from pylayers.util.project import *
import sys
from SimPy.SimulationRT import Process,hold
from pylayers.util import utilnet
from pylayers.network.network import Network, Node
#from pylayers.location.locarule import Take_all, merge_rules
import pdb
from pylayers.location.geometric.constraints.cla import *
from py... |
tetravision/Test | stem/descriptor/extrainfo_descriptor.py | # Copyright 2012-2015, Damian Johnson and The Tor Project
# See LICENSE for licensing information
"""
Parsing for Tor extra-info descriptors. These are published by relays whenever
their server descriptor is published and have a similar format. However, unlike
server descriptors these don't contain information that To... |
HXLStandard/hxl-proxy | hxl_proxy/controllers.py | """ HTTP controllers for the HXL Proxy
All of the Flask controllers are in this module.
See unit tests in tests/test_controllers.py
Started January 2015 by David Megginson
License: Public Domain
"""
import hxl_proxy
from hxl.io import HXLIOException
from hxl_proxy import admin, app, auth, cache, caching, dao, exce... |
SelvorWhim/competitive | Codewars/LetsPlayDarts.py | '''
# idea: convert to polar coordinates, check radius for special areas,
# then check angle for pie slice
# I didn't find a clear specification of the slice shape at the link
# I assumed symmetry - equal angles (20th of a circle each)
# and the 20,6,3,11 are centered on top, right etc.
# (and it worked for the test ca... |
vesche/HotC | server/battle_server.py | # -*- coding: utf-8 -*-
#
# HotC Battle Server
# https://github.com/vesche/HotC
#
import json
import time
def run(players):
my_client, opp_client = players
# '1' - attack
# '2' - defend
# '3' - throw
win_states = [ ('1', '3'), ('2', '1'), ('3', '2') ]
win_status = 'null'
... |
geary/claslite | web/app/lib/ee/tests/filter_test.py | """Test for the ee.filter module."""
import datetime
import unittest
import ee
from ee import apitestcase
class FilterTest(apitestcase.ApiTestCase):
def testConstructors(self):
"""Verifies that constructors understand valid parameters."""
empty = ee.Filter()
self.assertEquals(0, empty.predicateCou... |
aajanki/youtube-dl | youtube_dl/extractor/tumblr.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import re
from .common import InfoExtractor
class TumblrIE(InfoExtractor):
_VALID_URL = r'http://(?P<blog_name>.*?)\.tumblr\.com/(?:post|video)/(?P<id>[0-9]+)(?:$|[/?#])'
_TESTS = [{
'url': 'http://tatianamaslanydaily.tumblr.com/post/54... |
317070/ppbe-finance | finance/management/commands/loadmembersfromcsv.py | import os
from django.core.management.base import BaseCommand, CommandError
from django.conf import settings
import random
import datetime, csv
from finance.models import Person
class Command(BaseCommand):
args = '<path to the csv-file> [<group name>]'
help = '''Arguments:
- path to the csv-f... |
lielongxingkong/windchimes | swift/common/middleware/tempurl.py | # Copyright (c) 2010-2012 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 agree... |
google/madi | tests/neg_sample_neural_net_detector_test.py | # Lint as: python3
# Copyright 2020 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required ... |
davzhang/helix-python-binding | org/apache/helix/messaging/DefaultMessagingService.py | # package org.apache.helix.messaging
#from org.apache.helix.messaging import *
#from java.util import ArrayList
#from java.util import HashMap
#from java.util import List
#from java.util import Map
#from java.util import UUID
#from java.util.concurrent import ConcurrentHashMap
#from org.apache.log4j import Logger
impor... |
benvanwerkhoven/kernel_tuner | kernel_tuner/strategies/bayes_opt.py | """ Bayesian Optimization implementation from the thesis by Willemsen """
from copy import deepcopy
from random import randint, shuffle
import itertools
import warnings
import time
from typing import Tuple
import numpy as np
from scipy.stats import norm
# BO imports
try:
from sklearn.gaussian_process import Gauss... |
google-coral/cts | coral_cts.py | # 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
mochacat/NightJobCrawler | scraper.py | import logging
import argparse
import requests
import time
import os
import csv
from bs4 import BeautifulSoup
class Scraper(object):
def __init__(self):
self.search_terms = []
def storeUrls(self, jobs, storage_dir):
file_path = os.path.join(storage_dir, 'night_urls.csv')
download_file ... |
codesmart-co/bit | connectors/google_adwords/adapters/search_query.py | # local
from .performance import AdwordsPerformanceReportAdapter
class SearchQueryPerformanceReportAdapter(AdwordsPerformanceReportAdapter):
"""
Data Adapter For Search Query Performance Report
https://developers.google.com/adwords/api/docs/appendix/reports
/search-query-performance-report
"""
... |
ga4gh/workflow-execution-schemas | python/ga4gh/wes/controllers.py | """
Controllers for the workflow execution service
"""
DEFAULT_PAGE_SIZE = 100
def GetRunLog(**kwargs):
return {}
def CancelRun(**kwargs):
return {}
def ListRuns(**kwargs):
return {}
def GetServiceInfo(**kwargs):
return {}
def RunWorkflow(**kwargs):
return {}
def GetRunStatus(**kwargs):... |
gilneidp/TADD | madapp/mad/views.py | import os
import subprocess
import commands
import datetime
from django.shortcuts import render
from django.shortcuts import render_to_response, redirect
from django.http import HttpResponse
from django.contrib.auth.decorators import login_required
from django.contrib.auth import authenticate, login, logout
from django... |
jeffastorey/cloud-custodian | c7n/resources/rdscluster.py | # Copyright 2016 Capital One Services, 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... |
vivisect/synapse | synapse/tests/test_lib_sched.py | import time
import unittest
import threading
import synapse.lib.sched as s_sched
from synapse.tests.common import *
class SchedTest(SynTest):
def test_sched_base(self):
evt = threading.Event()
data = {'woot': []}
def woot1(x):
data['woot'].append(x)
def woot2(x):
... |
googleads/googleads-python-lib | examples/ad_manager/v202202/publisher_query_language_service/get_geo_targets.py | #!/usr/bin/env python
#
# Copyright 2017 Google 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 requir... |
allenlavoie/tensorflow | tensorflow/contrib/autograph/pyct/static_analysis/activity_test.py | # 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... |
kubeflow/pipelines | sdk/python/kfp/deprecated/gcp.py | # Copyright 2018 The Kubeflow 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... |
googleapis/python-aiplatform | samples/generated_samples/aiplatform_generated_aiplatform_v1_metadata_service_add_execution_events_sync.py | # -*- coding: utf-8 -*-
# Copyright 2020 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... |
byllyfish/faucet | faucet/valve_table.py | """Abstraction of an OF table."""
# Copyright (C) 2015 Brad Cowie, Christopher Lorier and Joe Stringer.
# Copyright (C) 2015 Research and Education Advanced Network New Zealand Ltd.
# Copyright (C) 2015--2017 The Contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this fi... |
dicortazar/stackalytics | stackalytics/processor/rcs.py | # Copyright (c) 2013 Mirantis 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... |
foursquare/fsqio | src/python/fsqio/pants/rpmbuild/tasks/rpmbuild_task.py | # coding=utf-8
# Copyright 2016 Foursquare Labs Inc. All Rights Reserved.
from __future__ import absolute_import, division, print_function, unicode_literals
import io
import os
import shutil
import subprocess
import tarfile
import uuid
from pants.base.build_environment import get_buildroot
from pants.base.exceptions... |
Cal-CS-61A-Staff/ok | migrations/versions/47e948205fbd_store_job_results.py | """Store job results
Revision ID: 47e948205fbd
Revises: 50937c69da0b
Create Date: 2016-12-26 22:25:26.072381
"""
# revision identifiers, used by Alembic.
revision = '47e948205fbd'
down_revision = '50937c69da0b'
from alembic import op
import sqlalchemy as sa
import server
from sqlalchemy.dialects import mysql
def u... |
ytsarev/rally | rally/benchmark/processing/charts/histogram.py | # Copyright 2014: The Rally team
# 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 ... |
rsnakamura/oldape | tests/testunits/testcommands/testwmiccommand/testwmic.py | from unittest import TestCase
from mock import MagicMock
from apetools.commands import wmic
from apetools.commons import errors
from apetools.connections.nonlocalconnection import OutputError
PASS = """
Executing (\\IGOR\root\cimv2:Win32_NetworkAdapter.DeviceID="11")->enable()
Method execution successful.
Out Parame... |
JDongian/python-jamo | tools/parse.py | from sys import argv
import re
import json
import check
if __name__ == "__main__":
filein, fileout = argv[1], argv[2]
status = check.validate(filein)
if status == True or len(argv) == 4 and argv[3] == '--nocheck':
results = []
with open(filein, 'r') as fin:
results = re.findall(... |
bird-house/birdy | tests/test_converters.py | # noqa: D100
import json
import os
import tempfile
import pytest
from birdy.client import converters
def test_all_subclasses(): # noqa: D103
c = converters.all_subclasses(converters.BaseConverter)
assert converters.MetalinkConverter in c
def test_jsonconverter(): # noqa: D103
d = {"a": 1}
s = j... |
jbohren-forks/catkin_tools | catkin_tools/resultspace.py |
import os
import re
from osrf_pycommon.process_utils import execute_process
from .common import string_type
from .utils import which
CMAKE_EXEC = which('cmake')
SORT_EXEC = which('sort')
# Cache for result-space environments
_resultspace_env_cache = {}
def get_resultspace_environment(result_space_path, quiet=Fal... |
Cybernetic1/bookcam | bookcam.py | #!/usr/bin/python
# -*- coding: UTF-8 -*-
# Allow to scan book pages every N seconds
# TODO:
# * after exchange cam1 and cam2, some keys seem incorrect
# * suppress error messages from libwebcam
from SimpleCV import *
import cv # using cv for windows display
import cv2 # now using cv2 for capture
from subprocess ... |
ndparker/tdi | tests/tools/css_minify.py | #!/usr/bin/env python
import warnings as _warnings
_warnings.resetwarnings()
_warnings.filterwarnings('error')
from tdi.tools import css
x = css.minify(u"""
body {
background-color: #fff;
}
""")
print repr(x)
x = css.minify("""
.eacute:after {
content: "\xe9";
}
""")
print repr(x)
try:
x = css.minify(""... |
google-research/exoplanet-ml | exoplanet-ml/experimental/beam/transit_search/prediction_fns.py | # Copyright 2018 The Exoplanet ML 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 t... |
witgo/spark | python/pyspark/ml/tests/test_tuning.py | #
# 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... |
cuckooooo/OJ | PYTHON/junior/YingBiDuiHuan/src/demo.py | #coding:utf-8
'''
Created on Aug 5, 2013
@author: z00241626
'''
'''
取一个任意小于1美元的金额,然后计算可以换成最少多少枚硬币。
硬币有1美分,5美分,10美分,25美分四种。1美元等于100美分。
举例来说,0.76美元换算结果应该是3枚25美分,1枚1美分。
类似76枚1美分,2枚25美分+2枚10美分+1枚5美分+1枚1美分这样的结果都是不符合要求的。
输入:n
返回:list list[0]为1美分个数;list[1]为5美分个数;list[2]为10美分个数;list[3]为25美分个数
异常:输入不满足小于1美元的金额->返回list=None... |
softelnet/sponge | sponge-jython/examples/script/py/events_cron.py | """
Sponge Knowledge Base
Generating events by Cron
"""
from java.util.concurrent.atomic import AtomicInteger
def onInit():
global scheduleEntry, eventCounter
scheduleEntry = None
eventCounter = AtomicInteger(0)
sponge.setVariable("eventCounter", eventCounter)
class CronTrigger(Trigger):... |
xydinesh/flask-restful | FlaskWebTemplate/routes.py | from datetime import datetime
from flask import render_template, request, g, jsonify, abort, url_for
from FlaskWebTemplate import app
from FlaskWebTemplate.models import *
from flask.ext.httpauth import HTTPBasicAuth
auth = HTTPBasicAuth()
@auth.verify_password
def verify_password(username_or_token, password):
u... |
RenchuSong/bossma | bossma/settings.py | """
Django settings for bossma project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
imp... |
google/framework-for-osdu | osdu-r2/os-python-sdk/osdu_api/model/search/query_request.py | # Copyright 2020 Google LLC
# Copyright 2020 Amazon
#
# 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... |
comic/comic-django | app/grandchallenge/evaluation/migrations/0012_auto_20210826_1930.py | # Generated by Django 3.1.13 on 2021-08-26 19:30
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("evaluation", "0011_auto_20210819_1832"),
]
operations = [
migrations.RenameField(
model_name="pha... |
zstackio/zstack-woodpecker | integrationtest/vm/vpc_ha/test_vpc_update_netflow_version.py | '''
@author: Pengtao.Zhang
'''
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.test_state as test_state
import zstackwoodpecker.operations.vpc_operations as vpc_ops
import os
from itertools import izip
import zstackwoodpecker.operations.resource_oper... |
jbohren-forks/catkin_tools | catkin_tools/execution/controllers.py |
try:
# Python3
from queue import Empty
except ImportError:
# Python2
from Queue import Empty
import sys
import threading
import time
from catkin_tools.common import disable_wide_log
from catkin_tools.common import format_time_delta
from catkin_tools.common import format_time_delta_short
from catkin_t... |
jrwdunham/old | onlinelinguisticdatabase/config/__init__.py | # Copyright 2016 Joel Dunham
#
# 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... |
alien4cloud/alien4cloud-cloudify3-provider | alien4cloud-cloudify3-provider/src/test/resources/outputs/blueprints/openstack/storage/wrapper/LinuxFileSystem_1/tosca.interfaces.node.lifecycle.Standard/start/_a4c_start.py |
from cloudify import ctx
from cloudify.exceptions import NonRecoverableError
from cloudify.state import ctx_parameters as inputs
import subprocess
import os
import re
import sys
import time
import threading
import platform
from StringIO import StringIO
from cloudify_rest_client import CloudifyClient
from cloudify im... |
damomeen/pox-datapath | pox/boot.py | #!/bin/sh -
# Copyright 2011-2012 James McCauley
#
# This file is part of POX.
#
# POX 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.... |
tensorflow/probability | tensorflow_probability/python/experimental/auto_batching/test_programs.py | # Copyright 2018 The TensorFlow Probability 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 o... |
tgalal/python-adb | setup.py | # Copyright 2014 Google 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 applicable law or a... |
nuagenetworks/nuage-openstack-neutron | nuage_neutron/plugins/nuage_ml2/nuage_port_ext_driver.py | # Copyright 2015 Intel 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
#
# Unless requir... |
fulcrumapp/fulcrum-python | fulcrum/mixins.py | from fulcrum.utils import is_string, generate_uuid
class Findable(object):
def find(self, id):
api_resp = self.client.call('get', '{0}/{1}'.format(self.path, id))
return api_resp
class Deleteable(object):
def delete(self, id):
self.client.call('delete', '{0}/{1}'.format(self.path, id)... |
ashgang/RandomAlgos | Python/fibo.py | """
This is python implementation of fibonacci series
Fibonacci series is done in a function and is returned
as a list to the caller
"""
def fib(uCount = 10):
a, b = 0, 1
fibSer = list()
while uCount > 0:
#print a
fibSer.append(a)
a, b = b, a+b
uCount -= 1
print fibSer
return fibSer
def fib2n(uCount = 1... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.