repo_name
stringlengths
5
104
path
stringlengths
4
248
content
stringlengths
102
99.9k
eoinof/stem
stem/descriptor/networkstatus.py
""" Parsing for Tor network status documents. This supports both the v2 and v3 dir-spec. Documents can be obtained from a few sources... * the 'cached-consensus' file in tor's data directory * tor metrics, at https://metrics.torproject.org/data.html * directory authorities and mirrors via their DirPort ... and contai...
reverendhomer/ANUS-Python-Menu
l.py
#!/usr/bin/env python3 import curses from CursesMenu import CursesMenu def foo(): print('baaaang!') return 0 if __name__ == '__main__': s = curses.initscr() m = CursesMenu(s, 'menu') m.add('one', foo) m.add('two', foo) m.add('three', foo) try: m.run() except Exception: ...
piotr-worotnicki/raspberry-pi-rgb-led-controller
led/migrations/0003_auto_20190101_2024.py
# Generated by Django 2.1.1 on 2019-01-01 19:24 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('led', '0002_auto_20181229_2037'), ] operations = [ migrations.RemoveField( model_name='currentledstate', name='blue', ...
zzzzzzzlmy/MyLeetCode
771. Jewels and Stones.py
''' You're given strings J representing the types of stones that are jewels, and S representing the stones you have. Each character in S is a type of stone you have. You want to know how many of the stones you have are also jewels. The letters in J are guaranteed distinct, and all characters in J and S are lette...
coinfee/coinfee-python
example/wsgi.py
""" coinfee.net example. """ import warnings from uuid import uuid4 as random_uuid import jinja2 import coinfee # You should change this unless you want to make a donation. ADDRESS = '16jCrzcXo2PxadrQiQwUgwrmEwDGQYBwZq' # Price in Satoshis. 10,000 or more. SATOSHIS = 10000 # See deprecation warnings in logs. warni...
moniker-dns/contractor
contractor/cmd/contractor.py
# Copyright 2013 Hewlett-Packard Development Company, L.P. # # Author: Kiall Mac Innes <kiall@hp.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.apache.org/licenses/L...
box/genty
test/test_genty_repeat.py
# coding: utf-8 from __future__ import unicode_literals from genty import genty_repeat from test.test_case_base import TestCase class GentyRepeatTest(TestCase): """Tests for :mod:`box.test.genty.genty_repeat`.""" def test_repeat_decorator_decorates_function_with_appropriate_repeat_count(self): @gent...
DedMemez/ODS-August-2017
toontowngui/FrameColorPicker.py
# Fuck you Disyer. Stealing my fucking paypal. GET FUCKED: toontown.toontowngui.FrameColorPicker from direct.gui.DirectGui import * from otp.otpgui.ColorPicker import ColorPicker from toontown.toonbase import TTLocalizer, ToontownGlobals class FrameColorPicker(ColorPicker): def __init__(self, minSat, maxSa...
karllessard/tensorflow
tensorflow/python/data/experimental/kernel_tests/data_service_ops_ft_test.py
# Copyright 2020 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...
foxish/test-infra
boskos/janitor/janitor.py
#!/usr/bin/env python # Copyright 2016 The Kubernetes 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 appli...
yuanlisky/work
suffixDict/useHanLP_segPro.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ @time: 2017/2/20 9:18 @author: yl """ import re # 处理HanLP的分词结果:① 过滤1个字的词语;② 选择词性为’ns’,’nsf’,’nz’的词语。 class SegPro(object): def __init__(self): pass def process(self, sourcefile, resultfile, tag, filterlength=1): ''' :param sourcefile:...
skuda/client-python
kubernetes/test/test_v1_persistent_volume_claim.py
# coding: utf-8 """ Kubernetes No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) OpenAPI spec version: v1.6.1 Generated by: https://github.com/swagger-api/swagger-codegen.git """ from __future__ import absolute_import import os import sys im...
tensorflow/datasets
tensorflow_datasets/question_answering/mctaco_test.py
# coding=utf-8 # Copyright 2022 The TensorFlow Datasets 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 appl...
jamslevy/gsoc
thirdparty/google_appengine/google/appengine/api/users.py
#!/usr/bin/env python # # Copyright 2007 Google 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 o...
Cyber-Neuron/inception_v3
inception/inception/inception_eval.py
# Copyright 2016 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...
tensorflow/neural-structured-learning
research/gam/gam/models/gcn.py
# Copyright 2019 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, ...
vijayendrabvs/hap
neutron/tests/unit/openvswitch/test_ovs_lib.py
# Copyright 2012, VMware, 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 agre...
our-city-app/oca-backend
src/rogerthat/bizz/communities/geo_fence.py
# -*- coding: utf-8 -*- # Copyright 2021 Green Valley NV # # 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 l...
grycap/scar
examples/mask-detector-workflow/blurry-faces/src/auto_blur_image.py
# author: Asmaa Mirkhan ~ 2019 import os import argparse import cv2 as cv from DetectorAPI import DetectorAPI def blurBoxes(image, boxes): """ Argument: image -- the image that will be edited as a matrix boxes -- list of boxes that will be blurred, each box must be int the format (x_top_left, y_top_le...
persandstrom/home-assistant
homeassistant/components/homekit/type_fans.py
"""Class to hold all light accessories.""" import logging from pyhap.const import CATEGORY_FAN from homeassistant.components.fan import ( ATTR_DIRECTION, ATTR_OSCILLATING, DIRECTION_FORWARD, DIRECTION_REVERSE, DOMAIN, SERVICE_OSCILLATE, SERVICE_SET_DIRECTION, SUPPORT_DIRECTION, SUPPORT_OSCILLATE) from hom...
javaor/PythonSpider
scrapy_outlink.py
# -*- coding: utf-8 -*- import re import datetime import random import requests from urllib.parse import urlparse from bs4 import BeautifulSoup pages = set() all_exernal_links = set() all_internal_links = set() def get_internal_link(bs_obj, include_url): """ 获取页面所有的内链接 :param bs_obj: :param include_...
rbuffat/pyidf
tests/test_airflownetworkdistributioncomponentheatexchanger.py
import os import tempfile import unittest import logging from pyidf import ValidationLevel import pyidf from pyidf.idf import IDF from pyidf.natural_ventilation_and_duct_leakage import AirflowNetworkDistributionComponentHeatExchanger log = logging.getLogger(__name__) class TestAirflowNetworkDistributionComponentHeatE...
seunghwanl/APMAE4990
webapp/forms.py
from flask_wtf import Form from wtforms.fields import DecimalField, SubmitField, SelectField from wtforms.validators import Required, Length, NumberRange class LatLongForm(Form): months_pairs = [('4', "April"), ('5', "May"), ('6', "June"), ('7', "July"), ('8', "August"), ('9', "September")] days_pairs = [('0',...
vponomaryov/rally
tests/unit/cli/test_envutils.py
# Copyright 2013: Mirantis 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 b...
zstackorg/zstack-woodpecker
integrationtest/vm/multihosts/migrate/test_migrate_vm_with_iso2.py
''' New Integration test for testing running vm migration between hosts when attach ISO. @author: Chenyuan.xu ''' import zstackwoodpecker.test_util as test_util import zstackwoodpecker.test_lib as test_lib import zstackwoodpecker.operations.volume_operations as vol_ops import zstackwoodpecker.operations.resource_ope...
ladderlife/loonie
tools/tests/buck_to_junit.py
#!/usr/bin/env python # Copyright (C) 2015 The Android Open Source Project # # 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...
gundramleifert/exp_tf
models/lp/bdlstm_lp_v18.py
''' Author: Tobi and Gundram ''' from __future__ import print_function import tensorflow as tf from tensorflow.python.ops import ctc_ops as ctc from tensorflow.python.ops import rnn_cell from tensorflow.python.ops.rnn import bidirectional_rnn from util.LoaderUtil import read_image_list, get_list_vals from random impo...
spandanb/horizon
openstack_dashboard/dashboards/project/networks/subnets/workflows.py
# Copyright 2013 NEC Corporation # # 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 ag...
zwhinmedia/TextRank
textrank4zh/util.py
#-*- encoding:utf-8 -*- """ @author: Weihao Zhou @github: https://github.com/zwhinmedia/ """ from __future__ import (absolute_import, division, print_function, unicode_literals) import os import math import networkx as nx import numpy as np import sys try: reload(sys) sys.setdefaul...
google-research/pyreach
pyreach/gyms/pausable_env.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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
uw-it-aca/canvas-sis-provisioner
sis_provisioner/models/enrollment.py
# Copyright 2022 UW-IT, University of Washington # SPDX-License-Identifier: Apache-2.0 from django.db import models, IntegrityError from django.db.models import F from django.conf import settings from django.utils.timezone import utc, localtime from sis_provisioner.models import Import, ImportResource from sis_provisi...
erikr/happinesspackets
happinesspackets/messaging/migrations/0004_auto_20160403_1742.py
# -*- coding: utf-8 -*- # Generated by Django 1.9.2 on 2016-04-03 15:42 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('messaging', '0003_blacklistedemail_stripped_email'), ] operations = [ migrat...
rajpushkar83/cloudmesh
cloudmesh/shell/cm_image.py
#!/usr/bin/env python from __future__ import print_function from docopt import docopt from cloudmesh.cm_mongo import cm_mongo from cloudmesh.config.cm_config import cm_config from cloudmesh_base.logger import LOGGER from tabulate import tabulate log = LOGGER(__file__) def shell_command_image(arguments): """ ...
Keisuke69/libcloud
libcloud/security.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 use ...
ulikoehler/PCBCheck
pcbcheck.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from __future__ import with_statement import os import sys from collections import namedtuple, defaultdict, Counter import subprocess import re from ansicolor import red, yellow, green, black def readFileLines(filename): with open(filename, encoding="iso-8859-1") as i...
scavarda/mysql-dbcompare
mysql-utilities-1.6.0/scripts/mysqldbcompare.py
#!/usr/bin/env python # # Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; version 2 of the License. # # This progra...
stdlib-js/stdlib
lib/node_modules/@stdlib/stats/base/dists/geometric/stdev/test/fixtures/python/runner.py
#!/usr/bin/env python # # @license Apache-2.0 # # Copyright (c) 2018 The Stdlib 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 # # ...
lupyuen/RaspberryPiImage
home/pi/TP-IoT/send_simple_sensor_data.py
#!/usr/bin/env python3 # Send DHT22 sensor data periodically to AWS IoT. import time import datetime import ssl import json import paho.mqtt.client as mqtt import dht22 import pigpio # TODO: Change this to the name of our Raspberry Pi, also known as our "Thing Name" deviceName = "g88pi" # Public certificate of our ...
scottdangelo/RemoveVolumeMangerLocks
cinder/tests/unit/test_netapp_nfs.py
# Copyright (c) 2012 NetApp, 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...
CAMI-challenge/AMBER
features/steps/cli.py
import os from behave import * @when(u'I run the command') def step_impl(context): context.output = context.env.run( "bash -c '{}'".format(os.path.expandvars(context.text)), expect_error = True, expect_stderr = True) def download_file(link, out): import wget return wget.download(l...
arcpy/sample-gp-tools
SharePackage2/ago.py
#! -*- coding: utf-8; mode: python -*- """ ago.py: interact with an ArcGIS Portal instance """ import arcpy import json import time import datetime import mimetypes import gzip import random import string import getpass import sys import os from io import BytesIO import codecs import uuid import shutil try: import...
eWUDAPT/eWUDAPT-analysis
eWUDAPT_analysis/analysis_single.py
from eWUDAPT_analysis.utils import * from pylab import * from netCDF4 import Dataset, num2date import datetime import matplotlib.pyplot as plt import matplotlib.dates as mdates class analysis_single: def __init__(self, args, json): self.filename = args.filename self.outputdir = args.outputdir self.ncdf_...
google-research/google-research
optimizing_interpretability/metrics_utils.py
# coding=utf-8 # Copyright 2022 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...
openstack/os-win
os_win/tests/functional/test_vhdutils.py
# Copyright 2019 Cloudbase Solutions Srl # 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 r...
mayfield/snowflake-connector-python
test/test_converter_more_timestamp.py
from datetime import timedelta, datetime import pytz from dateutil.parser import parse from snowflake.connector.converter import (SnowflakeConverter) def test_fetch_various_timestamps(conn_cnx): """ More coverage of timestamp Currently TIMESTAMP_LTZ is not tested. """ PST_TZ = "America/Los_Angel...
cloudbase/nova-vix-driver
vix/utils.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2013 Cloudbase Solutions Srl # 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.ap...
Imperat/SSU-Courses
ssu-modeling/chapter2/subchapter1/game.py
import random class Game(object): firstCount = 0 secondCount = 0 playerNumber = 0 def play(self): currentCount = random.choice(range(1,7)) if (self.playerNumber == 0): self.firstCount += currentCount self.playerNumber = 1 if self.firstCount == self....
clach04/pyopenroad
pyvosa.py
#!/usr/bin/env python # -*- coding: us-ascii -*- # vim:ts=4:sw=4:softtabstop=4:smarttab:expandtab # """OpenROAD app server read-only vosa (nee vasa) experiment either under Windows or cross platform with Java. Based on code in OpenROAD 4.1 vasa_apps.asp Windows/DCOM requires CPython Win32 Extensions to access DCOM, a...
jason-weirather/Au-public
iron/pythonlib/Bio/Format/GPD.py
import uuid, sys, time, re import Bio.Structure from Bio.Range import GenomicRange from subprocess import Popen, PIPE # This whole format is a subclass of the Transcript subclass class GPD(Bio.Structure.Transcript): def __init__(self,gpd_line): # Only store the line and ID at first. self._line = gpd_line.r...
tmills/uda
scripts/learn_pivots_gradient_reversal.py
#!/usr/bin/python import sys from os.path import join,exists,dirname import random import numpy as np from numpy.random import randint, choice from sklearn.datasets import load_svmlight_file from torch.autograd import Function, Variable import torch.nn as nn import torch.optim as optim import torch from torch import F...
fujii-team/GPinv
GPinv/kernels.py
import tensorflow as tf import numpy as np import GPflow from GPflow import kernels from GPflow.tf_wraps import eye from GPflow._settings import settings from GPflow.param import ParamList float_type = settings.dtypes.float_type np_float_type = np.float32 if float_type is tf.float32 else np.float64 class Kern(object):...
cmusatyalab/gammaray
src/gray-inferencer/ext4/journal-parser.py
#!/usr/bin/env python # vim:set nospell: from LogRecord import LogRecord from struct import unpack from sys import argv from uuid import UUID SECTOR_SIZE = 512 # 0x0 __be32 h_magic jbd2 magic number, 0xC03B3998. # 0x4 __be32 h_blocktype Description of what this block contains. One of: # 1 Descriptor....
nesterione/core-of-my-services
scripts/run_ads_ranking.py
# coding=utf-8 import pymongo import re from math import exp from datetime import date, datetime connection = pymongo.MongoClient("") db = connection.dataservices ads = db.ads # 1 - Указан ли адрес # 2 - Указаны ли контактные данные # 3 - Наличие фотографий Больше 1, тоже плюс # 4 - Давность подачи объявления # 5 - У...
googleapis/python-resource-manager
samples/generated_samples/cloudresourcemanager_v3_generated_tag_bindings_create_tag_binding_sync.py
# -*- coding: utf-8 -*- # Copyright 2022 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...
rackspace-titan/stacktester
stacktester/tests/test_images.py
import json import os import re import unittest2 as unittest from stacktester import openstack class ImagesTest(unittest.TestCase): def setUp(self): self.os = openstack.Manager() host = self.os.config.nova.host port = self.os.config.nova.port def tearDown(self): pass ...
tensorflow/federated
tensorflow_federated/python/core/impl/compiler/tensorflow_computation_factory.py
# Copyright 2019, The TensorFlow Federated 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...
jdwittenauer/ionyx
tests/experiment_test.py
from sklearn.linear_model import LogisticRegression from sklearn.model_selection import KFold from xgboost import XGBRegressor from keras.wrappers.scikit_learn import KerasRegressor from ionyx import Experiment from ionyx.contrib.keras_builder import KerasBuilder from ionyx.datasets import DataSetLoader print('Beginni...
luzheqi1987/nova-annotation
nova/tests/unit/virt/xenapi/test_driver.py
# Copyright (c) 2013 Rackspace Hosting # # 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...
google/myelin-acorn-electron-hardware
cpu_socket_minispartan_daughterboard/fpga-without-cpu/rom_from_vhdl.py
from __future__ import print_function # Copyright 2017 Google 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 ap...
ratio/google-app-engine-django
appengine_django/db/base.py
#!/usr/bin/python2.4 # # Copyright 2008 Google 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...
danclegg/python-CAS-RESTful-client
ST.py
#!/usr/bin/env python3 ##### # # Title: ST.py # Author: Dan Clegg # Copyright: 2016, Dan Clegg # LICENSE: Apache 2.0 # ##### import requests import string import urllib3.contrib.pyopenssl # Necessary to get around Python 3 ssl errors when calling an https endpoint from parse import * from lxml import etree def POST(...
matrix-org/synapse
synapse/handlers/room_member.py
# Copyright 2016-2020 The Matrix.org Foundation C.I.C. # Copyright 2020 Sorunome # # 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 ...
google-research/google-research
t5_closed_book_qa/t5_cbqa/tasks.py
# coding=utf-8 # Copyright 2022 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...
planetlabs/notebooks
jupyter-notebooks/landsat-ps-comparison/visual.py
import matplotlib.pyplot as plt import numpy as np def plot_image(masked_bands, title=None, figsize=(10, 10)): fig = plt.figure(figsize=figsize) ax = fig.add_subplot(1, 1, 1) show(ax, masked_bands) if title: ax.set_title(title) ax.set_axis_off() def show(axis, bands, alpha=True): """...
zhaopu7/models
text_classification/infer.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys import os import gzip import paddle.v2 as paddle import network_conf import reader from utils import * def infer(topology, data_dir, model_path, word_dict_path, label_dict_path, batch_size): def _infer_a_batch(inferer, test_batch, ids_2_word, id...
sbunatyan/tavrida
tavrida/proxies.py
#!/usr/bin/env python # Copyright (c) 2015 Sergey Bunatyan <sergey.bunatyan@gmail.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.apache.org/licenses/LICENSE-2.0 # # Un...
scorelab/DroneSym
dronesym-python/flask-api/src/main.py
""" Main entry point for the Flask API. The API will provide """ # an interface to communicate with Dronekit instances from flask import jsonify, Flask from flask import abort, request from flask import make_response import dronepool import threadrunner app = Flask(__name__) api_base_url = '/dronesym/api/flask' # re...
dkluffy/dkluff-code
code/f5tools/configparse_f5.py
#!/usr/bin/env python #parser {} mode f5config to csv import sys import re REG_IP=re.compile(r'[1-9][0-9]*(\.[0-9]+){3}') REG_INDENT=re.compile('^[ ]*') EOF='{' FOE='}' """ config for read argv of subcmd""" BLOCK_SUBCMD = ( "members", "origins", "rules", ) NONBLOCK_SUBCMD = ( ...
hajicj/MUSCIMarker
MUSCIMarker/mlclass_selection.py
"""This module implements a class that...""" from __future__ import print_function, unicode_literals from builtins import range import logging from kivy.app import App from kivy.core.window import Window from kivy.lang import Builder from kivy.properties import StringProperty from kivy.uix.popup import Popup from MU...
googleapis/python-dialogflow
samples/generated_samples/dialogflow_v2_generated_entity_types_batch_create_entities_sync.py
# -*- coding: utf-8 -*- # Copyright 2022 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...
suensummit/erjsTesting
testServer.py
import SimpleHTTPServer import SocketServer import sys PORT = 1548 class MyHTTPHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): log_file = open('logfile.txt', 'w') def log_message(self, format, *args): self.log_file.write("%s - - [%s] %s\n" % (self.client_address[0], ...
wwitzel3/awx
awx/api/urls/job.py
# Copyright (c) 2017 Ansible, Inc. # All Rights Reserved. from django.conf.urls import url from awx.api.views import ( JobList, JobDetail, JobStart, JobCancel, JobRelaunch, JobCreateSchedule, JobJobHostSummariesList, JobJobEventsList, JobActivityStreamList, JobStdout, JobNo...
google/citest
tests/json_predicate/path_transforms_test.py
# Copyright 2016 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...
Danceiny/HackGirlfriend
Platform/ZuiwanCenter/ZuiwanDBManager.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys reload(sys) sys.setdefaultencoding('utf-8') import json from Libraries.Singleton.Singleton import Singleton import Libraries.ErrorDefine as ED from Libraries.DBModel import * from Platform.ConfigCenter.ConfigCenter import ConfigCenter from Platform.LogCenter.Lo...
saltstack/salt
tests/integration/utils/test_win_runas.py
import inspect import logging import os import socket import subprocess import sys import textwrap import threading import time import traceback import salt.utils.files import salt.utils.win_runas import yaml from tests.support.case import ModuleCase from tests.support.helpers import with_system_user from tests.suppor...
fmfi-svt/votr
aisikl/components/action.py
from aisikl.events import action_event from .component import Component, is_true class Action(Component): def __init__(self, dialog, id, type, parent_id, properties, element): super().__init__(dialog, id, type, parent_id, properties, element) self.accessible = properties.get('accessible', True) ...
PyThaiNLP/pythainlp
pythainlp/util/__init__.py
# -*- coding: utf-8 -*- """ Utility functions, like date conversion and digit conversion """ __all__ = [ "Trie", "arabic_digit_to_thai_digit", "bahttext", "collate", "countthai", "delete_tone", "dict_trie", "digit_to_text", "display_thai_char", "emoji_to_thai", "eng_to_thai...
pkimber/checkout
example_checkout/urls.py
# -*- encoding: utf-8 -*- 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 django.contrib.staticfiles.urls import staticfiles_urlpatterns from django.core.urlresolvers import reverse_lazy from django.vie...
lukas-ke/faint-graphics-editor
build-sys/build_sys/gen_text_expressions.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright 2014 Lukas Kemmer # # 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 # # Unl...
google-research/unique-randomizer
unique_randomizer/stochastic_beam_search.py
# Copyright 2020 The UniqueRandomizer 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 agre...
tellproject/helper_scripts
mbclient.py
#!/usr/bin/env python import os from argparse import ArgumentParser from threaded_ssh import ThreadedClients from ServerConfig import Storage from ServerConfig import TellStore from ServerConfig import Kudu from ServerConfig import Cassandra from ServerConfig import Microbench def startMBClient(populate = False, uoutF...
tensorflow/benchmarks
scripts/tf_cnn_benchmarks/batch_allreduce.py
# Copyright 2018 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...
red-hood/calendarserver
contrib/od/test/test_live.py
## # Copyright (c) 2014-2015 Apple 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 l...
nathanbjenx/cairis
cairis/gui/ConcernAssociationListCtrl.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...
vivekpabani/projecteuler
python/017/problem_017.py
#!/usr/bin/env python """ Problem Definition : If the numbers 1 to 5 are written out in words: one, two, three, four, five, then there are 3 + 3 + 5 + 4 + 4 = 19 letters used in total. If all the numbers from 1 to 1000 (one thousand) inclusive were written out in words, how many letters would be used? NOTE: Do not c...
shengwen1994/calvin-base
setup.py
# -*- coding: utf-8 -*- # Copyright (c) 2015 Ericsson AB # # 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 ...
semprix/CTFIgniter
payload/CTFd/tests/helpers.py
from CTFd import create_app from CTFd.models import * from sqlalchemy_utils import database_exists, create_database, drop_database from sqlalchemy.engine.url import make_url def create_ctfd(ctf_name="CTFd", name="admin", email="admin@ctfd.io", password="password", setup=True): app = create_app('CTFd.config.Testin...
birdage/ooi-ui-services
ooiservices/app/main/c2_mission.py
#!/usr/bin/env python ''' API v1.0 Command and Control (C2) routes for Mission Control ''' __author__ = 'Edna Donoughe' from flask import jsonify from ooiservices.app.main import api from ooiservices.app.models import Array import json from ooiservices.app.main.errors import bad_request from ooiservices.app.main.authe...
sony/nnabla
python/test/function/test_broadcast_to.py
# Copyright 2018,2019,2020,2021 Sony Corporation. # # 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...
RedHatInsights/insights-core
insights/parsers/satellite_postgresql_query.py
""" Satellite PostgreSQL database queries ===================================== This module contains the following parsers: SatelliteAdminSettings - command ``psql -d foreman -c 'select name, value, "default" from settings where name in (\'destroy_vm_on_host_delete\', \'unregister_delete_host\') --csv'`` ------------...
michaupl/braincloud
brainblog/tasks.py
import datetime from django.contrib.sessions.models import Session from celery import task from celery.utils.log import get_task_logger from brainindex.index import create_thought, update_thought, delete_thought, CREATE, UPDATE, DELETE logger = get_task_logger(__name__) @task(ignore_result = True) def clear_exp...
w4n9H/PythonSkillTree
Distributed/ProcessThread/LocalProcessQueue.py
# !/usr/bin/env python # -*- coding: utf-8 -*- """ @author: mango @contact: w4n9@sina.com @create: 16/7/1 hail hydra! """ __author__ = "mango" __version__ = "0.1" from multiprocessing import Process, Queue import uuid def process(q): """ test process """ content = str(uuid.uuid4()) for i in ra...
Interoute/API-fun-and-education
dcg_member_listing.py
#! /usr/bin/env python # Python script for the Interoute Virtual Data Centre API: # Name: dcg_member_listing.py # Purpose: List the properties and membership of Direct Connect Groups # Requires: class VDCApiCall in the file vdc_api_call.py # See the repo: https://github.com/Interoute/API-fun-and-education # # You...
dek-odoo/python-samples
python exercises/dek_program043.py
# !/user/bin/python # -*- coding: utf-8 -*- #- Author : (DEK) Devendra Kavthekar # Write a program to generate and print another tuple whose values are # even numbers in the given tuple (1,2,3,4,5,6,7,8,9,10). # Hints: # Use "for" to iterate the tuple # Use tuple() to generate a tuple from a list. def main(): v...
liosha2007/temporary-groupdocs-python-sdk
groupdocs/models/CreateFolderResponse.py
#!/usr/bin/env python """ Copyright 2012 GroupDocs. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable...
GoogleCloudDataproc/dataprocmagic
googledataprocauthenticator/controllerwidget/createsessionwidget.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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
mlflow/mlflow
tests/statsmodels/test_statsmodels_model_export.py
import pytest import numpy as np import pandas as pd from unittest import mock import os import yaml import mlflow.statsmodels import mlflow.utils import mlflow.pyfunc.scoring_server as pyfunc_scoring_server from mlflow import pyfunc from mlflow.models.utils import _read_example from mlflow.models import M...
stanley-cheung/grpc
tools/buildgen/extract_metadata_from_bazel_xml.py
#!/usr/bin/env python3 # Copyright 2020 The gRPC 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 l...
genius1611/horizon
django-openstack/django_openstack/tests/api_tests.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2011 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2011 Nebula, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # no...
Onager/dftimewolf
dftimewolf/lib/collectors/grr_hosts.py
# -*- coding: utf-8 -*- """Definition of modules for collecting data from GRR hosts.""" import datetime import os import re import threading import time import zipfile from grr_api_client import errors as grr_errors from grr_response_proto import flows_pb2, timeline_pb2 from dftimewolf.lib.collectors.grr_base import...