repo_name
stringlengths
5
104
path
stringlengths
4
248
content
stringlengths
102
99.9k
fifa2002nb/twos
utils/appPublish.py
#!/usr/bin/python #-*- coding: utf8 -*- import ConfigParser, os, ftplib, socket class appPublish: def __init__(self): self.cfg = self.parseINI() self.appsPath = os.getcwd().replace("/utils", "/apps") def parseINI(self): cfg = ConfigParser.RawConfigParser() with open("server.i...
fnp/pylucene
test/test_DocBoost.py
# ==================================================================== # 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 re...
lukas-hetzenecker/home-assistant
homeassistant/components/nexia/const.py
"""Nexia constants.""" PLATFORMS = ["sensor", "binary_sensor", "climate", "scene"] ATTRIBUTION = "Data provided by mynexia.com" NOTIFICATION_ID = "nexia_notification" NOTIFICATION_TITLE = "Nexia Setup" CONF_BRAND = "brand" NEXIA_SCAN_INTERVAL = "scan_interval" DOMAIN = "nexia" DEFAULT_ENTITY_NAMESPACE = "nexia" ...
ludovicchabant/Wikked
wikked/commands/query.py
import logging from wikked.commands.base import WikkedCommand, register_command logger = logging.getLogger(__name__) @register_command class ListCommand(WikkedCommand): def __init__(self): super(ListCommand, self).__init__() self.name = 'list' self.description = "Lists page names in the ...
tensorflow/tfx
tfx/tools/cli/handler/airflow_handler.py
# Copyright 2019 Google LLC. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
brutasse/graphite-api
graphite_api/render/grammar.py
from distutils.version import StrictVersion from pyparsing import ( __version__, alphanums, alphas, CaselessKeyword, CaselessLiteral, Combine, delimitedList, FollowedBy, Forward, Group, LineEnd, Literal, OneOrMore, Optional, printables, quotedString, Regex, Word, ZeroOrMore, ) grammar = Forward() express...
tdyas/pants
src/python/pants/backend/codegen/protobuf/java/register.py
# Copyright 2016 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). """Generate Java targets from Protocol Buffers (Protobufs). See https://developers.google.com/protocol-buffers/. """ from pants.backend.codegen.protobuf.java.java_protobuf_library import...
Lazea/TensorFlow
classification/classification_test.py
"""Classification testing""" import os, sys sys.path.append('../') sys.path.append('../models/') sys.path.append('../util/') import cv2 import time import json import importlib import argparse import tensorflow as tf import numpy as np from input_data import Data def compute_accuracy(logits, labels): """Compute...
openstack/octavia
octavia/tests/functional/api/v2/test_provider.py
# Copyright 2018 Rackspace, US 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...
rackerlabs/swift
test/unit/common/test_internal_client.py
# Copyright (c) 2010-2012 OpenStack Foundation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agree...
sebastian-nagel/cc-crawl-statistics
crawlstats.py
import heapq import json import logging import os import re from collections import defaultdict, Counter from enum import Enum from urllib.parse import urlparse import mrjob.util import tldextract import ujson from hyperloglog import HyperLogLog from isoweek import Week from mrjob.job import MRJob, MRStep from mrjob...
HewlettPackard/oneview-ansible
test/test_oneview_fcoe_network_facts.py
#!/usr/bin/python # -*- coding: utf-8 -*- ### # Copyright (2016-2019) Hewlett Packard Enterprise Development LP # # 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/licen...
sony/nnabla
python/src/nnabla/backward_function/shift.py
# Copyright 2019,2020,2021 Sony Corporation. # Copyright 2021 Sony Group 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 # # Un...
tapomay/libgenetic
src_python/hmmtoe/rht_roc.py
pat = 'rach297/finals_data' from os import listdir from os.path import isfile, join onlyfiles = [f for f in listdir(pat) if isfile(join(pat, f)) and f.endswith('.enc')] print(onlyfiles) LIMIT = 5000 def model_scores(model): for fname in onlyfiles: fpath = join(pat, fname) with open(fpath) as f: ...
alokjani/contrail-datapipeline
tools/dummy-http-receiver.py
#!/usr/bin/env python """ Very simple HTTP server in python. Usage:: ./dummy-web-server.py [<port>] Send a GET request:: curl http://localhost Send a HEAD request:: curl -I http://localhost Send a POST request:: curl -d "foo=bar&bin=baz" http://localhost """ from BaseHTTPServer import BaseHTTPRequ...
mistercrunch/panoramix
tests/integration_tests/base_api_tests.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...
ben-ng/swift
utils/swift_build_support/swift_build_support/toolchain.py
# swift_build_support/toolchain.py ------------------------------*- python -*- # # This source file is part of the Swift.org open source project # # Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors # Licensed under Apache License v2.0 with Runtime Library Exception # # See https://swift.org/LICENSE.tx...
jeongmincha/pyjsonts
pyjsonts/time_series_json.py
import json import ijson import numpy as np class TimeSeriesJSON: def __init__(self, f=None, fn=None, tag='item'): """ :param f: file object (_io.TextIOWrapper) :param fn: file name as a string :param tag: tag for dividing json items default value is 'item' because thi...
maestro-hybrid-cloud/heat
heat/engine/resources/openstack/nova/server.py
# # 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, software # ...
Esri/military-tools-geoprocessing-toolbox
tools/militarytools/esri/toolboxes/scripts/RangeRingFromMinMaxTable.py
# coding: utf-8 ''' ------------------------------------------------------------------------------ Copyright 2016 Esri 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/license...
nagyistoce/geokey
geokey/contributions/tests/comments/test_views.py
import json from django.test import TestCase from django.contrib.auth.models import AnonymousUser from django.core.urlresolvers import reverse from django.core.exceptions import PermissionDenied from nose.tools import raises from rest_framework.test import APITestCase from rest_framework.test import APIRequestFactor...
google/TaglessCRM
src/dags/gcs_to_ads_oc_dag.py
# python3 # coding=utf-8 # Copyright 2020 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law ...
promptworks/django_openstack_auth
openstack_auth/views.py
# 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, software # distributed under the...
mahabs/nitro
nssrc/com/citrix/netscaler/nitro/resource/config/filter/filterpostbodyinjection.py
# # Copyright (c) 2008-2015 Citrix Systems, 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 l...
Tony-Wang/YaYaNLP
yaya/utility/bytearray.py
from io import FileIO __author__ = 'tony' import struct class ByteArray: @staticmethod def load_from_file(filename): f = FileIO(filename, 'rb') data = f.readall() return ByteArray(data) def __init__(self, data): self.data = data self.offset = 0 def has_more(s...
sandeva/appspot
appengine_django/__init__.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...
wfscheper/hasher
hasher/app.py
# Copyright 2013 Walter Scheper # # 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...
spikeekips/txmongo2
tests/test_find_and_modify.py
# coding: utf-8 # Copyright 2010 Mark L. # # 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...
rdo-management/heat
heat/tests/test_structured_config.py
# # 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, software # ...
111pontes/ydk-py
cisco-ios-xr/ydk/models/cisco_ios_xr/_meta/_Cisco_IOS_XR_ipv6_new_dhcpv6d_cfg.py
import re import collections from enum import Enum from ydk._core._dm_meta_info import _MetaInfoClassMember, _MetaInfoClass, _MetaInfoEnum from ydk.types import Empty, YList, YLeafList, DELETE, Decimal64, FixedBitsDict from ydk._core._dm_meta_info import ATTRIBUTE, REFERENCE_CLASS, REFERENCE_LIST, REFERENCE_LEAFLI...
decebel/dataAtom_alpha
bin/plug/py/external/pattern/__init__.py
#### PATTERN ####################################################################################### # Authors: Tom De Smedt <tom@organisms.be>, Walter Daelemans <walter.daelemans@ua.ac.be> # License: BSD License, see LICENSE.txt # Copyright (c) 2010 University of Antwerp, Belgium # All rights reserved. # # Redistri...
hfp/tensorflow-xsmm
tensorflow/contrib/distributions/python/ops/estimator.py
# Copyright 2017 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
lichengwu/python_tools
utils/cn/lichengwu/utils/utils/lang/TarFile.py
''' Created on 2011-12-6 @author: lichengwu ''' import tarfile, os def make_tar(folder_to_backup, dest_folder, compression='bz2'): if compression: dest_ext = '.' + compression else: dest_ext = '' arcname = os.path.basename(folder_to_backup) dest_name = '%s.tar%s' % (arcn...
tensorflow/probability
tensorflow_probability/python/internal/hypothesis_testlib_test.py
# Copyright 2018 The TensorFlow Probability Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
kinow-io/kinow-python-sdk
test/test_video_group_list_response.py
# coding: utf-8 """ Server API Reference for Server API (REST/Json) OpenAPI spec version: 2.0.6 Generated by: https://github.com/swagger-api/swagger-codegen.git """ from __future__ import absolute_import import os import sys import unittest import kinow_client from kinow_client.rest import A...
gcvalderrama/Jarvis
graphview/Program.py
import networkx as nx import matplotlib.pyplot as plt import xml.etree.ElementTree as ET def hierarchy_pos(G, root, width=2000, vert_gap = 200, vert_loc = 0, xcenter = 0.5, pos = None, parent = None): '''If there is a cycle that is reachable from root, then this will see infinite recursion. ...
mat128/fake-switches
tests/util/protocol_util.py
import logging from hamcrest import assert_that, equal_to import pexpect import re def with_protocol(test): def wrapper(self): try: logging.info(">>>> CONNECTING [%s]" % self.protocol.name) self.protocol.connect() logging.info(">>>> START") test(self, self....
yeming233/rally
rally/plugins/openstack/services/image/glance_v1.py
# 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 agreed to in...
annarev/tensorflow
tensorflow/python/compiler/tensorrt/trt_convert.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...
jiwanlimbu/aura
keystone/federation/controllers.py
# 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, software # distributed under t...
serac/powermon
monitor/analysis.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 yo...
jbohren-forks/catkin_tools
tests/system/verbs/catkin_build/test_args.py
from __future__ import print_function import os import shutil from math import floor from ...workspace_factory import workspace_factory from ....utils import in_temporary_directory from ....utils import assert_cmd_success from ....utils import assert_cmd_failure from ....utils import assert_files_exist from ....ut...
google/learned_optimization
learned_optimization/tree_utils.py
# coding=utf-8 # Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed ...
jrtc27/mytrin-ballot
main.py
#!/usr/bin/env python3 import os import shutil import room import scrape def main(): #scrape.scrape() rooms = room.load_from_json() rooms = list(filter(lambda r: r.court == 'Burrell\'s Field' and r.room_type == 'Double', rooms)) rooms.sort(key=lambda r: r.ensuite) rooms.sort(key=lambda r: r.numbe...
adrienbrault/home-assistant
homeassistant/components/knx/sensor.py
"""Support for KNX/IP sensors.""" from __future__ import annotations from typing import Callable, Iterable from xknx.devices import Sensor as XknxSensor from homeassistant.components.sensor import DEVICE_CLASSES, SensorEntity from homeassistant.core import HomeAssistant from homeassistant.helpers.entity import Entit...
GPflow/GPflowOpt
testing/unit/test_design.py
import gpflowopt import numpy as np import os from ..utility import GPflowOptTestCase class _TestDesign(object): @property def designs(self): raise NotImplementedError() @property def domains(self): createfx = lambda j: np.sum([gpflowopt.domain.ContinuousParameter("x{0}".format(i), -...
silly-wacky-3-town-toon/SOURCE-COD
toontown/minigame/TwoDStomperMgr.py
from panda3d.core import * from panda3d.direct import * from direct.directnotify import DirectNotifyGlobal from direct.showbase.DirectObject import DirectObject from toontown.minigame import ToonBlitzGlobals from toontown.minigame import TwoDStomper class TwoDStomperMgr(DirectObject): notify = DirectNotifyGlobal.d...
verma-varsha/zulip
zerver/decorator.py
from __future__ import absolute_import from django.utils.translation import ugettext as _ from django.http import HttpResponseRedirect, HttpResponse from django.contrib.auth import REDIRECT_FIELD_NAME, login as django_login from django.views.decorators.csrf import csrf_exempt from django.http import QueryDict, HttpRes...
diogo149/treeano
canopy/sandbox/monitor_ui.py
""" UI for monitoring data features - easy setup (simply run `python -m SimpleHTTPServer` in the directory) - live monitoring (before all the data is done) - customizable with data - eg. linear/log scale, rolling mean window - multiple charts - tooltips of the highlighted data point - click the legend to hide lines ...
gencer/python-phonenumbers
python/tests/testtzdata/__init__.py
"""Per-prefix data, mapping each prefix to a name. Auto-generated file, do not edit by hand. """ from phonenumbers.util import u # Copyright (C) 2011-2017 The Libphonenumber Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. #...
metzlar/yams
yams/collect/unix/net.py
from yams.collect import BaseCollector import netstat class NetworkCollector(BaseCollector): def __init__(self, *args, **kwargs): super(NetworkCollector, self).__init__(*args, **kwargs) self.net_lines = netstat.netstat() def tcp_listening(self, proc, port, property_name = None): ...
google-research/google-research
constrained_language_typology/build_feature_matrix.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...
jwedel/tasktracker
ttrack.py
# Task tracker import argparse import re import os.path from datetime import datetime, timedelta, time, date from enum import Enum class Commands(Enum): start = (1, "st", "Starts the current day") done = (2, "dn", "Ends the current running task") list = (3, "ls", "List all tasks") def get_alias(se...
erigones/esdc-ce
sio/monitor.py
from __future__ import print_function from blinker import signal from gevent import sleep from django.utils.six import itervalues from que.erigonesd import cq from que.utils import user_owner_dc_ids_from_task_id from gui.models import User from api.exceptions import OPERATIONAL_ERRORS def que_monitor(app, _info=pri...
google-research/tf-slim
tf_slim/data/test_utils.py
# coding=utf-8 # 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 requ...
openstack/congress
congress/tests/db/test_utils.py
# Copyright (c) 2018 VMware # # 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, so...
slozier/ironpython2
Src/StdLib/Lib/test/test_os.py
# As a test suite for the os module, this is woefully inadequate, but this # does add tests for a few functions which have been determined to be more # portable than they had been thought to be. import os import errno import unittest import warnings import sys import signal import subprocess import sysconfig import te...
googleprojectzero/p0tools
JITServer/cfgtool.py
# Copyright 2018 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 writin...
jcfr/girder
girder/utility/ziputil.py
#!/usr/bin/env python # -*- coding: utf-8 -*- ############################################################################### # Copyright 2013 Kitware 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 cop...
stackforge/monasca-log-api
monasca_log_api/app/controller/api/healthcheck_api.py
# Copyright 2016 FUJITSU LIMITED # # 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 writ...
sbarbett/ssp-sdk-python
src/sponsor_id.py
# Copyright 2017 NeuStar, 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...
met3or/djangoproject
djangosite/urls.py
"""djangosite URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.9/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-...
kymbert/behave
behave/runner.py
# -*- coding: utf-8 -*- from __future__ import absolute_import, print_function, with_statement import contextlib import os.path import six from six import StringIO import sys import traceback import warnings import weakref from behave import matchers from behave.step_registry import setup_step_decorators from behave....
jdfekete/progressivis
tests/test_03_random_table.py
from . import ProgressiveTest from progressivis.core import aio from progressivis import Every from progressivis.stats.random_table import RandomTable from typing import Any def print_len(x: Any) -> None: if x is not None: print(len(x)) class TestRandomTable(ProgressiveTest): def test_random_table(...
NicolasLM/spinach
spinach/const.py
VERSION = '0.0.14' DEFAULT_QUEUE = 'spinach' DEFAULT_NAMESPACE = 'spinach' DEFAULT_MAX_RETRIES = 0 DEFAULT_ENQUEUE_JOB_RETRIES = 4 DEFAULT_WORKER_NUMBER = 5 FUTURE_JOBS_KEY = '_future-jobs' RUNNING_JOBS_KEY = '_running-jobs-on-broker-{}' NOTIFICATIONS_KEY = '_notifications' PERIODIC_TASKS_HASH_KEY = '_periodic_tasks_...
Tacohen/Werewolf-Server-Java
Tests/setNight.py
import json import requests import time from requests.auth import HTTPBasicAuth username = "admin" password = "123" headers = {'Content-type': 'application/json'} loginData = json.dumps({"username":"admin","password":"123"}) loginTimUrl = "http://powerful-depths-2851.herokuapp.com/users/login" setNightUrl = 'http:/...
ericrasmussen/pyramid_redis_sessions
pyramid_redis_sessions/__init__.py
# -*- coding: utf-8 -*- import functools from pyramid.session import ( signed_deserialize, signed_serialize, ) from .compat import cPickle from .connection import get_default_connection from .session import RedisSession from .util import ( _generate_session_id, _parse_settings, get_unique_ses...
talumbau/datashape
datashape/tests/test_parser.py
""" Test the DataShape parser. """ from __future__ import absolute_import, division, print_function import unittest import datashape from datashape.parser import parse from datashape import coretypes as ct from datashape import DataShapeSyntaxError class TestDataShapeParseBasicDType(unittest.TestCase): def setU...
lmaurits/BEASTling
tests/tree_init_tests.py
from beastling.beastxml import BeastXml def test_random_tree(config_factory): """Load a very basic config file and test that RandomTree from the BEAST core is used.""" config = config_factory('basic') xml = BeastXml(config).tostring().decode('utf8') assert "beast.evolution.tree.RandomTree" in xml ...
codebrainz/Pop
scripts/codegen.py
#!/usr/bin/env python3 import jinja2 import optparse import os import subprocess import sys import xml.etree.ElementTree as ET class Operator: def __init__(self, id, name, token, arity, suffix): self.id = id self.name = name self.token = token self.arity = arity self.suffix = suffix class Node:...
lingdb/CoBL-public
ielex/lexicon/migrations/0027_auto_20160415_1345.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('lexicon', '0026_auto_20160408_1313'), ] operations = [ migrations.AddField( model_name='languagebranches', ...
bmcfee/crema
tests/test_chord.py
#!/usr/bin/env python # -*- encoding: utf-8 -*- '''Tests for chord model''' import pytest import numpy as np import librosa import crema.models.chord @pytest.fixture def SIGNAL(): y, sr = librosa.load(librosa.util.example_audio_file(), sr=None) return y, sr @pytest.fixture def AUD...
GeotrekCE/Geotrek-admin
geotrek/tourism/migrations/0016_auto_20211022_1251.py
# Generated by Django 3.1.13 on 2021-10-22 12:51 from django.db import migrations, models import uuid class Migration(migrations.Migration): dependencies = [ ('tourism', '0015_auto_20210121_0943'), ] operations = [ migrations.AddField( model_name='touristiccontent', ...
chrisbouchard/braillegraph
braillegraph/__init__.py
"""A library for creating graphs using Unicode braille characters. https://pypi.python.org/pypi/braillegraph Someone on reddit posted a screenshot of their xmobar setup, which used braille characters to show the loads of their four processor cores, as well as several other metrics. I was impressed that you could fit ...
ColdSauce/define
define.py
#!/usr/bin/python import sys from sys import argv import optparse from os import system import requests key = "1e940957819058fe3ec7c59d43c09504b400110db7faa0509" tkey = "e415520c671c26518df498d8f4736cac" urbankey = "ub2JDDg9Iumsh1HfdO3a3HQbZi0up1qe8LkjsnWQvyVvQLFn1q" class dict: def __init__(self,key,urbankey,tkey...
cloudtools/troposphere
tests/test_validators.py
import unittest from troposphere import AWS_REGION, NoValue, Parameter, Ref, Tags from troposphere.validators import ( boolean, check_required, elb_name, encoding, integer, integer_range, mutually_exclusive, network_port, one_of, positive_integer, s3_bucket_name, tags_or...
blancltd/blanc-basic-podcast
blanc_basic_podcast/migrations/0003_populate_date_url.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations def populate_date_url(apps, schema_editor): PodcastFile = apps.get_model('podcast', 'PodcastFile') for obj in PodcastFile.objects.all(): obj.date_url = obj.date.date() obj.save() def remove_dat...
spectralDNS/shenfun
tests/test_la.py
import numpy as np from scipy.linalg import solve import pytest from shenfun import inner, TestFunction, TrialFunction, div, grad, \ SparseMatrix, FunctionSpace, Function, Array, la np.warnings.filterwarnings('ignore') N = 10 d = [ {0: np.arange(N)+1}, {0: -2, 2: 1}, {-1: 1, 0: -2, 1: 1}, {-2: 1, 0...
stephenrauch/pydal
pydal/migrator.py
import copy import datetime import locale import os import pickle import sys from ._compat import PY2, string_types, pjoin, iteritems, to_bytes, exists from ._load import portalocker from .helpers.classes import SQLCustomType class Migrator(object): def __init__(self, adapter): self.adapter = adapter ...
talapus/Ophidian
CC/DoctorValler/skunkworks.py
#!/usr/bin/env python from imapclient import IMAPClient import os import email import re def main(): host = 'hqmail.cvent.net' username = os.environ.get('CCUSER', None) password = os.environ.get('CCPASS', None) server = IMAPClient(host, use_uid=True, ssl=True) # What kind of error handling goes h...
hfp/libxsmm
samples/deeplearning/sparse_training/fairseq/fairseq/modules/transformer_sentence_encoder.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from typing import Optional, Tuple import torch import torch.nn as nn from fairseq.modules import ( FairseqDropout, LayerDropModuleLi...
peterbe/airmozilla
airmozilla/settings/base.py
# This is your project's main settings file that can be committed to your # repo. If you need to override a setting locally, use settings_local.py from funfactory.settings_base import * # Name of the top-level module where you put all your apps. # If you did not install Playdoh with the funfactory installer script # ...
django-searchstack/django-searchstack
searchstack/manager.py
# encoding: utf-8 from .query import EmptySearchQuerySet, SearchQuerySet class SearchIndexManager(object): def __init__(self, using=None): super(SearchIndexManager, self).__init__() self.using = using def get_search_queryset(self): """Returns a new SearchQuerySet object. Subclasses c...
zedr/django
tests/cache/tests.py
# -*- coding: utf-8 -*- # Unit tests for cache framework # Uses whatever cache backend is set in the test settings file. from __future__ import unicode_literals import os import re import copy import shutil import tempfile import threading import time import unittest import warnings from django.conf import settings ...
avoinsystems/healthchecks
hc/api/migrations/0007_ping.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('api', '0006_check_grace'), ] operations = [ migrations.CreateModel( name='Ping', fields=[ ...
dirn/django-heroku-redisify
redisify.py
# -*- coding: utf-8 -*- """ Friendly Redis for Django on Heroku """ import os try: import urlparse except ImportError: import urllib.parse as urlparse __all__ = ('redisify') urlparse.uses_netloc.append('redis') def redisify(default=None): """Returns configured CACHES dictionary based on environment s...
flgiordano/netcash
+/google-cloud-sdk/lib/googlecloudsdk/api_lib/auth/util.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 ag...
anguoyang/SMQTK
python/smqtk/utils/__init__.py
""" LICENCE ------- Copyright 2013 by Kitware, Inc. All Rights Reserved. Please refer to KITWARE_LICENSE.TXT for licensing information, or contact General Counsel, Kitware, Inc., 28 Corporate Drive, Clifton Park, NY 12065. """ def safe_create_dir(d): """ Recursively create the given directory, ignoring the a...
Relrin/aiorest-ws
tests/utils/test_representation.py
# -*- coding: utf-8 -*- import pytest from aiorest_ws.db.orm import fields, serializers, relations from aiorest_ws.db.orm.validators import BaseValidator from aiorest_ws.utils.representation import smart_repr, field_repr, \ serializer_repr, list_repr from tests.fixtures.fakes import FakeView class FakePkField(r...
frac/celery
celery/tests/test_worker/test_worker_job.py
# -*- coding: utf-8 -*- import anyjson import logging import os import sys import time from datetime import datetime, timedelta from kombu.transport.base import Message from celery import states from celery.app import app_or_default from celery.concurrency.base import BasePool from celery.datastructures import Excep...
morrisonlevi/FrameworkBenchmarks
dart-start/setup.py
import subprocess import sys import setup_util import os def start(args, logfile, errfile): setup_util.replace_text('dart-start/postgresql.yaml', 'host: .*', 'host: ' + args.database_host) setup_util.replace_text('dart-start/mongodb.yaml', 'host: .*', 'host: ' + args.database_host) try: # # install dart ...
adykstra/mne-python
mne/viz/backends/base_renderer.py
"""Core visualization operations.""" # Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # Eric Larson <larson.eric.d@gmail.com> # Oleh Kozynets <ok7mailbox@gmail.com> # Guillaume Favelier <guillaume.favelier@gmail.com> # # License: Simplified BSD from abc import ABCMeta...
dimagi/commcare-hq
corehq/messaging/smsbackends/turn/forms.py
from django.utils.translation import ugettext_lazy as _ from crispy_forms import layout as crispy from django.forms import ChoiceField from dimagi.utils.django.fields import TrimmedCharField from corehq.apps.sms.forms import BackendForm from corehq.apps.sms.models import SQLMobileBackend class TurnBackendForm(Back...
Bysmyyr/chromium-crosswalk
build/android/devil/android/device_utils.py
# Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Provides a variety of device interactions based on adb. Eventually, this will be based on adb_wrapper. """ # pylint: disable=unused-argument import coll...
abadger/Bento
bento/__init__.py
""" Bento, a pythonic packaging solution for python software. Bento is a packaging solution which aims at being simple and extensible, using as little magic as possible. Packages are described in a bento.info file which has a straightforward syntax, and the packaging is driven through bentomaker, the command line inte...
andrewkaufman/gaffer
python/GafferSceneUI/HierarchyView.py
########################################################################## # # Copyright (c) 2012, John Haddon. All rights reserved. # Copyright (c) 2013, Image Engine Design Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that ...
jandom/rdkit
rdkit/Chem/FeatMaps/UnitTestFeatMapPoint.py
# $Id$ # # Copyright (C) 2006 greg Landrum # # @@ All Rights Reserved @@ # This file is part of the RDKit. # The contents are covered by the terms of the BSD license # which is included in the file license.txt, found at the root # of the RDKit source tree. # import doctest import unittest from rdkit.Chem.FeatM...
monkeython/loremipsum
loremipsum/serialization/content_types/application_x_tar.py
"""Handle serialization of a frozen sample from/to a tar file.""" import calendar import datetime import io import tarfile def parse(binary): """Turns a TAR file into a frozen sample.""" binary = io.BytesIO(binary) args = { 'text': None, 'lexicon': None, 'word_delimiters': None, ...
lmcinnes/umap
doc/bokeh_digits_plot.py
import numpy as np from sklearn.datasets import load_digits import pandas as pd digits = load_digits() import umap reducer = umap.UMAP(random_state=42) embedding = reducer.fit_transform(digits.data) from io import BytesIO from PIL import Image import base64 def embeddable_image(data): img_data = 255 - 15 * da...
keithellis74/weather_station
log_all_sensors.py
#!/usr/bin/python3 #import interrupt_client, MCP342X, wind_direction, HTU21D, bmp085, tgs2600, ds18b20_therm import time import interrupt_client import wind_direction import thingspeak import config FREQUENCY = 60 * 5 #Record data to thingspeak at this frequency wind_dir = wind_direction.wind_direction(adc_channel...