repo_name
stringlengths
5
104
path
stringlengths
4
248
content
stringlengths
102
99.9k
closeio/nylas
inbox/models/meta.py
"""Utility for loading SQLAlchemy model classes and friends. Please see inbox/models/__init__.py for the explanation of why this is necessary.""" def load_models(): from inbox.models.account import Account from inbox.models.base import MailSyncBase from inbox.models.action_log import ActionLog from in...
tiramiseb/awesomeshop
back/defaultconfig.py
# -*- coding: utf8 -*- # Copyright 2015 Sébastien Maccagnoni # # This file is part of AwesomeShop. # # AwesomeShop 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 (a...
micahflee/securedrop
securedrop/tests/test_source.py
# -*- coding: utf-8 -*- from cStringIO import StringIO import gzip from mock import patch, ANY import re from bs4 import BeautifulSoup from flask import session, escape, url_for from flask_testing import TestCase import crypto_util from db import db_session, Source import source import version import utils import jso...
coddingtonbear/inthe.am
inthe_am/taskmanager/debug_utils.py
from importlib import import_module from io import BytesIO from django.conf import settings from django.core.handlers.wsgi import WSGIRequest from django.http import SimpleCookie from django.middleware import csrf def artificial_login(**credentials): from django.contrib.auth import authenticate, login cook...
adrianpaesani/odoo-argentina
l10n_ar_invoice_sale/__openerp__.py
# -*- coding: utf-8 -*- { 'name': 'Argentinian Sale Total Fields', 'version': '1.0', 'category': 'Localization/Argentina', 'sequence': 14, 'author': 'ADHOC SA', 'website': 'www.adhoc.com.ar', 'license': 'AGPL-3', 'summary': '', 'description': """ Argentinian Sale Total Fields ======...
simonzhangsm/voltdb
tools/voltdb-install.py
#!/usr/bin/env python # This file is part of VoltDB. # Copyright (C) 2008-2018 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 an...
btat/Booktype
lib/booki/editor/templatetags/booki_tags.py
# This file is part of Booktype. # Copyright (c) 2012 Aleksandar Erkalovic <aleksandar.erkalovic@sourcefabric.org> # # Booktype 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 Li...
kobotoolbox/kpi
kpi/tests/test_deployment_backends.py
# coding: utf-8 import pytest from django.test import TestCase from kpi.exceptions import DeploymentDataException from kpi.models.asset import Asset from kpi.models.asset_version import AssetVersion class CreateDeployment(TestCase): def setUp(self): self.asset = Asset(content={ 'survey': [ ...
Honzin/ccs
ccs/bter/configuration.py
# -*- coding: utf8 -*- """ This file contains configuration for Bter stock. """ __author__ = "Jan Seda" __copyright__ = "Copyright (C) Jan Seda" __credits__ = [] __license__ = "" __version__ = "0.1" __maintainer__ = "Jan Seda" __email__ = "" __status__ = "Production" from .. import constants from .. import default ...
datagutten/comics
comics/core/admin.py
from django.contrib import admin from comics.core import models class ReleaseImageInline(admin.TabularInline): model = models.Release.images.through readonly_fields = ('release', 'image') extra = 0 def has_add_permission(self, request): return False @admin.register(models.Comic) class Comi...
fiduswriter/fiduswriter
fiduswriter/style/models.py
from django.db import models from django.utils.translation import ugettext as _ class DocumentStyle(models.Model): title = models.CharField( max_length=128, help_text="The human readable title.", default="Default", ) slug = models.SlugField( max_length=20, help_text...
B-MOOC/edx-platform
cms/urls.py
from django.conf import settings from django.conf.urls import patterns, include, url # There is a course creators admin table. from ratelimitbackend import admin admin.autodiscover() # pylint: disable=bad-continuation # Pattern to match a library key only LIBRARY_KEY_PATTERN = r'(?P<library_key_string>library-v1:[^/...
FabiApfelkern/policycompass
tests-acceptance-frontend/test_example_story.py
"""Acceptances tests using py.test fixtures. All fixtures from ../conftest.py and :mod: `pytest_splinter.plugin` are available. The test case structure should follow the If-When-Then pattern. """ ######### # Tests # ######### def test_user_want_to_explore_news(browser): # import ipdb; ipdb.set_trace() # pytho...
jmacmahon/nationalise-every-word
nationalise_every_word/words.py
from .config import config from json import load, dump from copy import deepcopy from contextlib import contextmanager class Store(object): def __init__(self, store_file, defaults): self._store_file = store_file try: with open(store_file, 'r') as store_file: self._store...
CLVsol/odoo_cl_addons
cl_person/address/cl_address.py
# -*- encoding: utf-8 -*- ################################################################################ # # # Copyright (C) 2013-Today Carlos Eduardo Vercelino - CLVsol # # ...
lugkhast/forever-alone-gae
core/utils.py
# forever-alone: A course and free time matching web app for college students # Copyright (C) 2011 Lawrence Patrick Calulo # # This file is part of forever-alone. # # forever-alone is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # t...
mbauskar/alec_frappe5_erpnext
erpnext/accounts/doctype/journal_entry/journal_entry.py
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: GNU General Public License v3. See license.txt from __future__ import unicode_literals import frappe from frappe.utils import cstr, flt, fmt_money, formatdate from frappe import msgprint, _, scrub from erpnext.controllers.accounts_controll...
prsephton/Grok4Noobs
mkbook.py
#______________________________________________________________________________ # Turn our site into a pdf printable document using princexml #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ import grok, re from interfaces import ISiteRoot, IArticle, IArticleSorter from menu import UtilI...
CodeHuntersLab/CuriElements
CuriElements/atoms.py
from math import pi, cos, sin from PyQt5.QtCore import (QParallelAnimationGroup, QPointF, QPropertyAnimation, QRectF, Qt, qrand, qsrand, QTime) from PyQt5.QtGui import (QBrush, QColor, QPen, QPainterPath, QTransform, QRadialGradient) from PyQt5.QtWidgets import (QGraphicsObject, QGraphicsScene, QGraphicsView) from Cu...
rspavel/spack
var/spack/repos/builtin/packages/spot/package.py
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class Spot(AutotoolsPackage): """Spot is a C++11 library for omega-automata manipulation and mod...
kontron/python-ipmi
pyipmi/sdr.py
# Copyright (c) 2014 Kontron Europe GmbH # # 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 Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is...
garinh/cs
docs/support/docutils/parsers/rst/languages/pt_br.py
# Author: David Goodger # Contact: goodger@users.sourceforge.net # Revision: $Revision: 21817 $ # Date: $Date: 2005-07-21 13:39:57 -0700 (Thu, 21 Jul 2005) $ # Copyright: This module has been placed in the public domain. # New language mappings are welcome. Before doing a new translation, please # read <http://docuti...
althonos/fs.sshfs
tests/test_sshfs.py
# coding: utf-8 from __future__ import absolute_import from __future__ import unicode_literals import stat import sys import time import uuid import unittest import paramiko.ssh_exception import fs.path import fs.test import fs.errors from fs.sshfs import SSHFS from fs.subfs import ClosingSubFS from fs.permissions i...
manojklm/pywinauto-x64
pywinauto/tests/truncation.py
# GUI Application automation and testing library # Copyright (C) 2006 Mark Mc Mahon # # 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 Foundation; either version 2.1 # of the License, or (at you...
highpower/uatraits
tests/cover.py
# -*- coding: utf-8 -*- import sys import uatraits import json SUA = 0 SPROCESS = 1 def dicts_equals(d1, d2): i1 = set(d1) - set(d2) i2 = set(d2) - set(d1) if len(i1) != 0 or len(i2) != 0: return False for x in d1: if d1[x] != d2[x]: return False return True if sys....
lgarren/spack
var/spack/repos/builtin/packages/r-futile-logger/package.py
############################################################################## # Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-64...
bparzella/secsgem
secsgem/secs/variables/base_text.py
##################################################################### # base_text.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 ...
philip30/letrac
script/util/breduct.py
#!/usr/bin/env python import sys import argparse from collections import defaultdict ### Validation def check_output(output): depth = 0 for c in output: if c == '(': depth += 1 elif c == ')': depth -= 1 return depth == 0 ### Change to Alphabet (only support A-Z) G ...
robmcmullen/guessit
guessit/transfo/guess_release_group.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # GuessIt - A library for guessing information from filenames # Copyright (c) 2012 Nicolas Wack <wackou@gmail.com> # # GuessIt is free software; you can redistribute it and/or modify it under # the terms of the Lesser GNU General Public License as published by # the Free ...
Orav/kbengine
kbe/src/lib/python/Modules/_decimal/tests/formathelper.py
# # Copyright (c) 2008-2012 Stefan Krah. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # 1. Redistributions of source code must retain the above copyright # notice, this list of con...
vFense/vFenseAgent-nix
agent/src/utils/distro/mac/__init__.py
import subprocess from datetime import datetime from src.utils import logger def get_current_uptime(): """Gets the current uptime in seconds. Returns: (int) The uptime in seconds. """ cmd = ['/usr/sbin/sysctl', 'kern.boottime'] process = subprocess.Popen(cmd, stdout=subprocess.PIPE) ...
debben/RepPREP
editor/views.py
from django.http import HttpResponse from polls.models import Poll from django.template import RequestContext from pyjade.ext.django.loader import Loader from django.shortcuts import render, get_object_or_404 from django.views.generic import ListView, DetailView from editor.models import Object, Job class ObjectList(...
saullocastro/pyNastran
pyNastran/op2/write_utils.py
from __future__ import unicode_literals from struct import Struct, pack def _write_markers(f, fascii, markers): out = [] n = 0 for marker in markers: out += [4, marker, 4] n += 3 fascii.write('marker = [4, %i, 4]\n' % marker) f.write(pack(b'<%ii' % n, *out)) def write_table_he...
horazont/aioxmpp
docs/new-xml-concept.py
######################################################################## # File name: new-xml-concept.py # This file is part of: aioxmpp # # LICENSE # # 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 ...
phievo/phievo
Examples/HowTo_manualNetwork.py
## Import the libraries from phievo.Networks import mutation,deriv2 import random ### Create an empty network g = random.Random(20160225) # This define a new random number generator L = mutation.Mutable_Network(g) # Create an empty network ### Create a new species _S0_ ## S0 is a reference to access quickly to the...
mikrosimage/rez
src/rez/package_serialise.py
from rez.vendor import yaml from rez.serialise import FileFormat from rez.package_resources_ import help_schema from rez.vendor.schema.schema import Schema, Optional, And, Or, Use from rez.vendor.version.version import Version from rez.utils.data_utils import SourceCode from rez.utils.formatting import PackageRequest, ...
ekyah411/blender-urdf
src/io_scene_urdf/import_urdf_xacro.py
############################################################################ # Copyright (C) 2014 by Ralf Kaestner # # ralf.kaestner@gmail.com # # # # This pr...
chishaxie/tools
imgs.py/imgs.py
#!/usr/bin/env python # -*- coding: utf8 -*- import sys import os import math import shutil import operator import argparse import threading from PIL import Image from PIL import ImageStat from PIL import ImageEnhance import numpy as np def gcd(a, b): if a < b: a, b = b, a y = a % b if y == 0: ...
Ambuj-UF/Machine-Learning-Theorems
fourierApp.py
#Fourier approximation and scalling of assigned function import math import argparse import textwrap import matplotlib.pyplot as plt parser = argparse.ArgumentParser(prog='Assignment', version= '1.0', formatter_class=argparse.RawDescriptionHelpFormatte...
mariotti/abtag
proofOC/py-chrome-bookmarks.py
#!/usr/bin/python # -*- coding: utf-8 -*- # # py-chrome-bookmarks # # A script to convert Google Chrome's bookmarks file to the standard HTML-ish # format. # # (c) Benjamin Esham, 2011. See the accompanying README for this file's # license and other information. import json, sys, os, re import string script_version...
tiagocoutinho/bliss
tests/session/test_mg.py
# -*- coding: utf-8 -*- # # This file is part of the bliss project # # Copyright (c) 2016 Beamline Control Unit, ESRF # Distributed under the GNU LGPLv3. See LICENSE for more info. import pytest import time from bliss.common import measurementgroup from bliss import setup_globals from bliss.common import scans from bl...
lablup/backend.ai-manager
src/ai/backend/manager/models/alembic/versions/e35332f8d23d_add_modified_at_to_users_and_kernels.py
"""add_modified_at_to_users_and_kernels Revision ID: e35332f8d23d Revises: da24ff520049 Create Date: 2020-07-01 14:02:11.022032 """ from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import postgresql from sqlalchemy.sql.expression import bindparam from ai.backend.manager.models.base import conv...
dekked/dynamodb-mock
setup.py
# -*- coding: utf-8 -*- from setuptools import setup, find_packages install_requires = [ # d2to1 bootstrap 'd2to1', 'pyramid', 'waitress', 'onctuous >= 0.5.1', 'setuptools >= 0.6b1', ] tests_requires = [ 'boto', 'nose', 'nosexcover', 'coverage', 'mock', 'webtest', ]...
htomeht/euler
008/python/problem8_next.py
#! /bin/env python from functools import reduce from operator import mul f = open("numbers") number = f.read() f.close() def maxsum(l): mx = 0 for i in range(len(l)-1): mx = max(mx, reduce(mul, [int(x) for x in l[i:i+13]])) return mx sections = [x for x in number.split("0") if len(x) >= 13] mx = max([maxs...
matt-hayden/video-clip-splitter
videoclipsplitter/moviepy_wrapper.py
#! /usr/bin/env python3 import os.path import moviepy.editor from . import ConverterBase, SplitterException class moviepyException(SplitterException): pass def moviepy_wrapper(input_filename, output_file_pattern='', **kwargs): dirname, basename = os.path.split(input_filename) filepart, ext = os.path.splitext(bas...
frnhr/django-stdnumfield
setup.py
# coding=utf-8 import os from setuptools import setup import stdnumfield # allow setup.py to be run from any path os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir))) with open("README.md", 'r') as f: description = f.read() setup( name="django-stdnumfield", version=stdnumfield....
MarquisLP/Sidewalk-Champion
lib/game_states/stage_select_state.py
"""This module handles the Stage Select Screen and all of its various components. Module Constants: BORDER_WIDTH (int): The thickness, in pixels, of the borders of the stage preview as well as each stage thumbnail. NUM_OF_THUMBS (int): The number of Stage Thumbnails shown on the screen at once....
drprofesq/hmdx
hmdx.py
import sys import xml.etree.ElementTree as ET import log, stuff import wmimport, template def convertgirls(importedgirls, basefolder=''): log.debug('Converting %s girls' % len(importedgirls)) templates = {} contentfolder = stuff.joinpath(basefolder, 'content') loaded = template.loadalltemplates(cont...
ashutosh-mishra/youtube-dl
test/test_utils.py
#!/usr/bin/env python # coding: utf-8 # Allow direct execution import os import sys import unittest sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) # Various small unit tests import xml.etree.ElementTree #from youtube_dl.utils import htmlentity_transform from youtube_dl.utils import ...
Matoking/pastebin-django
pastebin/util.py
import math import datetime class Paginator(object): @staticmethod def get_pages(current_page, entries_per_page, total_entries): entries = [] total_pages = math.ceil(float(total_entries) / float(entries_per_page)) # Add the first and previous pages if current_p...
konr/pomo
pomo.py
import time import os import string import json from datetime import datetime import subprocess from abc import ABCMeta, abstractmethod import sys from common import epoch, Config, Configurable ONE_MINUTE = 60 ONE_HOUR = 60*ONE_MINUTE class TimerHook(object): __metaclass__ = ABCMeta def __init__(self, config...
avolkov1/keras_experiments
examples/cifar/cifar10_cnn_distrib_v2_slurm.py
#!/usr/bin/env python '''Train a simple deep CNN on the CIFAR10 small images dataset. Distributed training. run: salloc -N2 -p hsw_p40 --comment=docker --qos=short --time=04:00:00 srun -l --ntasks-per-node=2 \ python examples/cifar/cifar10_cnn_distrib_v2_slurm.py --epochs=5 --rdma # rdma default ...
bertrandvidal/stuff
py_challenge/level_7.py
from challenge import open_next_level import requests import zipfile import os import tempfile tmp = tempfile.mkdtemp() (_, archive_path) = tempfile.mkstemp(dir=tmp) with open(archive_path, "w") as channel: response = requests.get("http://www.pythonchallenge.com/pc/def/channel.zip") response.raise_for_status() ...
kultus/belive.at
src/beliveat/schema.py
# -*- coding: utf-8 -*- """Provides FormEncode based validators and schemas.""" import re from formencode import validators, Invalid, Schema from ttp import HASHTAG_REGEX as valid_hashtag ACTION_CODES = ( (1, 'flag'), (3, 'ignore'), (5, 'amplify') ) class Hashtag(validators.UnicodeString): """Valid...
thruflo/pyramid_simpleauth
src/pyramid_simpleauth/tree.py
# -*- coding: utf-8 -*- """Provides ``Root`` traversal root factory.""" from pyramid.security import ALL_PERMISSIONS from pyramid.security import Allow, Deny from pyramid.security import Authenticated, Everyone from formencode import Invalid from .model import get_existing_user from .schema import Username class A...
PAIR-code/recommendation-rudders
hyperbolic-rs/rudders/datasets/amazon.py
# Copyright 2017 The Rudders 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...
kslundberg/pants
src/python/pants/base/build_file_parser.py
# coding=utf-8 # Copyright 2014 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import (absolute_import, division, generators, nested_scopes, print_function, unicode_literals, with_statement) import logging impor...
pinterest/kingpin
kingpin/tests/thrift_utils/test_thrift_client_mixin.py
#!/usr/bin/python # # Copyright 2016 Pinterest, Inc # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
GM-Alex/compose
compose/const.py
from __future__ import absolute_import from __future__ import unicode_literals import sys DEFAULT_TIMEOUT = 10 HTTP_TIMEOUT = 60 IMAGE_EVENTS = ['delete', 'import', 'load', 'pull', 'push', 'save', 'tag', 'untag'] IS_WINDOWS_PLATFORM = (sys.platform == "win32") LABEL_CONTAINER_NUMBER = 'com.docker.compose.container-nu...
lerker/cupydle
cupydle/test/otros/checkGPUspeed.py
""" Use this file to check the speed difference between a big matrix multiplication performed on the GPU or on the CPU. """ from theano import function, config, shared, tensor, sandbox import numpy import time vlen = 10 * 30 * 768 # 10 x #cores x # threads per core iters = 1000 rng = numpy.random.RandomState(22) x =...
cc1-cloud/cc1
src/wi/urls/user/iso_image.py
# -*- coding: utf-8 -*- # @COPYRIGHT_begin # # Copyright [2010-2014] Institute of Nuclear Physics PAN, Krakow, Poland # # 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.apac...
googleapis/python-logging
google/cloud/logging_v2/sink.py
# Copyright 2016 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
krottmann/PyTorch-SRGAN
dataprovider.py
import torch.utils.data as data from os import listdir from os.path import join from PIL import Image from scipy.misc import imread, imresize, imsave import numpy as np import random import torch def is_image_file(filename): extensions = ['.png', '.jpg', '.jpeg', '.bmp'] return any(filename.endswith(extensio...
felinx/poweredsites
poweredsites/libs/utils.py
# -*- coding: utf-8 -*- # # Copyright(c) 2010 poweredsites.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 License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applic...
Yelp/paasta
paasta_tools/paastaapi/model/marathon_autoscaling_info.py
# coding: utf-8 """ Paasta API No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ import re # noqa: F401 import sys # noqa: F401 impor...
Emptyset110/dHydra-movies
movies.py
# -*- coding:utf-8 -*- """ 电影数据接口接口: Created on 03/08/2016 @author: Wen Gu @contact: emptyset110@gmail.com """ import requests import connection as CON from pandas import DataFrame as df import re class Maoyan: def __init__(self): self.session = requests.Session() pass """ 获取电影票房数据:数据来源,猫眼 """ def get_box(se...
Vallher/zulip
zerver/lib/bulk_create.py
from __future__ import absolute_import from typing import Any, Iterable, Mapping, Optional, Set, Tuple from six import text_type from zerver.lib.initial_password import initial_password from zerver.models import Realm, Stream, UserProfile, Huddle, \ Subscription, Recipient, Client, get_huddle_hash, resolve_email_t...
DTL-FAIRData/ODEX-FAIRDataPoint
fdp-api/python/fdp.py
# FAIR Data Point Service # # Copyright 2015 Netherlands eScience Center in collaboration with # Dutch Techcenter for Life Sciences. # # 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 # # h...
edx/edx-load-tests
helpers/util.py
""" Generally helpful utilities for edx load testing. """ from random import random def choice_with_distribution(element_ratio_pairs): """ Randomly choose an element with probabilities given by ratios. This utility function takes a mapping of elements to ratios and chooses an element with probability...
ebt-hpc/cca
cca/scripts/cca_config.py
#!/usr/bin/env python3 ''' Configuration for CCA Copyright 2012-2020 Codinuum Software Lab <https://codinuum.com> 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.apach...
google-research/electra
build_pretraining_dataset.py
# coding=utf-8 # Copyright 2020 The Google Research 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 applicab...
zenlambda/aeta
tests/unit_and_e2e/test_task_deferred.py
# Copyright 2012 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 agre...
tmobile/jazz-installer
installer/helpers/destroy/delete_platform_services.py
def checkCFServiceAvailable(servicename): try: return cform_client.list_stack_resources(StackName=servicename) except Exception: return False def deleteCFService(servicename): try: return cform_client.delete_stack(StackName=servicename) except Exception: return False ...
UKN-DBVIS/SciBib
app/configurations.py
# Copyright (C) 2020 University of Konstanz - Data Analysis and Visualization Group # This file is part of SciBib <https://github.com/dbvis-ukon/SciBib>. # # SciBib 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 Fo...
iemejia/incubator-beam
sdks/python/apache_beam/io/sources_test.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...
AnsgarSchmidt/sensomatic
knot/python/TM1638.py
import RPi.GPIO as GPIO class TM1638(object): FONT = [0b00111111, 0b00000110, 0b01011011, 0b01001111, 0b01100110, 0b01101101, 0b01111100, 0b00000111, 0b01111111, 0b01100111, 0b00000000, ...
cp16net/trove
trove/tests/unittests/guestagent/test_configuration.py
# Copyright 2015 Tesora 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 a...
saltstack/salt
tests/unit/modules/test_helm.py
import salt.modules.helm as helm # Import Exception from salt.exceptions import CommandExecutionError from tests.support.mixins import LoaderModuleMockMixin from tests.support.mock import MagicMock, call, patch from tests.support.unit import TestCase class HelmTestCase(TestCase, LoaderModuleMockMixin): """ T...
tudyzhou/dangdang
bin/lib_detail.py
#-*- coding: utf-8 -* USAGE = ''' ParserDetail lib ''' INPUT_CODE = 'gbk' # html encode OUTPUT_CODE = 'utf-8' # output encode for databases import os import re import urllib2 CATEGORIES = { "recom": '内容推荐', "index": '目录', } P_CONTENT = re.compile(r'<textarea style="...
ray-project/ray
python/ray/workflow/virtual_actor_class.py
import abc import functools import inspect import logging from typing import TYPE_CHECKING, Any, Tuple, Dict, Callable import uuid import json import weakref import ray from ray.util.inspect import is_function_or_method, is_class_method, is_static_method from ray._private import signature from ray.workflow.common impo...
GoogleCloudPlatform/healthcare-deid
physionet/gcs_to_bigquery.py
# 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 required by applicable law or ...
DarthThanatos/citySimNG
citySimNGView/extra/pygraphviz_simple.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import pygraphviz as pgv import wx class GraphImgPanel(wx.Panel): def __init__(self, parent, size): wx.Panel.__init__(self, parent = parent, size = size) self.size = size rootSizer = wx.BoxSizer(wx.HORIZONTAL) verticalSizer = wx.BoxSiz...
openstack/watcher
watcher/cmd/status.py
# Copyright (c) 2018 NEC, Corp. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agr...
SmartDeveloperHub/sdh-ci-metrics
sdh/metrics/ci/api.py
""" #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=# This file is part of the Smart Developer Hub Project: http://www.smartdeveloperhub.org Center for Open Middleware http://www.centeropenmiddleware.com/ #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=...
google/model_search
model_search/search/categorical_harmonica.py
# 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 agreed to in writing, ...
Esri/community-addresses-python
source/SimpleFieldMapper.py
""" @author: @contact: @company: Esri @version: 1.0.0 @description: @requirements: Python 2.7.x, ArcGIS 10.2.1 @copyright: Esri, 2014 """ import arcpy import sys, os, datetime import ConfigParser from os.path import dirname, join, exists, splitext, isfile logFileName ='.\\logs\\FieldMap.l...
jochenklar/quantify
data/views.py
from rest_framework import viewsets from data.models import * from data.serializers import * class EntryViewSet(viewsets.ModelViewSet): serializer_class = EntrySerializer def get_queryset(self): return Entry.objects.filter(user=self.request.user) class GroupViewSet(viewsets.ModelViewSet): serial...
josephsuh/extra-specs
tools/hacking.py
#!/usr/bin/env python # vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright (c) 2012, Cloudscaling # 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 # # ...
iagcl/data_pipeline
data_pipeline/stream/oracle_message.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 u...
nstoik/farm_monitor
server/fm_server/network/ethernet.py
"""Ethernet module to set ethernet options.""" import logging import netifaces from fm_database.base import get_session from fm_database.models.system import Interface from netifaces import AF_INET logger = logging.getLogger("fm.network.ethernet") def ethernet_connected(): """Check if 'eth0' has an ...
saltstack/salt
salt/modules/mac_system.py
""" System module for sleeping, restarting, and shutting down the system on Mac OS X .. versionadded:: 2016.3.0 .. warning:: Using this module will enable ``atrun`` on the system if it is disabled. """ import getpass import shlex import salt.utils.platform from salt.exceptions import CommandExecutionError, Salt...
simplereach/nsq2kafka
nsq2kafka/__init__.py
from kafka import KafkaProducer import nsq import json import signal import logging import tornado.ioloop class NSQ2Kafka(object): """ Reads from an NSQ topic and publishes to a single Kafka stream Arguments should be passed in the form of <nsq|kafka>_kwarg Where kwarg is the kwarg for either nsq.Re...
InsightSoftwareConsortium/ITKExamples
src/Filtering/ImageGrid/WarpAnImageUsingADeformationField/Code.py
#!/usr/bin/env python # Copyright NumFOCUS # # 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.txt # # Unless required by applicable law or ...
khenness/asciiartdatabase
artapp/forms.py
from django import forms from django.contrib.auth.models import User from django.forms import ModelForm from artapp.models import Artist, Art from django.template.defaultfilters import slugify class RegistrationForm(ModelForm): username = forms.CharField(label=(u'User Name')) email = forms.EmailField(label=(u'Em...
boto/botocore
tests/unit/test_history.py
from tests import mock from tests import unittest from botocore.history import HistoryRecorder from botocore.history import BaseHistoryHandler from botocore.history import get_global_history_recorder class TerribleError(Exception): pass class ExceptionThrowingHandler(BaseHistoryHandler): def emit(self, eve...
sixfeetup/cloud-custodian
tools/c7n_salactus/c7n_salactus/worker.py
# Copyright 2016-2017 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 ...
batermj/algorithm-challenger
code-analysis/programming_anguage/python/source_codes/Python3.8.0/Python-3.8.0/Lib/unittest/test/testmock/testasync.py
import asyncio import inspect import re import unittest from unittest.mock import (ANY, call, AsyncMock, patch, MagicMock, Mock, create_autospec, sentinel, _CallList) def tearDownModule(): asyncio.set_event_loop_policy(None) class AsyncClass: def __init__(self): pass ...
pywbem/pywbemtools
pywbemtools/pywbemcli/_display_cimobjects.py
# (C) Copyright 2020 IBM Corp. # (C) Copyright 2020 Inova Development 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-...
turbulent/dockwrkr
dockwrkr/utils.py
import os import errno import sys import logging import collections import shutil import hashlib from time import time from datetime import datetime from math import floor from pkg_resources import Requirement, resource_filename, require import yaml try: # py3 from shlex import quote except ImportError: # py2 ...
mcloudv/fuel-ostf
fuel_health/tests/cloudvalidation/test_ntp.py
# Copyright 2015 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 writing, s...