repo_name stringlengths 5 104 | path stringlengths 4 248 | content stringlengths 102 99.9k |
|---|---|---|
n7jti/machine_learning | project/t1.py | #!/usr/bin/python
import argparse
import numpy as np
from sklearn.cross_validation import train_test_split
from sklearn.grid_search import GridSearchCV
from sklearn.metrics import classification_report
from sklearn.svm import SVC
def loadData (subdir, prefix):
# Load a csv of floats:
data = np.genfromtxt(subdir +... |
ppries/tensorflow | tensorflow/python/kernel_tests/sparse_reshape_op_test.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... |
dondrake/mlb_stats_spark | scrape.py | #from urllib.parse import urljoin, urlsplit
from urlparse import urljoin, urlsplit
from xml.etree import ElementTree
from datetime import datetime, timedelta
import logging
import os
import requests
import html5lib
log = logging.getLogger(__name__)
def setup_logging(ns="none", filename=None):
"""Setup and retur... |
guildai/guild | setup.py | # Copyright 2017-2019 TensorHub, 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 writ... |
pcmoritz/ray-1 | dashboard/modules/node/node_head.py | import sys
import asyncio
import re
import logging
import json
import aiohttp.web
from aioredis.pubsub import Receiver
from grpc.experimental import aio as aiogrpc
import ray.gcs_utils
from ray.new_dashboard.modules.node import node_consts
import ray.new_dashboard.utils as dashboard_utils
import ray.new_dashboard.cons... |
factorylabs/f_closure_linter | setup.py | #!/usr/bin/env python
#
# Copyright 2010 The Closure Linter 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
#... |
opensyllabus/osp-pipeline | osp_pipeline/corpus/sources.py |
import io
import warc
import h11
import attr
import re
import os
from dateutil.parser import parse as parse_date
from cached_property import cached_property
@attr.s
class SourceV1CorpusLog:
# Log file, as bytes.
log_data = attr.ib()
@cached_property
def log_lines(self):
"""Split log buffe... |
akubera/aberdeen | aberdeen/utils/error_messages.py |
# aberdeen/utils/error_messages.py
#
"""
Utility functions which print errors in a nice form
"""
import sys
from termcolor2 import c
def warning(err, *args, outfile=sys.stderr):
"""
Prints a warning error to 'outfile'. This message is automatically formatted
"""
warn = c("warning:").yellow + " "
... |
FederatedAI/FATE | examples/pipeline/homo_nn/_common_component.py | #
# Copyright 2019 The FATE 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 appli... |
cloudify-cosmo/cloudify-manager | tests/integration_tests/tests/agentless_tests/security/security_base.py | ########
# Copyright (c) 2015 GigaSpaces Technologies Ltd. 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... |
googleapis/python-aiplatform | samples/model-builder/import_feature_values_sample_test.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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
tensorflow/probability | tensorflow_probability/python/internal/custom_gradient_test.py | # Copyright 2021 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... |
boundary/boundary-event-plugins | zenoss/boundary-zenoss3.py | #!/usr/bin/env python
"""
Script used to forward Zenoss 3.x events into Boundary's events API via event commands.
"""
import json
import logging
import os
import socket
import time
import urllib2
from ConfigParser import SafeConfigParser
from base64 import b64encode
LOG = logging.getLogger('boundary-zenoss3')
API_E... |
thingsboard/thingsboard-gateway | thingsboard_gateway/connectors/mqtt/mqtt_uplink_converter.py | # Copyright 2022. ThingsBoard
#
# 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 ... |
penkins/penkins_ci | penkins/mail.py | import smtplib
import yaml
import os
import datetime
from .config import PenkinsConfig
class PenkinsMail(PenkinsConfig):
def send_mail(self, to, subject, message):
smtp_config = PenkinsConfig().config['smtp'][0]
smtpserver = smtplib.SMTP(smtp_config['host'], smtp_config['port'])
smtpserve... |
hermantai/samples | data-science/pythonproj1/intro_to_pandas.py | # Tutorials linked from Google.
# https://colab.sandbox.google.com/notebooks/mlcc/intro_to_pandas.ipynb
from __future__ import print_function
import pandas as pd
pd.__version__
city_names = pd.Series(['San Francisco', 'San Jose', 'Sacramento'])
population = pd.Series([852469, 1015785, 485199])
cities = pd.DataFram... |
bcarr092/pyCovertAudio | src/pyCovertAudio/OFDMModulator.py | from pyCovertAudio_lib import *
from BaseModulator import BaseModulator
from BFSKModulator import BFSKModulator
from BandpassFilter import BandpassFilter
from SignalFunctions import SignalFunctions
from SymbolTracker import SymbolTracker
class OFDMModulator(BaseModulator):
def __init__(
... |
nash-x/hws | nova/proxy/clients.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# 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... |
savi-dev/horizon | openstack_dashboard/settings.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# no... |
Onager/plaso | tests/cli/tool_options.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Tests for the CLI tool options mix-ins."""
import unittest
from plaso.cli import tool_options
from plaso.cli import tools
from plaso.output import manager as output_manager
from tests.cli import test_lib
class TestToolWithAnalysisPluginOptions(
tools.CLITool, t... |
smouzakitis/molly | molly/wsgi.py | """
WSGI config for molly project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` se... |
diana-hep/rootconverter | root2avro/tests/simpleString3.py | #!/usr/bin/env python
# Copyright 2016 Jim Pivarski
#
# 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 la... |
akosel/incubator-airflow | airflow/utils/dag_processing.py | # -*- coding: utf-8 -*-
#
# 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
#... |
jeffknupp/sandman2 | tests/user_models.py | import datetime
from sandman2.model import db, Model
from tests.resources import (
GET_ERROR_MESSAGE,
INVALID_ACTION_MESSAGE,
)
class User(db.Model, Model):
"""A user of the blogging application."""
__tablename__ = 'user'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db... |
google-research/robel | robel/dclaw/__init__.py | # Copyright 2019 The ROBEL 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... |
RedHatInsights/insights-core | insights/parsers/cmdline.py | """
CmdLine - file ``/proc/cmdline``
================================
This parser reads the ``/proc/cmdline`` file, which contains the arguments
given to the currently running kernel on boot.
"""
from insights import Parser, parser, LegacyItemAccess
from insights.parsers import SkipException, ParseException
from ins... |
ranl/mta-course-scraper | mta_course_scraper/settings.py | # -*- coding: utf-8 -*-
# Scrapy settings for mta_course_scraper project
#
# For simplicity, this file contains only the most important settings by
# default. All the other settings are documented here:
#
# http://doc.scrapy.org/en/latest/topics/settings.html
#
BOT_NAME = 'mta_course_scraper'
SPIDER_MODULES = ['... |
saltstack/salt | tests/pytests/unit/test_syspaths.py | """
tests.pytests.unit.test_syspaths
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Unit tests for salt's syspaths module
"""
import pytest
import salt.syspaths
from tests.support.mock import patch
@pytest.mark.skip_unless_on_windows(reason="Test is only applicable to Windows.")
def test__get_windows_root_dir_expand_reg():
re... |
seunghwanl/APMAE4990 | webapp/__init__.py | from flask import Flask, render_template, request, url_for, flash, redirect
from flask_bootstrap import Bootstrap
from sqlalchemy import *
from haversine import haversine
from sklearn.ensemble import RandomForestRegressor
from sklearn.externals import joblib
from forms import LatLongForm
import os
app = Flask(__n... |
asgrace13/test.selenium | fixture/agreement.py | from selenium.webdriver.common.by import By
import time
class AgreementHelper:
def __init__(self, app):
self.app = app
def open_supply_agreement_page(self):
wd = self.app.wd
if not wd.current_url.endswith("lk/#/contracts/supplyAgreement"):
wd.get(self.app.base_url + "/lk/... |
MaT1g3R/YasenBaka | bot/__init__.py | """
Yasen-Baka
~~~~~~~~~~~~~~~~~~~
Yasen-Baka, a multifunctional Discord bot
with special World of Warships commands.
:copyright: (c) Copyright 2016-2017 MaT1g3R
:license: Apache License 2.0, see LICENSE for more details.
"""
from collections import namedtuple
from bot.anime_searcher import AnimeSearcher
from bot.yase... |
rocity/dj-blog | blog/models.py | import datetime
from django.db import models
from django.utils import timezone
from django.contrib.auth.models import User
# Create your models here.
class Tag(models.Model):
name = models.CharField(max_length=50)
frequency = models.IntegerField(default=0)
def __str__(self):
return self.name
cl... |
PSJoshi/python_scripts | alexia.py | #!/usr/bin/env python
"""
This script downloads Alexia Top 1 million sites and generates a CSV file.
It also allows you to return Top N sites.
"""
import zipfile
import StringIO
import requests
ALEXIA_URL = 'http://s3.amazonaws.com/alexa-static/top-1m.csv.zip'
def get_alexia_urls():
"""
Download and generate Ale... |
imsut/commons | src/python/twitter/pants/goal/group.py | from twitter.common.collections import OrderedDict, OrderedSet
from twitter.pants import is_internal
from twitter.pants.targets import InternalTarget
from twitter.pants.tasks import TaskError
class Group(object):
@staticmethod
def execute(phase, tasks_by_goal, context, executed):
"""Executes the named phase ag... |
mklight/eCMD | config.py | #!/usr/bin/env python3
# This script will look for any ecmd-* dirs at the top level and
# setup a number of variables used through out the make
# Those variables are then written out to a makefile.config
# makefile.config is included by makefile.base
# Python module imports
import os
import sys
import glob
import pla... |
Muyoo/gold_pred | feature_creator/min_price.py | #!/usr/bin/env python
#encoding=utf8
'''
与最近半年的历史最低价的距离
'''
import timeutil as t
import pdb
SEP = 2
SEP_NUM = 20 / SEP
FEATURE_PREFIX = 'min'
BACK_DAYS = 180
def search_min_price(mongo_source):
''''''
begin_date = t.back_n_days(BACK_DAYS, '%Y%m%d')
min_price = 1000000
conn = mongo_source.get_connecti... |
danvk/lstm-examples | reber.py | #!/usr/bin/env python
"""Train an LSTM network to recognize the embedded Reber grammar."""
import random
import numpy as np
# State transition table
TRANSITIONS = [
[('T', 1), ('P', 2)], # 0=B
[('X', 3), ('S', 1)], # 1=BT
[('V', 4), ('T', 2)], # 2=BP
[('X', 2), ('S', 5)], # 3=BTX
[('P', 3), (... |
sandeepdsouza93/TensorFlow-15712 | tensorflow/contrib/learn/python/learn/estimators/estimator_test.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... |
box/ClusterRunner | setup.py | #!/usr/bin/env python3
try:
from pip.req import parse_requirements # pip 9.x
except ImportError:
from pip._internal.req import parse_requirements # pip 10.x
from setuptools import find_packages, setup
from app.util import autoversioning
version = autoversioning.get_version()
# bdist_pex runs in a temp dir... |
gotostack/neutron-lbaas | neutron_lbaas/services/loadbalancer/drivers/haproxy/jinja_cfg.py | # Copyright 2014 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 ... |
robionica/b3 | src/main/python/b3/rules/build_rule_base/build_info/on_disk_build_info_utils.py | # http://www.bionicbunny.org/
#
# Copyright (c) 2014 Oleksandr Sviridenko
#
# 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... |
FreekingDean/home-assistant | homeassistant/components/zwave_js/discovery_data_template.py | """Data template classes for discovery used to generate additional data for setup."""
from __future__ import annotations
from collections.abc import Iterable
from dataclasses import dataclass
from typing import Any
from zwave_js_server.const import CommandClass
from zwave_js_server.const.command_class.meter import (
... |
chanikag/private-paas-cartridges | wso2das/3.0.0/plugins/wso2das-startup-handler.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... |
GoogleCloudPlatform/python-docs-samples | composer/airflow_1_samples/bq_copy_across_locations.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 writing, ... |
jeremyh/eo-datasets | tests/integration/prepare/test_noaa_c_c_prwtreatm_1.py | # pylint: disable=E501
from functools import partial
from pathlib import Path
from pprint import pformat
from deepdiff import DeepDiff
from eodatasets3 import serialise
from eodatasets3.prepare import noaa_c_c_prwtreatm_1_prepare
from tests.common import run_prepare_cli
NCEP_PR_WTR_FILE: Path = (
Path(__file__)... |
aronsky/home-assistant | homeassistant/components/brother/sensor.py | """Support for the Brother service."""
from __future__ import annotations
from typing import Any, cast
from homeassistant.components.sensor import SensorEntity, SensorEntityDescription
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_HOST
from homeassistant.core import HomeAss... |
stevenmjo/cloud-custodian | tests/test_ec2.py | # Copyright 2016 Capital One Services, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... |
landism/pants | tests/python/pants_test/backend/jvm/tasks/test_scalafmt.py | # coding=utf-8
# Copyright 2016 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from pants_test.pant... |
isaac-s/cloudify-system-tests | cosmo_tester/test_suites/test_blueprints/two_deployments_test.py | ########
# Copyright (c) 2014 GigaSpaces Technologies Ltd. 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... |
sunqm/pyscf | pyscf/gto/test/test_eval_gto.py | #!/usr/bin/env python
# Copyright 2014-2020 The PySCF Developers. 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
#
# U... |
williamFalcon/pytorch-lightning | pytorch_lightning/plugins/environments/lightning_environment.py | # Copyright The PyTorch Lightning team.
#
# 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 i... |
zhaochl/python-utils | utils/render_html_util.py | #!/usr/bin/env python
# coding=utf-8
"""
[{k1:v1},{k1:v2}] =>
<th>k1</th>
<tr><td>v1</td></tr>
<tr><td>v2</td></tr>
stat_key 按照某一行进行计数展示
"""
def rendar_request_html(dict_list,stat_key=None):
caption_info="<caption></caption>"
result_html = """
<table class="table table-striped">
{0}
<thead>
... |
berendt/tmp | plainlogger.py | import datetime
import logging
from twisted.internet import reactor
from twisted.internet.protocol import Protocol, ClientFactory
import peewee
import sys
ADDRESS = '10.100.0.4'
DATABASE_FILE = 'planes.db'
HOME_LAT = 48.9036812
HOME_LON = 9.1475182
PORT = 30003
logging.basicConfig(format='[%(asctime)s] %(message)s', ... |
xclxxl414/rqalpha | rqalpha/mod/rqalpha_mod_sys_risk/__init__.py | # -*- coding: utf-8 -*-
#
# Copyright 2017 Ricequant, 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 ... |
rom1mouret/assortment | gen_dataset/generate_dataset.py | #!/usr/bin/env python3
import argparse
from sklearn.pipeline import Pipeline
from sklearn.ensemble import IsolationForest
from sklearn.preprocessing import StandardScaler, OneHotEncoder
import sklearn.utils
from scipy.stats import rankdata
import scipy.io.arff
import numpy as np
from features import session_features... |
Yangqing/caffe2 | caffe2/python/layers/concat.py | # Copyright (c) 2016-present, Facebook, 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... |
uvsmtid/common-salt-states | states/bootstrap/bootstrap.dir/modules/platforms/rhel5.py | from platforms.generic_linux import generic_linux_deploy
from platforms.generic_linux import generic_linux_build
###############################################################################
#
class rhel5_linux_deploy(generic_linux_deploy):
def init_ip_route(
self,
):
from steps.deploy.init... |
google-research/google-research | coherent_gradients/weak_and_strong/optimizers/m3.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... |
google/makani | gs/monitor2/apps/plugins/layouts/flight_layout.py | # Copyright 2020 Makani Technologies 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... |
valhallasw/phabricator-tools | py/phl/phlsys_dictutil.py | """Utility for working with dicts."""
# =============================================================================
# CONTENTS
# -----------------------------------------------------------------------------
# phlsys_dictutil
#
# Public Functions:
# copy_dict_no_nones
# ensure_keys
# ensure_keys_default
# set_... |
googleapis/python-dlp | samples/generated_samples/dlp_v2_generated_dlp_service_get_job_trigger_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... |
vallemrv/tpvB3 | cloud/clases/urls.py | # @Author: Manuel Rodriguez <valle>
# @Date: 04-Sep-2017
# @Email: valle.mrv@gmail.com
# @Last modified by: valle
# @Last modified time: 23-Mar-2018
# @License: Apache license vesion 2.0
from django.conf.urls import url, include
from . import views
app_name = "gestion"
PEDIDOS = [
url(r'codigos_postales/$',... |
googleapis/python-aiplatform | samples/generated_samples/aiplatform_v1_generated_metadata_service_get_execution_async.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... |
tensorflow/agents | tf_agents/agents/ddpg/__init__.py | # coding=utf-8
# Copyright 2020 The TF-Agents 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... |
OpenAcademy-OpenStack/project-docs | samples/helloworld/helloworld/openstack/common/excutils.py | # Copyright 2011 OpenStack Foundation.
# Copyright 2012, Red Hat, 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
#
# U... |
zooniverse/aggregation | active_weather/example.py | #!/usr/bin/env python
from __future__ import print_function
import matplotlib
matplotlib.use('WXAgg')
import cv2
import numpy as np
import matplotlib.pyplot as plt
from active_weather import __otsu_bin__,__pca__,__create_mask__
import cPickle, gzip
import math
img = cv2.imread("/home/ggdhines/eastwind-wag-279-1946_052... |
cuckootan/WeiboSpider | WeiboSpider/spiders/weibo.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'Jason'
import scrapy, json, re
from scrapy.spiders import CrawlSpider
from datetime import date, datetime, timedelta
from ..items import UserInfoItem, FollowItem, FanItem, \
PostItem, TextItem, ImageItem, CommentItem, ForwardItem, ThumbupItem
class We... |
SripriyaSeetharam/tacker | tacker/tests/unit/test_api_v2_extension.py | # Copyright 2014 Intel Corporation.
# Copyright 2014 Isaku Yamahata <isaku.yamahata at intel com>
# <isaku.yamahata at gmail com>
# All Rights Reserved.
#
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the Lic... |
reiinakano/xcessiv | xcessiv/presets/learnersource.py | """This module contains preset source codes for base learners"""
from __future__ import absolute_import, print_function, division, unicode_literals
__all__ = [
# Classifiers
'sklearn_random_forest_classifier_source',
'sklearn_extra_trees_classifier_source',
'sklearn_logistic_regression_source',
's... |
malerv/gardakan | linkUs/chatUs/models.py | from django.db import models
# Create your models here.
class Event(models.Model):
Name = models.CharField(max_length=255)
Subtitle = models.CharField(max_length=255,null=True)
Description = models.CharField(max_length=1024,null=True)
Information = models.CharField(max_length=1024,null=True)
StartD... |
YaroslavLitvinov/gizer | gizer/psql_objects.py | #!/usr/bin/env python
__author__ = "Yaroslav Litvinov"
__copyright__ = "Copyright 2016, Rackspace Inc."
__email__ = "yaroslav.litvinov@rackspace.com"
import psycopg2
import traceback
from logging import getLogger
from gizer.opinsert import generate_insert_queries
from gizer.opcreate import generate_drop_table_stateme... |
vmogilev/soloist | bin/sync_elastic.py | #! /usr/bin/env python
import sys, getopt, os
import psycopg2
import psycopg2.extras
from elasticsearch import Elasticsearch
from elasticsearch import helpers
# use certifi for CA certificates
import certifi
def get_db():
conn = psycopg2.connect(
database=os.getenv('DJANGO_SOLOIST_DB_NAME', 'scdb'),
... |
Beanstream-DRWP/beanstream-python | beanstream/gateway.py | '''
Copyright 2012 Upverter 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, software
d... |
ntt-sic/taskflow | taskflow/version.py | # -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (C) 2013 Yahoo! 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
#
# ... |
MartinSilvert/overlappingGenesCreator | src/presentResults.py | # -*- coding: utf-8 -*-
"""
Created on Fri Apr 10 10:37:13 2015
@author: martin
"""
from Bio.Seq import Seq
from Bio.Alphabet import IUPAC
def presentResults(x,y,z,ldna,offset):
finalDNA = Seq("", IUPAC.unambiguous_dna)
for a in ldna:
finalDNA+=a
xModified = finalDNA[offset:][:len(x)*3].tra... |
mongodb/bson-ruby | docs/conf.py | # Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... |
google/jax | jax/_src/scipy/stats/multivariate_normal.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 writing, ... |
CrConstantin/Letter-Monster-Exporter | consume_img.py | #/usr/bin/env python
"""
[ Letter Monster V2 ]
Copyright (C) 2013, Cristi Constantin.
All Rights Reserved.
"""
import time
import struct
import binascii
from PIL import Image, ImageFilter
import numpy as np
# All valid PIL filters
Filters = ('BLUR', 'SHARPEN', 'EDGE_ENHANCE', 'SMOOTH', 'SMOOTH_MORE', 'D... |
mjamesruggiero/lily | lily/apriori.py | from collections import defaultdict
import logging
logging.basicConfig(level=logging.INFO, format="%(funcName)s\t%(message)s")
def createC1(dataset):
C1 = []
for transaction in dataset:
for item in transaction:
if not [item] in C1:
C1.append([item])
C1.sort()
retur... |
toddpalino/kafka-tools | kafka/tools/protocol/requests/describe_log_dirs_v0.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... |
Artemkaaas/indy-sdk | vcx/ci/scripts/toml_utils.py | #!/usr/bin/env python3
# Reads the Cargo.toml file and extracs the major.minor version of the package
import sys
import os
import re
SO_FILE = 'libvcx.so'
def valid_line(line):
return ('version =' in line or 'version=' in line) and ('uuid' not in line and 'rusqlite' not in line and 'indy-sys' not in line and 'r... |
donspaulding/adspygoogle | examples/adspygoogle/adwords/v201302/reporting/get_report_fields.py | #!/usr/bin/python
#
# Copyright 2012 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... |
pranav-gokhale/YelpGroupRecommendations | superuser.py | import json, re
import csv, sys
import pickle
import cPickle as pickle
file = open("reviews.txt",'r')
group = []
#command line arguments for members of group
for user in sys.argv[1:]:
group.append(str(user))
#outFile1 = open("pseudoAvg.txt", 'w')
#print 'Your Group is ' + str(group)
newUser = []
# remove all gr... |
grepme/CMPUT410Lab01 | virt_env/virt1/lib/python2.7/site-packages/FormEncode-1.3.0a1-py2.7.egg/formencode/tests/test_validators.py | # -*- coding: utf-8 -*-
import datetime
import unittest
from nose.plugins.skip import SkipTest
from formencode import validators
from formencode.validators import Invalid
from formencode.variabledecode import NestedVariables
from formencode.schema import Schema
from formencode.foreach import ForEach
from formencode.a... |
Mariaanisimova/pythonintask | PMIa/2015/Velyan_A_S/task_7_6.py | # Задача 7. Вариант 6.
# Разработайте систему начисления очков для задачи 6, в соответствии с которой игрок получал бы большее количество баллов за меньшее количество попыток.
# Velyan A. S.
# 27.05.2016
import random
print("Программа случайным образом загадывает название одного из семи городов России, имеющи... |
grahamhayes/designate | designate/central/__init__.py | # Copyright 2012 Hewlett-Packard Development Company, L.P. All Rights Reserved.
#
# Author: Kiall Mac Innes <kiall@hpe.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... |
drichan/xito | modules/dazzle/src/main/jython/exec_test_setup.py | import shutil
import java.lang.System
print "Setup exec_test using exec_test_setup.py"
#System Properties
user_home = java.lang.System.getProperty("user.home")
base_dir = java.lang.System.getProperty("basedir")
project_version = java.lang.System.getProperty("project.version")
artifactId = java.lang.System.getProperty... |
partofthething/home-assistant | homeassistant/components/elgato/config_flow.py | """Config flow to configure the Elgato Key Light integration."""
from __future__ import annotations
from typing import Any
from elgato import Elgato, ElgatoError
import voluptuous as vol
from homeassistant.config_entries import CONN_CLASS_LOCAL_POLL, ConfigFlow
from homeassistant.const import CONF_HOST, CONF_PORT
fr... |
bretttegart/treadmill | tests/runtime/linux/image/tar_test.py | """Tests for treadmill.runtime.linux.image.tar.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import os
import shutil
import tempfile
import unittest
# Disable W0611: Unused import
import tests.treadmill_test_s... |
eisenstatdavid/c-compiler | tool/export.py | #!/usr/bin/env python3
def isnonterm(word):
return word.startswith('<') and word.endswith('>')
def tosym(word):
return 'tN' [isnonterm(word)] + ''.join('{:02x}'.format(ord(letter))
for letter in word)
with open('grammar') as f:
for line in f:
words = l... |
tensorflow/probability | spinoffs/oryx/oryx/core/interpreters/inverse/core.py | # Copyright 2020 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... |
RedHatInsights/insights-core | insights/parsers/tests/test_firewall_cmd.py | import doctest
import pytest
from insights.parsers import firewall_cmd
from insights.parsers.firewall_cmd import FirewallCmdListALLZones
from insights.tests import context_wrap
from insights.parsers import ParseException
from insights.core.plugins import ContentException
FIREWALL_LIST_ZONES_1 = """
FirewallD is not ru... |
nerdymcnerdyson/pythonPlay | converter/TweeUtilities/Nodes/WaypointNode.py | #from . import NodeBase
#from . import NodeRegExes
from TweeUtilities.Nodes import *
class WaypointNode(SequenceNode):
def __init__(self, waypointLabel):
super().__init__()
self.label = waypointLabel
self.type = NodeBase.SequenceNodeType.waypoint
@staticmethod
def tryIsNod... |
uber/pyro | tests/optim/test_optim.py | # Copyright (c) 2017-2019 Uber Technologies, Inc.
# SPDX-License-Identifier: Apache-2.0
import os
from tempfile import TemporaryDirectory
from unittest import TestCase
import pytest
import torch
from torch.distributions import constraints
import pyro
import pyro.distributions as dist
import pyro.optim as optim
from ... |
ghold/OneKeySql | onekey/OkAddCase.py | from PyQt4 import Qt, QtCore
class OkAddCase(Qt.QWidget):
def __init__(self, parent=None):
Qt.QWidget.__init__(self, parent)
self.nameEdit = Qt.QLineEdit(self)
self.nameEdit.setPlaceholderText("名称")
self.cateEdit = Qt.QLineEdit(self)
self.cateEdit.setPlaceholderText... |
awsdocs/aws-doc-sdk-examples | python/example_code/lookoutvision/hosting.py | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
"""
Purpose
Amazon Lookout for Vision model hosting examples used in the service documentation:
https://docs.aws.amazon.com/lookout-for-vision/latest/developer-guide/running-model.html
Shows how to start and st... |
deepmind/dm_robotics | py/moma/effectors/cartesian_6d_velocity_effector.py | # Copyright 2020 DeepMind Technologies 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 ag... |
ropable/statdev | applications/migrations/0025_organisationcontact_organisation.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-08-21 04:45
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('accounts', '0013_auto_20170602_1200'),
('applicatio... |
titilambert/home-assistant | homeassistant/components/knx/schema.py | """Voluptuous schemas for the KNX integration."""
import voluptuous as vol
from xknx.devices.climate import SetpointShiftMode
from homeassistant.const import (
CONF_ADDRESS,
CONF_DEVICE_CLASS,
CONF_ENTITY_ID,
CONF_HOST,
CONF_NAME,
CONF_PORT,
CONF_TYPE,
)
import homeassistant.helpers.config_... |
pcmoritz/ray-1 | python/ray/remote_function.py | import logging
import inspect
from functools import wraps
from ray import cloudpickle as pickle
from ray._raylet import PythonFunctionDescriptor
from ray import cross_language, Language
from ray._private.client_mode_hook import client_mode_convert_function
from ray._private.client_mode_hook import client_mode_should_c... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.