repo_name
stringlengths
5
104
path
stringlengths
4
248
content
stringlengths
102
99.9k
operasoftware/dragonfly-build-tools
df2/db2js.py
import os import sys import re import codecs import time import argparse def get_timestamp(): return time.strftime("%a %d %b %Y %H:%M", time.localtime()) class JSFileParseError(Exception): def __init__(self, value): self.value = value def __str__(self): return self.value """ S_LITERAL_AGRE...
asvetlov/motor
test/test_motor_ssl.py
# Copyright 2012-2014 MongoDB, 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 writin...
alexander-bzikadze/graph_diff
graph_diff/nirvana_object_model/workflow_to_dot_converter/graph_map_dot_colorer.py
from abc import ABC, abstractmethod from graph_diff.nirvana_object_model.workflow import Block class GraphDotColorer(ABC): """Interface for graph workflow colorer""" @abstractmethod def color_of_block(self, block: Block, number: int): pass @abstractmeth...
QISKit/qiskit-sdk-py
qiskit/extensions/standard/rz.py
# -*- coding: utf-8 -*- # This code is part of Qiskit. # # (C) Copyright IBM 2017. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modif...
LernerLabs/PyPAT
drivers/display_bridging_interactions.py
#!/cluster/home2/mglerner/anaconda3/bin/python #!/usr/bin/env python import sys,os if __name__ == '__main__': from pypat.hbond import pymol_hbond_analysis from pypat import tool_utils from optparse import OptionParser parser = OptionParser(option_class=tool_utils.MyOption) parser.add_option...
xzturn/caffe2
caffe2/python/core_test.py
from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals from inspect import currentframe, getframeinfo import unittest import numpy as np from caffe2.proto import caffe2_pb2 from caffe2.python import core, workspace, test_ut...
google/gazoo-device
gazoo_device/auxiliary_devices/esp32.py
# 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 agreed to in writing, ...
richbrowne/f5-openstack-agent
test/functional/neutronless/conftest.py
# coding=utf-8 # Copyright 2016-2017 F5 Networks 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 ...
wavefrontHQ/python-client
test/test_specific_data.py
# coding: utf-8 """ Wavefront REST API <p>The Wavefront REST API enables you to interact with Wavefront servers using standard REST API tools. You can use the REST API to automate commonly executed operations such as automatically tagging sources.</p><p>When you make REST API calls outside the Wavefront REST ...
rach/suma
suma/web/settings/service.py
from suma.common.services import ( link_service_factory, task_service_factory, hashid_service_factory, file_service_factory ) from sqlalchemy import engine_from_config from suma.core.models.meta import ( create_dbsession ) import zope.sqlalchemy def includeme(config): engine = engine_from_conf...
turbulent/substance
substance/subenv/command/delete.py
import os import logging import shlex from substance.logs import * from substance.exceptions import (InvalidOptionError) from substance import Command from substance.subenv import (SubenvAPI) class Delete(Command): def getUsage(self): return "subenv delete [ENV NAME]" def getHelpTitle(self): ...
xe1gyq/eekmex
spacecraft/subsystems/emaprsnet.py
import ConfigParser import logging import string import sys from socket import * class EmAprsNet(object): def __init__(self): self.configuration() def configuration(self): self.conf = ConfigParser.ConfigParser() self.services = "configuration/services.config" self.conf.read(s...
rmhsawyer/EC601-Project1
customModel.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Sep 16 15:42:41 2017 @author: andrewsmac """ import numpy as np import tensorflow as tf # Declare list of features, we only have one real-valued feature def model_fn(features, labels, mode): # Build a linear model and predict values W = tf.get_var...
layzerar/flexpack
tools/flexc/scripts/flexc.py
# -*- coding: utf-8 -*- # # Copyright 2016 Melvi Ts <layzerar@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 # # Unless require...
wooga/airflow
tests/test_utils/mock_process.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...
Shrews/PyGerrit
webapp/codereview/memcache.py
# 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 agreed to in writing, ...
algorhythms/LintCode
archive/Count of Smaller Number before itself.py
""" Give you an integer array (index from 0 to n-1, where n is the size of this array, value from 0 to 10000) . For each element Ai in the array, count the number of element before this element Ai is smaller than it and return count number array. Example For array [1,2,7,8,5], return [0,1,2,3,2] Note We suggest you f...
Netflix/lemur
lemur/tests/test_verify.py
import pytest from cryptography import x509 from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives import serialization, hashes from cryptography.x509 import UniformResourceIdentifier from lemur.certificates.verify import verify_string, crl_verify from lemur.utils import mktempfil...
wisechengyi/pants
src/python/pants/help/help_integration_test.py
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from pants.testutil.pants_run_integration_test import PantsRunIntegrationTest class TestHelpIntegration(PantsRunIntegrationTest): def test_help(self): command = ["help"] ...
poojavade/Genomics_Docker
Dockerfiles/gedlab-khmer-filter-abund/pymodules/python2.7/lib/python/saga_python-0.18-py2.7.egg/saga/utils/pty_process.py
__author__ = "Andre Merzky" __copyright__ = "Copyright 2012-2013, The SAGA Project" __license__ = "MIT" import re import os import sys import pty import tty import time import errno import shlex import select import signal import termios import radical.utils as ru import radical.utils.logger as rul i...
SteelToeOSS/Samples
pysteel/scaffold/cloudfoundry.py
import os import re from urllib.parse import urlparse from pysteel import cloudfoundry def setup(context, scenario): """ set up scenario scaffolding for Cloud Foundry samples :type context: behave.runner.Context :type scenario: behave.model.Scenario """ cf = cloudfoundry.CloudFoundry(context)...
ariutta/target-interaction-finder
targetinteractionfinder/regexes.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import re # based on the regexes from http://identifiers.org/mirbase.mature/ # and http://identifiers.org/mirbase/ identifiers_org = re.compile('^http:\/\/identifiers.org\/.*\/') # based on the regexes from http://identifiers.org/mirbase.mature/ # and http://identifiers....
saltstack/salt
salt/proxy/napalm.py
""" NAPALM: Network Automation and Programmability Abstraction Layer with Multivendor support ========================================================================================= .. versionadded:: 2016.11.0 Proxy minion for managing network devices via NAPALM_ library. :codeauthor: Mircea Ulinic <ping@mirceauli...
Erotemic/dtool
dev/sandbox/test_sql.py
""" https://www.sqlite.org/download.html cd ~/tmp wget https://www.sqlite.org/2016/sqlite-amalgamation-3140200.zip 7z x sqlite-*.zip """ import sqlite3 as lite from concurrent import futures import utool as ut import math fpath = 'temp.sqlite3' connection = lite.connect(fpath, detect_types=lite.PARSE_DECLTYPES, chec...
Jitsusama/lets-do-dns
lets_do_dns/environment.py
"""Environment Wrapper and Validator.""" from lets_do_dns.errors import InputError class Environment(object): """Validates and Stores Desired Environment Variables.""" def __init__(self, environment): self._environ = environment self._missing_parameters = list() # Required Parameters...
CargoSpace/CargoSpaceChallenge
acm/admin.py
from django.contrib import admin from .models import Challenge, School, Group, Member # Register your models here. @admin.register(Challenge) class ChallengeAdmin(admin.ModelAdmin): list_display = ('title', 'description', 'start_time', 'end_time', 'registration_close_at',) search_fields = ('title', 'description', ) ...
naturali/tensorflow
tensorflow/contrib/distributions/python/ops/student_t.py
# Copyright 2016 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...
Patreon/cartographer
cartographer/field_types/array_relationship.py
from cartographer.field_types import SchemaRelationship from cartographer.resources.resource_registry import ResourceRegistryKeys class ArrayRelationship(SchemaRelationship): def __init__(self, model_type, model_property=None, model_method=None, serializer_method=None, includes=None): sup...
emirot/codefights
intro/fileNaming.py
def until_last_paranthesis_number(s): i = s.rfind('(') if i == -1: return s else: return s[:i] def get_number_inside_partenthesis(s): i = s.rfind('(') j = s.rfind(')') return int(s[i+1:j]) def add_in_array(d_r, r): if '(' in r: v = until_last_paranthesis_number(r...
quaddra/engage
python_pkg/engage/drivers/shared_resource_mixin.py
""" Mixins for resource managers that support creating shared resources. A shared resource is a resource that is installed globally on the machine, may be used simultaneously by independent genForma installs, and may used by subsequent installs of a given app. Examples include apache, mysql, postgress, etc. """ import ...
redhat-openstack/rdo-infra
jcomparison/api.py
# -*- coding: utf-8 -*- from flask import Flask, abort, render_template, request from perfcomp.jobdiff import JobDiff app = Flask(__name__) @app.route('/compare', methods=['GET']) def compare(): good = request.args.get('good') bad = request.args.get('bad') # TODO: add these selections to web page ans...
tdyas/pants
src/python/pants/backend/python/lint/pylint/rules.py
# Copyright 2020 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from dataclasses import dataclass from typing import Optional, Tuple from pants.backend.python.lint.pylint.subsystem import Pylint from pants.backend.python.rules import download_pex_bin,...
anchore/anchore-engine
scripts/tests/aetest.py
#!/usr/bin/python import json import subprocess import sys import time analysis_maxtime = 900 common_maxtime = 60 try: image = str(sys.argv[1]) except: image = "docker.io/alpine:latest" try: aecontainer = str(sys.argv[2]) except: aecontainer = "qadc_anchore-engine_1" # precmd = "docker exec " + str...
PanDAWMS/panda-bigmon-core
core/filebrowser/views.py
""" filebrowser.views """ import logging import re import json from django.http import HttpResponse from django.shortcuts import render_to_response from django.template import RequestContext from django.template.loader import get_template from django.conf import settings from .utils import get_rucio_file, get_...
google-research/dice_rl
google/scripts/run_tabular_robust_dice.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, ...
nkskjames/phosphor-settingsd
settings_manager.py
#!/usr/bin/python -u import gobject import dbus import dbus.service import dbus.mainloop.glib import os import os.path as path import Openbmc import settings_file as s DBUS_NAME = 'org.openbmc.settings.Host' OBJ_NAME = '/org/openbmc/settings/host0' CONTROL_INTF = 'org.openbmc.Settings' class HostSettingsObject(Openb...
google-research/jax3d
jax3d/projects/nesf/utils/__init__.py
# Copyright 2022 The jax3d 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 wr...
cclauss/Pythonista_ui
save_py_source.py
import datetime, os, zipfile exts = 'py pyui'.split() zip_file_name = 'aa_source_code_%Y_%m_%d_%H_%M_%S.zip' zip_file_name = datetime.datetime.strftime(datetime.datetime.now(), zip_file_name) def get_filenames(in_dir=None): def visit(_, dirname, names): for name in names: filename = os.path.jo...
sangeethah/validation-tests
tests/v2_validation/cattlevalidationtest/core/test_k8_ingress.py
from common_fixtures import * # NOQA if_test_k8s = pytest.mark.skipif( RANCHER_ORCHESTRATION != "k8s", reason='RANCHER_ORCHESTRATION is not k8s') random_ns = random_str() @if_test_k8s def test_k8s_ingress_1(kube_hosts): # This method tests an ingress with host, paths specified and two services # C...
Onager/l2tdevtools
l2tdevtools/build_helpers/source.py
# -*- coding: utf-8 -*- """Helper for building projects from source.""" from __future__ import unicode_literals import logging import os import subprocess import sys from l2tdevtools.build_helpers import interface class SourceBuildHelper(interface.BuildHelper): """Helper to build projects from source.""" class...
qrealka/skia-hc
third_party/externals/shaderc2/glslc/test/glslc_test_framework.py
#!/usr/bin/env python # Copyright 2015 The Shaderc 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 ...
ultradns/dns_sprockets
dns_sprockets_lib/validators/tests/test_nsec_orphan.py
''' test_nsec_orphan - Tests nsec_orphan validator. .. Copyright (c) 2015 Neustar, Inc. All rights reserved. .. See COPYRIGHT.txt for full notice. See LICENSE.txt for terms and conditions. ''' # pylint: skip-file import dns_sprockets_lib.validators.tests.harness as harness def test_nsec_orphan(): (tests, err...
vmtk/SlicerExtension-VMTK
StenosisMeasurement1D/StenosisMeasurement1D.py
import os import unittest import logging import vtk, qt, ctk, slicer from slicer.ScriptedLoadableModule import * from slicer.util import VTKObservationMixin # # StenosisMeasurement1D # class StenosisMeasurement1D(ScriptedLoadableModule): """Uses ScriptedLoadableModule base class, available at: https://github.com/...
annikaliebgott/ImFEATbox
features_python/ImFEATbox/GlobalFeatures/Moment/_AffineMomentsF.py
import numpy as np def AffineMomentsF(I, returnShape=False): """ Input: - I: A 2D image Output: - Out: A (1x6) vector containing 6 moment features """ # ************************************************************************ # Modified for MRI feature extraction by the Department of D...
SunWalter/Hard
ex7.py
print ("Mary had a little lamb.") print ("Its fleece was white as %s." % 'snow') print ("And everywhere that Mary went.") print ("." * 10) end1 = "C" end2 = "h" end3 = "e" end4 = "e" end5 = "s" end6 = "e" end7 = "B" end8 = "u" end9 = "r" end10 = "g" end11 = "e" end12 = "r" # watch the comma at the end. try removing i...
scottdarch/Noer
FRDMK66NoEr/SDK_2.1_FRDM-K66F-GCC-Full/boards/frdmk66f/multiprocessor_examples/erpc_common/erpc_matrix_multiply/service/erpc_matrix_multiply/client.py
# # Generated by erpcgen 1.3.0 on Mon Sep 5 16:12:50 2016. # # AUTOGENERATED - DO NOT EDIT # import erpc from . import common, interface # Client for MatrixMultiplyService class MatrixMultiplyServiceClient(interface.IMatrixMultiplyService): def __init__(self, manager): super(MatrixMultiplyServiceClient, ...
asphalt-framework/asphalt-serialization
docs/conf.py
#!/usr/bin/env python3 import pkg_resources extensions = [ 'sphinx.ext.autodoc', 'sphinx.ext.intersphinx', 'sphinx_autodoc_typehints', 'sphinxcontrib.asyncio' ] templates_path = ['_templates'] source_suffix = '.rst' master_doc = 'index' project = 'asphalt-serialization' author = 'Alex Grönholm' copy...
jangorecki/h2o-3
h2o-py/h2o/estimators/deepwater.py
#!/usr/bin/env python # -*- encoding: utf-8 -*- # # This file is auto-generated by h2o-3/h2o-bindings/bin/gen_python.py # Copyright 2016 H2O.ai; Apache License Version 2.0 (see LICENSE for details) # from __future__ import absolute_import, division, print_function, unicode_literals from h2o.estimators.estimator_base ...
NetApp/manila
manila/share/drivers/zfsonlinux/utils.py
# Copyright 2016 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 by...
flamingcowtv/cosmopolite
cron.py
# Copyright 2014, Ian Gulliver # # 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...
CCI-MOC/moc-openstack-tools
quotas.py
# Copyright 2016 Massachusetts Open Cloud # # 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...
14thibea/megamix
test/test_batch_GMM.py
import numpy as np from scipy.misc import logsumexp from numpy.testing import assert_almost_equal import pytest import h5py from megamix.batch import Kmeans, GaussianMixture from megamix.batch.base import _log_normal_matrix from megamix.batch.base import _full_covariance_matrices, _spherical_covariance_matrices from me...
NervanaSystems/coach
rl_coach/renderer.py
# # Copyright (c) 2017 Intel 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 agreed to...
zhuhuifeng/PyML
mla/rl/dqn.py
import logging import random import gym import numpy as np from gym import wrappers from six.moves import range np.random.seed(9999) logger = logging.getLogger() logger.setLevel(logging.INFO) """ References: Sutton, Barto (2017). Reinforcement Learning: An Introduction. MIT Press, Cambridge, MA. """ class DQN...
CiscoSystems/don
openstack_dashboard/don/api.py
from don import models def save_data(timestamp, data): wb = models.collector.objects.create(timestamp=timestamp, data=data) wb.save() return True def list_collection(request): return models.collector.objects.values('id', 'timestamp', 'data') def get_collection(request, id=None): try: r...
oppia/oppia
core/domain/recommendations_services.py
# coding: utf-8 # # Copyright 2015 The Oppia 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 requi...
vshandubey/movie-database
ui/home/MovieTable.py
from PyQt4 import QtGui, QtCore from core.repository import MovieRepository import core.Constants as Constants class MovieTable(QtGui.QTableWidget): def __init__(self, mainWindow): self.mainWindow = mainWindow super(MovieTable, self).__init__() #Init database se...
shinfan/artman
test/cli/test_main.py
# Copyright 2017 Google # # 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, softwa...
google-research/google-research
kws_streaming/layers/mel_table_test.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...
lugray/amphtml
validator/build.py
#!/usr/bin/python2.7 # # Copyright 2015 The AMP HTML 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 # # Unle...
xqt2010a/Python_Study
python/07_JLink_RTT/SERCOM.py
#coding: utf-8 ''' 升级记录 ''' import sys, os, re import ConfigParser import ctypes, struct import threading, time import sip sip.setapi('QString', 2) from PyQt4 import QtCore, QtGui, uic import PyQt4.Qwt5 as Qwt from PyQt4.Qwt5 import QwtPlot class RingBuffer(object): def __init__(self, arr): self.sName, s...
30loops/nova
nova/virt/hyperv.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright (c) 2010 Cloud.com, 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....
pcmoritz/ray-1
python/ray/autoscaler/_private/gcp/config.py
import copy from functools import partial import json import os import logging import time from cryptography.hazmat.primitives import serialization from cryptography.hazmat.primitives.asymmetric import rsa from cryptography.hazmat.backends import default_backend from googleapiclient import discovery, errors from googl...
zhlinh/leetcode
0222.Count Complete Tree Nodes/solution.py
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' ***************************************** Author: zhlinh Email: zhlinhng@gmail.com Version: 0.0.1 Created Time: 2016-04-11 Last_modify: 2016-04-11 ****************************************** ''' ''' Given a complete binary tree, count the nu...
iluoyi/pattern-recognition-course
Homework/HW4/contour3.py
#!/usr/bin/env python from __future__ import division import matplotlib import numpy as np import matplotlib.cm as cm import matplotlib.mlab as mlab import matplotlib.pyplot as plt matplotlib.rcParams['xtick.direction'] = 'out' matplotlib.rcParams['ytick.direction'] = 'out' e = 0.1 delta = 0.025 x = np.arange(-4.0, ...
OpenMined/PySyft
packages/syft/tests/syft/core/io/address_test.py
"""In this test suite, we evaluate the Address class. For more info on the Address class and its purpose, please see the documentation in the class itself. Table of Contents: - INITIALIZATION: tests for various ways Address can/can't be initialized - CLASS METHODS: tests for the use of Address's class methods ...
arkanister/minitickets
lib/utils/views/email/utils.py
# -*- coding: utf-8 -*- from django.core.mail import EmailMessage from django.utils.encoding import force_unicode from django.core.mail.message import EmailMultiAlternatives from django.template.defaultfilters import striptags from django.template.loader import render_to_string class EmailSender(object): sender ...
huggingface/transformers
src/transformers/data/processors/xnli.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA 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 cop...
schristakidis/p2ner
p2ner/components/output/gstoutput/gstoutput/GstOutput.py
# -*- coding: utf-8 -*- # Copyright 2012 Loris Corazza, Sakis Christakidis # # 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 # # U...
drankye/SSM
supports/integration-test/test_copy_1MB_5W.py
import unittest from util import * FILE_SIZE = 1 * 1024 * 1024 BACK_UP_SERVER_IP = "hdfs://namenode_ip" BACK_UP_SERVER_PORT = "9000" class TestCopy_1MB_5W(unittest.TestCase): def test_5W_copy(self): #add rule rule_str = "file : path matches \"/test/1MB/*\" | sync -dest "+ \ BACK_UP_SERVER_IP + ":" + B...
echizentm/CompactDataStructures
chapter_02/get_canonical_huffman_codes.py
# coding: utf-8 import sys from bisect import bisect def parse_text(text): dic = {} for symbol in text: if symbol in dic: dic[symbol] += 1 else: dic[symbol] = 1 return zip( *sorted(dic.items(), reverse=True, key=lambda item: item[1]) ) def huffman_tree...
asen477/scrapy
goods/goods/pipelines.py
#coding=utf-8 ''' Created on 2020年07月30日 @author: Trunks(GaoMing) ''' import os import requests import MySQLdb import MySQLdb.cursors import time from goods.settings import IMAGES_STORE from scrapy.pipelines.images import ImagesPipeline from scrapy import Request from datetime import datetime import json import numpy ...
davidzchen/tensorflow
tensorflow/python/keras/engine/base_preprocessing_layer.py
# Copyright 2019 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...
metesa/MachineLearningInAction-Code
Ch2/kNN.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Part 1 - Chapter 2 - k-Nearest Neighbors from numpy import * import operator import os # Chapter 2.1.1 - Preparation: Import Data with Python def create_dataset(): # Define an 4x2 array(2-Dimensional) group = array([[1.0, 1.1], [1.0, 1.0], [0, 0], [0, 0.1]]) ...
googleapis/python-os-config
google/cloud/osconfig_v1/services/os_config_service/transports/base.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...
sassoftware/rmake3
rmake/failure.py
# # Copyright (c) SAS Institute 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 w...
ranjeethmahankali/TreeGenerator
randTree_old.py
import rhinoscriptsyntax as rs import math import random import time #created on 14th Jan, 2016 #this function returns a random point in the given volume of space defined by the three parameters(from the origin) def placePt(xMin,xMax,yMin,yMax,zMin,zMax): x = random.uniform(xMin,xMax) y = random.uniform(yMin,yMax) ...
Jarn/jarn.mkrelease
tests/test_scmfactory.py
import unittest from jarn.mkrelease.process import Process from jarn.mkrelease.scm import SCMFactory from jarn.mkrelease.testing import quiet from jarn.mkrelease.testing import SubversionSetup from jarn.mkrelease.testing import MercurialSetup from jarn.mkrelease.testing import GitSetup class ScmFromUrlTests(unittes...
chop-dbhi/varify-data-warehouse
vdw/genes/models.py
from django.db import models from django.contrib.auth.models import User from objectset.models import ObjectSet, SetObject from vdw.literature.models import PubMed from vdw.genome.models import Chromosome from vdw.phenotypes.models import Phenotype, PhenotypeThrough from .managers import GeneManager class GeneFamily(...
jdfekete/progressivis
progressivis/stats/correlation.py
from __future__ import annotations from itertools import product import numpy as np import pandas as pd from ..core.module import ReturnRunStep from ..core.utils import indices_len, fix_loc from ..core.slot import SlotDescriptor from ..core.decorators import process_slot, run_if_any from ..table.table_base import Ba...
FreeBirdLjj/py-coreutils
factor.py
#!/usr/bin/env python3 import common import getopt import math import re import sys def usage(prog): print("Usage: %s [NUMBER]..." % prog) print(" or: %s OPTION" % prog) print("Print the prime factors of each specified integer NUMBER. If none") print("are specified on the command line, read them f...
StormyDragon/python-flist
flist/__init__.py
from flist.chat import opcode def account_login(account, password): """Log in to an f-list account. :param account: F-list account name. :param password: Password for the account. """ from flist.account import Account account = Account(account, password) return account.login() def start_...
mikehulluk/morphforge
src/morphforgeexamples/exset2_singlecell_simulations/singlecell_simulation060.py
#!/usr/bin/python # -*- coding: utf-8 -*- # --------------------------------------------------------------------- # Copyright (c) 2012 Michael Hull. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are m...
diverted247/txtjs
tools/font_export/invalid.py
#!/usr/bin/python # -*- coding: latin-1 -*- import os import shutil import glob import string from bs4 import BeautifulSoup from characters import CHARS from vertical import VERTICAL_OFFSET SVG_PATH = "svg" OUT_PATH = "font" OUT_NAME = ".txt" def uconvert( value ): return str( ord( value ) ) def gconvert( valu...
0xicl33n/SideWinder-Encryption
side2.py
#!/usr/bin/python # # SIDEWINDER ENCRYPTION ALGORITHM! # not so simple anymore ._. # # Compliments of 0xicl33n & Zexanima # # # import os import platform #import v v = "2.4.1" # # #replace fucntion def replace_all(text, *dic): for h in dic: for i, j in h.iteritems(): text = text.replace(i, j) return text #clea...
kgeorgy/django-rest-framework
rest_framework/serializers.py
""" Serializers and ModelSerializers are similar to Forms and ModelForms. Unlike forms, they are not constrained to dealing with HTML output, and form encoded input. Serialization in REST framework is a two-phase process: 1. Serializers marshal between complex types like model instances, and python primitives. 2. The...
rmcclosk/spain-trees
03_figures/parse_spain.py
#!/usr/bin/env python """ Parse Spain data """ import csv import sys reader = csv.DictReader(open('00_raw.csv')) data = {} for row in reader: day = int(row["Time point"].split()[-1]) count = int(row["Count"]) try: fpr = float(row['G2P_FPR%']) except ValueError: cont...
Afnarel/django-forms-builder
forms_builder/forms/south_migrations/0008_auto__add_field_formentry_user.py
# -*- coding: utf-8 -*- from south.utils import datetime_utils as datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding field 'FormEntry.user' db.add_column(u'forms_formentry', 'user',...
mjumbewu/django-subscriptions
subscriptions/feeds/dispatch.py
from collections import defaultdict from email.mime.text import MIMEText from django.conf import settings from django.contrib.sites.models import Site from django.core.serializers.json import DjangoJSONEncoder from django.db.models.manager import Manager from django.template import Context from django.template.loader ...
bubenkoff/Arkestra
links/models.py
from urlparse import urlparse from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned from django.db import models from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes import generic from cms.models import CMSPlugin from filer.fields.image import FilerIma...
vdsrd/hunter
scripts/upload-cache-to-github.py
#!/usr/bin/env python3 from __future__ import print_function import argparse import base64 import hashlib import json import os import requests import sys import time class Error(Exception): pass def sleep_time(attempt): if attempt <= 0: raise Exception('Unexpected') if attempt == 1: return 0 if atte...
jayed/popup
PopupServer/PopupServer.py
# -*- coding: utf-8 -*- #Copyright (c) 2012-2013, Meangrape Incorporated #All rights reserved. # #Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: # #Redistributions of source code must retain the above copyright notice, this...
tzwenn/MathGenealogy
db/handler.py
# -*- coding: UTF-8 -*- # Copyright (C) 2010, 2011 Sven Köhler import os import sqlite3 import sys def errPrint(s): sys.stderr.write("[Database] %s" % str(s)) class dbHandler(object): """ Basic Database access and creating of table structure """ def __init__(self): self.con = sqlite3.Connec...
SaravanaPunith/c_complete
python/simple.py
#!/usr/bin/python # welcome print print "Hello saran" # simple evaluation stuff x = 2 print x*x+2 ''' #only string WYSWYG str = raw_input ("intput string ") print"it is ",str #can evaluate str = input ("intput string") print"it is ",str #data types #int i #long l #float f #complex c ''' #strings print "::string exa...
praekelt/molo-gem
gem/tests/test_admin.py
# -*- coding: utf-8 -*- from django.contrib.auth.models import User from django.contrib.contenttypes.models import ContentType from django.contrib.sites.models import Site from django.test import TestCase from django.test.client import Client from django.utils import timezone from gem.models import GemCommentReport fr...
xiongerqi/enki
sample/file/writeFile.py
#! /usr/bin/env python import os filename = raw_input('Enter file name: ') fobj = open(filename,'w') print fobj.fileno() while True: aline = raw_input('Enter a line ("." to quit): ') if aline != ".": fobj.write("%s %s" % (aline,os.linesep)) else: break fobj.flush() #fobj.truncate(5) fobj.close() fobj2 = open(...
GMOD/jbrowse-registry
sync-themes.py
from github import Github import os import json import yaml import subprocess import logging gh = Github( login_or_token=os.environ.get('GITHUB_USERNAME', None) or os.environ.get('GITHUB_OAUTH_TOKEN', None), password=os.environ.get('GITHUB_PASSWORD', None), ) logging.warn("GH API RATE LIMIT: %s/%s" % gh.rate_li...
pystruct/pystruct
pystruct/models/latent_graph_crf.py
import numbers import numpy as np from scipy import sparse from sklearn.cluster import KMeans from . import GraphCRF from ..inference import inference_dispatch def kmeans_init(X, Y, all_edges, n_labels, n_states_per_label, symmetric=True): all_feats = [] # iterate over samples for x, y,...
funkbit/django-analytics-client
analytics_client/tasks.py
# encoding=utf-8 """ Copyright (c) 2012, Funkbit AS. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of condi...
OpenChemistry/tomviz
tomviz/python/Subtract_TiltSer_Background.py
def transform(dataset, XRANGE=None, YRANGE=None, ZRANGE=None): '''For each tilt image, the method uses average pixel value of selected region as the background level and subtracts it from the image.''' '''It does NOT set negative pixels to zero.''' import numpy as np data_bs = dataset.active_sca...