code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
"""Support for JavaScript and Node.js."""
from pants.build_graph.build_file_aliases import BuildFileAliases
from pants.goal.task_registrar import TaskRegistrar as task
from pants.contrib... | tdyas/pants | contrib/node/src/python/pants/contrib/node/register.py | Python | apache-2.0 | 2,805 |
# -*- 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... | googleapis/python-redis | google/cloud/redis_v1/types/cloud_redis.py | Python | apache-2.0 | 23,259 |
# Create your views here.
import json
import os
from django.http.response import HttpResponse, Http404
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.views.decorators.csrf import csrf_exempt
from djangogroovedown.utils import download_music_temp_file, search_for_m... | alexandreferreira/groovedowndl | djangogroovedown/servicos/views.py | Python | apache-2.0 | 2,206 |
# Copyright 2020 DeepMind Technologies Limited. 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 ... | deepmind/dm-haiku | examples/transformer/model.py | Python | apache-2.0 | 4,120 |
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | GoogleCloudPlatform/bank-of-anthos | src/userservice/db.py | Python | apache-2.0 | 4,158 |
# Copyright (c) 2016 OpenStack Foundation. 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 ... | noironetworks/neutron | neutron/objects/network.py | Python | apache-2.0 | 13,313 |
# 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... | tuskar/tuskar-ui | openstack_dashboard/dashboards/project/images_and_snapshots/images/tests.py | Python | apache-2.0 | 10,547 |
"""This module is used first to read input files and create year, [word]
dict"""
__author__ = 'kamat'
import unittest
from parse_zip import write_year_title
class ParseZipTest(unittest.TestCase):
def test_write_year_title(self):
"""This method is used to create year, [word] dict that
nsf_stats.py uses to ... | ixlab/trendquery | offline/src/parse_zip_test.py | Python | apache-2.0 | 528 |
from model.group import Group
class GroupHelper:
def __init__(self,app):
self.app=app
def create(self, group):
# init group
wd = self.app.wd
self.open_groups_page()
self.click_new_group_button()
self.fill_group_form(group)
self.click_submit_button()
... | wsszczecin/python_training | fixture/group.py | Python | apache-2.0 | 3,832 |
TIPOS_MENSAJES = {
'entrada': "entrada",
'salida': "salida",
'pago_ticket': "pago de ticket",
}
MENSAJES = {
'entrada': "Se ha reportado en el sistema una entrada ",
'salida': "salida",
'pago_ticket': "pago de ticket",
}
def
| ac-seguridad/ac-seguridad | project/manejador/mensajes.py | Python | apache-2.0 | 256 |
__source__ = 'https://leetcode.com/problems/evaluate-division/description/'
# https://github.com/kamyu104/LeetCode/blob/master/Python/evaluate-division.py
# Time: O(e + q * |V|!), |V| is the number of variables
# Space: O(e)
#
# Description: Leetcode # 399. Evaluate Division
#
# Equations are given in the format A / B... | JulyKikuAkita/PythonPrac | cs15211/EvaluateDivision.py | Python | apache-2.0 | 9,882 |
import pickle
from collections import OrderedDict
from contextlib import suppress
from distutils.version import LooseVersion
from textwrap import dedent
import numpy as np
import pandas as pd
import pytest
import xarray as xr
import xarray.ufuncs as xu
from xarray import DataArray, Dataset, Variable
from xarray.tests... | shoyer/xray | xarray/tests/test_dask.py | Python | apache-2.0 | 32,347 |
#coding:utf8
from img import Img
i=Img()
i.open()
k=i.convert_thumbnail(input_file="/home/insion/Pictures/l.jpg",output_file="/home/insion/Pictures/toutput.jpg")
print(k)
k=i.convert_resize(input_file="/home/insion/Pictures/l.jpg",output_file="/home/insion/Pictures/loutput2.jpg",output_size="500x")
print(k)
ki=i.compo... | ptphp/PyLib | src/tornado/demos/lihuashu/docs/common_bak/ty.py | Python | apache-2.0 | 668 |
# coding: utf8
__author__ = 'Lev'
import requests
import json
import re
from datetime import datetime
from domain.user import User
from settings import VK_SEARCHING_TOKEN
from util import log
from resources import GENDERS
gender_dict_vk = {0: GENDERS['undef'], 1: GENDERS['F'], 2: GENDERS['M']}
date_pat... | LeoOsipovHSE/vkca | vk_api/searching.py | Python | apache-2.0 | 1,261 |
# Copyright 2013-2015 DataStax, 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 writi... | mike-tr-adamson/python-driver | tests/integration/standard/test_udts.py | Python | apache-2.0 | 25,583 |
import sys
import numpy as np
sys.path.append("../..")
from sdf import *
from sharedconfig import *
q15Type = CType(Q15)
### The feature computed by the graph is one second of MFCCs.
### So the nbMFCCOutputs is computed from this and with the additional
### assumption that it must be even.
### Because the MFCC ... | JonatanAntoni/CMSIS_5 | CMSIS/DSP/SDFTools/examples/example5/graph.py | Python | apache-2.0 | 1,454 |
#!/usr/bin/env python
# coding: utf-8
"""
Copyright 2015 SYSTRAN Software, 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/licen... | SYSTRAN/nlp-api-python-client | systran_nlp_api/models/lid_paragraph_response.py | Python | apache-2.0 | 1,692 |
# 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... | openstack/designate | designate/common/policies/zone_transfer_request.py | Python | apache-2.0 | 4,669 |
class Monitor:
def __init__(self, controller, redis_address):
self.controller = controller
self.redis_address = redis_address
def _schedule(self, gid, nid, domain, name, args={}, cron='@every 1m'):
"""
Schedule the given jumpscript (domain/name) to run on the specified node ac... | Jumpscale/jumpscale_core8 | lib/JumpScale/tools/realitycapture/Monitor.py | Python | apache-2.0 | 3,119 |
"""LCM type definitions
This file automatically generated by lcm.
DO NOT MODIFY BY HAND!!!!
"""
import cStringIO as StringIO
import struct
import header
class piemos_field_cmd(object):
__slots__ = ["header", "isFlash", "isStart", "isLeft", "rfid_uid"]
def __init__(self):
self.header = None
s... | pioneers/topgear | python/forseti2/piemos_field_cmd.py | Python | apache-2.0 | 2,272 |
import os
# Simple command
os.system('pwd')
| jasonwee/asus-rt-n14uhp-mrtg | src/lesson_runtime_features/os_system_example.py | Python | apache-2.0 | 45 |
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | kubeflow/kfp-tekton-backend | sdk/python/kfp/notebook/__init__.py | Python | apache-2.0 | 598 |
"""Sensor platform for hvv."""
from datetime import timedelta
import logging
from aiohttp import ClientConnectorError
from pygti.exceptions import InvalidAuth
from homeassistant.components.sensor import SensorDeviceClass, SensorEntity
from homeassistant.const import ATTR_ATTRIBUTION, ATTR_ID
from homeassistant.helper... | home-assistant/home-assistant | homeassistant/components/hvv_departures/sensor.py | Python | apache-2.0 | 6,609 |
# Imports operators dynamically while keeping the package API clean,
# abstracting the underlying modules
from airflow.utils import import_module_attrs as _import_module_attrs
# These need to be integrated first as other operators depend on them
_import_module_attrs(globals(), {
'check_operator': [
'CheckO... | opensignal/airflow | airflow/operators/__init__.py | Python | apache-2.0 | 2,447 |
# Copyright (c) 2015 OpenStack Foundation
# Copyright (c) 2015 Hewlett-Packard Development Company, L.P.
# 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:/... | openstack/python-glanceclient | glanceclient/tests/unit/v2/test_client_requests.py | Python | apache-2.0 | 3,930 |
import sys
from PIL import Image
img = Image.open(sys.argv[1])
width, height = img.size
xblock = 5
yblock = 5
w_width = width / xblock
w_height = height / yblock
blockmap = [(xb*w_width, yb*w_height, (xb+1)*w_width, (yb+1)*w_height)
for xb in xrange(xblock) for yb in xrange(yblock)]
newblockmap = list(bloc... | BilalDev/HolyScrap | src/hsimage.py | Python | apache-2.0 | 1,247 |
'''
Copyright 2017-Present Dani Akash
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, soft... | DaniAkash/hackerrank-solutions | Algorithms/Strings/Alternating Characters/Alternating Characters.py | Python | apache-2.0 | 822 |
# 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 agree... | googleapis/artman | artman/pipelines/pipeline_factory.py | Python | apache-2.0 | 2,529 |
import sys,string,os
sys.path.insert(1, os.path.join(sys.path[0], '..')) ### import parent dir dependencies
import os.path
import unique
import itertools
dirfile = unique
############ File Import Functions #############
def filepath(filename):
fn = unique.filepath(filename)
return fn
def read_di... | nsalomonis/AltAnalyze | import_scripts/mergeFilesUnique.py | Python | apache-2.0 | 14,369 |
# -*- 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... | googleapis/python-dialogflow-cx | google/cloud/dialogflowcx_v3beta1/types/fulfillment.py | Python | apache-2.0 | 7,518 |
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | GoogleCloudPlatform/functions-framework-python | src/functions_framework/background_event.py | Python | apache-2.0 | 1,459 |
# coding=utf-8
__author__ = 'Админ'
from django.contrib import admin
from applications.comment.models import Comment
class CommentAdmin(admin.ModelAdmin, ):
list_display = ['pk', 'record_parent', 'serial_number', 'is_active', 'name', 'created_at', 'updated_at', ]
list_display_links = ['pk', 'record_parent',... | AlexStarov/Shop | applications/comment/admin.py | Python | apache-2.0 | 2,151 |
# -*- coding: utf-8 -*-
import platform
import os
import subprocess
import multiprocessing
from multiprocessing.pool import ThreadPool
import collections
import shutil
from invoke import task
MAX_WORKER_NUM = 4
@task
def check_flatc(cxt):
path = shutil.which("flatc")
if path is None:
print("Not foun... | yichiuan/Moedict-Android | moe-converter/tasks.py | Python | apache-2.0 | 2,907 |
from __future__ import print_function, division
import os
os.environ["THEANO_FLAGS"] = "mode=FAST_RUN,device=cpu,floatX=float32"
import theano
from theano import tensor
import numpy as np
import scipy as sp
import dnntoolkit
import unittest
import h5py
import lasagne
# ===============================================... | trungnt13/dnntoolkit | tests/mnist_crosstraining.py | Python | apache-2.0 | 4,825 |
#!/usr/bin/env python
# -*- coding: latin-1 -*-
import sys
#################### <FUNCIONES> ####################################################################
##<Obtener el vector C>###################################################################################################
def GetVectorC(eq):
C=[]
j=... | Darkade/udlap | 6to/simplex.py | Python | apache-2.0 | 14,976 |
# coding=utf-8
# Copyright 2022 The ML Fairness Gym 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/ml-fairness-gym | core_test.py | Python | apache-2.0 | 4,658 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
import time
import unittest
import logging
import functools
from nose.tools import * # flake8: noqa (PEP8 asserts)
import mock
from framework.auth.core import Auth
from website import settings
import website.... | icereval/osf.io | osf_tests/test_elastic_search.py | Python | apache-2.0 | 47,974 |
#!/usr/bin/env python2
# Copyright (c) 2019 Erik Schilling
# 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 ... | mpeuster/son-emu | examples/performance_measurements/osm_component_startup.py | Python | apache-2.0 | 3,883 |
# Copyright 2014 Modelling, Simulation and Design Lab (MSDL) at
# McGill University and the University of Antwerp (http://msdl.cs.mcgill.ca/)
#
# 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... | kdheepak89/pypdevs | test/test_realtime.py | Python | apache-2.0 | 1,022 |
import xbmc
import xbmcgui
import xbmcaddon
import xbmcvfs
from PIL import Image, ImageOps
ADDON = xbmcaddon.Addon(id = 'script.stargate.guide')
def autocrop_image(infile,outfile):
infile = xbmc.translatePath(infile)
image = Image.open(infile)
border = 0
size = image.size
bb_image = image
bbox... | TheWardoctor/Wardoctors-repo | script.stargate.guide/ResizeLogos.py | Python | apache-2.0 | 1,738 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in... | fengkaicnic/traffic | traffic/api/openstack/__init__.py | Python | apache-2.0 | 6,858 |
# Assign the formatter to variable to pass on to print
formatter = "{} {} {} {}"
# display the values and pass them to formatter
print(formatter.format(1, 2, 3, 6))
print(formatter.format("one", "two", "three", "four"))
print(formatter.format(True, False, False, True))
print(formatter.format(formatter, formatter, form... | hbenaouich/Learning-Python | Learning-Python3-The-Hard-Way/8-Printing, Printing/ex8.py | Python | apache-2.0 | 450 |
# coding=utf-8
# Licensed Materials - Property of IBM
# Copyright IBM Corp. 2016
import os
import unittest
import sys
import itertools
from streamsx.topology.topology import *
from streamsx.topology.tester import Tester
from streamsx.topology import schema
import streamsx.topology.context
import streamsx.spl.op as op
... | ddebrunner/streamsx.topology | test/python/spl/tests/test_splpy_primitives.py | Python | apache-2.0 | 8,994 |
u={"1":"1","2":"2"}
u=u.get("1")
g=u["1"]
print(g)
print(u) | xiaoyongaa/ALL | 网络编程第四周/11.py | Python | apache-2.0 | 60 |
# coding: utf-8
#
# Copyright 2014 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... | prasanna08/oppia | extensions/answer_summarizers/models.py | Python | apache-2.0 | 14,017 |
# Copyright (c) 2014 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | StackStorm/python-mistralclient | mistralclient/tests/functional/cli/v2/cli_multi_tenancy_tests.py | Python | apache-2.0 | 14,936 |
import weakref
from warnings import warn
from fontTools.misc import arrayTools
from defcon.objects.base import BaseObject
from defcon.objects.contour import Contour
from defcon.objects.point import Point
from defcon.objects.component import Component
from defcon.objects.anchor import Anchor
from defcon.objects.lib impo... | metapolator/mutatormathtools | python_modules/lib/python/defcon/objects/glyph.py | Python | apache-2.0 | 60,725 |
# =============================================================================
# __init__.py
#
# M2M demo init file.
#
# December 2015
#
# Copyright (c) 2015 by cisco Systems, Inc.
# All rights reserved.
# =============================================================================
| cisco/xr-telemetry-m2m-web | src/m2m_demo/__init__.py | Python | apache-2.0 | 285 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compli... | NewpTone/stacklab-cinder | cinder/tests/fake_flags.py | Python | apache-2.0 | 1,721 |
#!/usr/bin/python
# The contents of this file are in the public domain. See LICENSE_FOR_EXAMPLE_PROGRAMS.txt
#
# This simple example shows how to call dlib's optimal linear assignment
# problem solver. It is an implementation of the famous Hungarian algorithm
# and is quite fast, operating in O(N^3) time.
#
# ... | Nekel-Seyew/Complex-3D-Vector-Fields | dlib-18.18/python_examples/max_cost_assignment.py | Python | apache-2.0 | 2,558 |
from nanpy import (ArduinoApi, SerialManager)
from time import sleep
#Connect to Arduino. Automatically finds serial port.
connection = SerialManager()
a = ArduinoApi(connection = connection)
sensor = 14 #Analog pin 0
a.pinMode(sensor, a.INPUT) #Setup sensor
while True:
total = 0 #Each set of re... | lcc755/WorkTerm1 | 5Array/2Temp/Code/average.py | Python | apache-2.0 | 897 |
# 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... | aselle/tensorflow | tensorflow/contrib/lite/testing/generate_examples.py | Python | apache-2.0 | 108,708 |
# 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, ... | brain-research/acai | lib/layers.py | Python | apache-2.0 | 3,324 |
# Copyright 2014 Big Switch Networks, 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... | blueboxgroup/neutron | neutron/plugins/bigswitch/l3_router_plugin.py | Python | apache-2.0 | 13,215 |
#!/usr/bin/env python
from setuptools import setup, find_packages
from os import path
import codecs
import os
import re
import sys
# When creating the sdist, make sure the django.mo file also exists:
if 'sdist' in sys.argv or 'develop' in sys.argv:
os.chdir('fluent_blogs')
try:
from django.core import... | edoburu/django-fluent-blogs | setup.py | Python | apache-2.0 | 3,060 |
# 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... | noironetworks/heat | heat/policies/cloudformation.py | Python | apache-2.0 | 2,373 |
# Copyright (c) 2013 OpenStack Foundation
# 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 ... | cloudbase/nova-virtualbox | nova/openstack/common/versionutils.py | Python | apache-2.0 | 8,784 |
# Copyright 2011 OpenStack Foundation
# Copyright 2012 Justin Santa Barbara
# 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/l... | vmthunder/nova | nova/api/openstack/compute/contrib/security_groups.py | Python | apache-2.0 | 28,337 |
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... | googlecodelabs/migrate-python2-appengine | mod1b-flask/main.py | Python | apache-2.0 | 1,472 |
# 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... | keras-team/keras | keras/feature_column/dense_features_v2.py | Python | apache-2.0 | 6,123 |
#!/bin/env python
# Copyright 2013 Zynga 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... | zbase/disk_mapper | dm_server/lib/urlmapper.py | Python | apache-2.0 | 2,103 |
# 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... | alexgorban/models | official/transformer/v2/transformer_test.py | Python | apache-2.0 | 2,619 |
from sqlalchemy import Column, Integer, String, DateTime, Boolean
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
class PreventionClinicalData(Base):
"""
Definition of PreventionClinicalData object. It will be used by SQLAlchemy's ORM to map the object to
the patient_turn... | VHAINNOVATIONS/GE-Pressure-Ulcer | python_gui_decision_support_webportal/python/prevention_clinical_data.py | Python | apache-2.0 | 2,367 |
# coding=utf-8
# Copyright 2020 The Learning-to-Prompt Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | google-research/l2p | augment/color_util.py | Python | apache-2.0 | 17,401 |
import unittest
def add(a, b):
return a + b
class TestKnownGood(unittest.TestCase):
def __init__(self, input, output):
super(TestKnownGood, self).__init__()
self.input = input
self.output = output
def runTest(self):
self.assertEqual(add(*self.input), self.output)
def sui... | tomviner/exploring-unittesting-talk | code-examples/test_unittest_suite.py | Python | apache-2.0 | 610 |
"""
Django settings for AutoO project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
impo... | yuezhonghua/AutoO_with_django | AutoO/settings.py | Python | apache-2.0 | 3,000 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-07-05 13:48
from __future__ import unicode_literals
from django.core.exceptions import ObjectDoesNotExist
from django.db import migrations, models
import django.db.models.deletion
def forwards_func(apps, schema_editor):
ChangeSet = apps.get_model('edit... | c3nav/c3nav | src/c3nav/editor/migrations/0015_changeset_last_state_update.py | Python | apache-2.0 | 1,114 |
# Copyright 2019 The TensorNetwork 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 ... | google/TensorNetwork | tensornetwork/backends/jax/jax_backend.py | Python | apache-2.0 | 36,454 |
# Copyright 2013 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | eayunstack/fuel-ostf | fuel_health/tests/ha/test_mysql_replication.py | Python | apache-2.0 | 6,751 |
# -*- coding: utf-8 -*-
# Define here the models for your scraped items
#
# See documentation in:
# http://doc.scrapy.org/en/latest/topics/items.html
import scrapy
class StarscreamItem(scrapy.Item):
# define the fields for your item here like:
# name = scrapy.Field()
pass
| ryanorz/code-camp | starscream/starscream/items.py | Python | apache-2.0 | 289 |
import img_translator as it
import maze_vision_algo as mvsp
import os
import string
def main():
f=open('config.txt','r')
line = f.next()
strpi=line
strpi.replace('\n','')
print(strpi)
rad = it.trans_main()
#print(rad)
p = mvsp.mvsp(rad)
#this=spur.SshShell(hostname="192.168.1.17", username="pi... | jpschnel/maze-vision | Amazeing.py | Python | apache-2.0 | 664 |
"""Build a Pyrex file from .pyx source to .so loadable module using
the installed distutils infrastructure. Call:
out_fname = pyx_to_dll("foo.pyx")
"""
import os
import sys
from distutils.dist import Distribution
from distutils.errors import DistutilsArgError, DistutilsError, CCompilerError
from distutils.extension i... | larsmans/cython | pyximport/pyxbuild.py | Python | apache-2.0 | 5,193 |
# 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... | jistr/rejviz | rejviz/tests/test_utils.py | Python | apache-2.0 | 1,998 |
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import annotations
import dataclasses
import logging
from typing import Iterable, Mapping, Sequence
from pants.base.build_environment import get_buildroot
from pants.base... | pantsbuild/pants | src/python/pants/option/options.py | Python | apache-2.0 | 18,439 |
import pygame
import sys
import os
class Env:
def __init__(self, teamA, teamB, field_size, display, robots=None,
debug=False):
self.teamA = teamA
self.teamB = teamB
self.width = field_size[0]
self.height = field_size[1]
self.display = display
self.b... | xlcteam/py-soccersim | soccersim/env.py | Python | apache-2.0 | 1,133 |
"""
Support for IFTTT
.. versionadded:: 2015.8.0
Requires an ``api_key`` in ``/etc/salt/minion``:
.. code-block:: yaml
ifttt:
secret_key: '280d4699-a817-4719-ba6f-ca56e573e44f'
"""
import logging
import time
import salt.utils.http
import salt.utils.json
log = logging.getLogger(__name__)
def __virtua... | saltstack/salt | salt/modules/ifttt.py | Python | apache-2.0 | 2,334 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# 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/lic... | FederatedAI/FATE | python/federatedml/transfer_variable/transfer_class/oblivious_transfer_transfer_variable.py | Python | apache-2.0 | 1,391 |
import unittest
from prtgcli.cli import main
class TestQuery(unittest.TestCase):
def setUp(self):
pass
def test_list_devices(self):
pass
def test_list_sensors(self):
pass
def test_status(self):
pass
def test_update(self):
pass
| kevinschoon/prtgcli | test/test_cli.py | Python | apache-2.0 | 294 |
def say_hello():
print 'Hello'
if __name__ == '__main__':
say_hello()
| MagicForest/Python | src/training/Core2/Chapter14ExecutionEnvironment/hello.py | Python | apache-2.0 | 88 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-08-21 23:13
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('api', '0008_auto_20170817_2124'),
]
operations = [
... | swcurran/tfrs | backend/api/migrations/0009_auto_20170821_2313.py | Python | apache-2.0 | 26,613 |
# 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... | google/makani | config/m600/control/trans_in.py | Python | apache-2.0 | 13,367 |
# 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... | AnishShah/tensorflow | tensorflow/contrib/data/__init__.py | Python | apache-2.0 | 5,193 |
# Copyright (c) 2014 Scopely, Inc.
# Copyright (c) 2015 Mitch Garnaat
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompanyin... | scopely-devops/skew | skew/resources/aws/lambda.py | Python | apache-2.0 | 1,965 |
#!/usr/bin/python
import sys
import re
import json
ln = 0
pattern = re.compile('.*[A-Z|a-z]+.*')
for line in sys.stdin.readlines():
ln += 1
data = json.loads(line)
name = data.pop('name')
name = name.replace(' ', '_')
score = (100 - ln)
if pattern.match(name):
score += 15
print sc... | redahe/opportuner | modules/concerts_range.py | Python | apache-2.0 | 400 |
from django.db import models
from django.core.urlresolvers import reverse
from django.utils import timezone
from datetime import date
# Create your models here.
class ManagedEntity():
# submitted_by = models.ForeignKey()
submitted_at = models.DateField(auto_now_add=True)
class Organisation(models.Model):
... | Kirkkonen/NetForSpeech | nfsmain/models.py | Python | apache-2.0 | 3,681 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import re
import random
import sys
import unicodedata
import my_conexion
sys.stdout.encoding
'UTF-8'
# PROCESAR MENSAJE DE USUARIO
def generarRespuesta(mensaje, STATES, username):
message_=sinAcentos(mensaje)
ans=''
ve... | Aukan96/Diario-bot-1.0 | InteligenciaBot.py | Python | apache-2.0 | 18,967 |
from share.provider import ProviderAppConfig
from .harvester import SocarxivHarvester
# from providers.io.osf.preprints.normalizer import PreprintNormalizer
class AppConfig(ProviderAppConfig):
name = 'providers.org.socarxiv'
version = '0.0.1'
title = 'osf_preprints_socarxiv'
long_title = 'SocArXiv'
... | zamattiac/SHARE | providers/org/socarxiv/apps.py | Python | apache-2.0 | 553 |
# Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | platformio/platformio | platformio/util.py | Python | apache-2.0 | 14,440 |
import json
from datetime import datetime
import re
from .utils import date_to_str, str_to_date
def _is_datestring(s):
return isinstance(s, str) and \
re.match(r"(\d{4})-(\d{2})-(\d{2})T(\d{2})\:(\d{2})\:(\d{2})", s)
def _encode_datetime(obj):
if isinstance(obj, datetime):
return date_to_str... | uezo/minette-python | minette/serializer.py | Python | apache-2.0 | 6,581 |
#!/usr/bin/env python
#
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | tst-ahernandez/earthenterprise | earth_enterprise/src/fusion/portableglobe/cutter/cgi-bin/common/utils.py | Python | apache-2.0 | 12,945 |
# Copyright (C) 2016-present the ayncpg authors and contributors
# <see AUTHORS file>
#
# This module is part of asyncpg and is released under
# the Apache 2.0 License: http://www.apache.org/licenses/LICENSE-2.0
import re
def _quote_ident(ident):
return '"{}"'.format(ident.replace('"', '""'))
def _quote_liter... | MagicStack/asyncpg | asyncpg/utils.py | Python | apache-2.0 | 1,367 |
from redleader.resources import Resource
import botocore
class LambdaFunctionResource(Resource):
"""
Resource modeling a Lambda FunctionArn
"""
def __init__(self,
context,
function_name,
):
super(DynamoDBTableResource, self).__init__(context, cf_params)
... | mmcdermo/RedLeader | redleader/resources/lambda.py | Python | apache-2.0 | 1,662 |
from django.test import TestCase
from django.test.client import RequestFactory
from myuw.dao.canvas import get_indexed_data_for_regid
from myuw.dao.canvas import get_indexed_by_decrosslisted
from myuw.dao.schedule import _get_schedule
from myuw.dao.term import get_current_quarter
FDAO_SWS = 'restclients.dao_implement... | fanglinfang/myuw | myuw/test/dao/canvas.py | Python | apache-2.0 | 1,890 |
"""An event loop.
This event loop should handle both asynchronous App Engine RPC objects
(specifically urlfetch, memcache and datastore RPC objects) and arbitrary
callback functions with an optional time delay.
Normally, event loops are singleton objects, though there is no
enforcement of this requirement.
The API h... | adviti/melange | thirdparty/google_appengine/google/appengine/ext/ndb/eventloop.py | Python | apache-2.0 | 7,479 |
import cv2
import os
import math
import numpy as np
import matplotlib.pyplot as plt
import random as rnd
class ContourFinder:
def __init__(self):
# Logger._level = Logger.DEBUG
# self.marginoferrorweight =7
pass
@classmethod
def findContours(self,edg):
#plt.imshow(edg)
... | CurryBoy/FirstDraft | FindContours.py | Python | apache-2.0 | 4,615 |
from lib.action import PyraxBaseAction
__all__ = [
'FindDNSRecordIdAction'
]
class FindDNSRecordIdAction(PyraxBaseAction):
def run(self, name, zone_id):
cdns = self.pyrax.cloud_dns
dns_id = [record for record in cdns.list_records(zone_id)
if record.name == name][0].id
... | jtopjian/st2contrib | packs/rackspace/actions/find_dns_record_id.py | Python | apache-2.0 | 335 |
#!/usr/bin/env python
import json
import os
import subprocess
def normalize_target(target):
if ':' in target: return target
return target + ':' + os.path.basename(target)
def gn_desc(root_out_dir, target, *what_to_show):
# gn desc may fail transiently for an unknown reason; retry loop
for i in xrange... | ianloic/fuchsia-sdk | scripts/common.py | Python | apache-2.0 | 848 |
from share.normalize import ctx, tools
from share.normalize.parsers import Parser
from share.normalize.utils import format_address
class WorkIdentifier(Parser):
uri = tools.RunPython('get_ncar_identifier', ctx)
class Extra:
description = tools.Try(ctx.Related_URL.Description)
url_content_type... | zamattiac/SHARE | providers/org/ncar/normalizer.py | Python | apache-2.0 | 3,649 |
import itertools
import transaction
from tqdm import tqdm
from sqlalchemy import func
from clld.cliutil import Data, bibtex2source
from clld.db.meta import DBSession
from clld.db.models import common
from clld.db.util import compute_language_sources
from clld.web.icon import ORDERED_ICONS
from clld.lib.bibtex import D... | clld/grambank | grambank/scripts/initializedb.py | Python | apache-2.0 | 7,156 |
u'''
Created on Oct 17, 2010
@author: Mark V Systems Limited
(c) Copyright 2010 Mark V Systems Limited, All rights reserved.
'''
#import xml.sax, xml.sax.handler
from __future__ import with_statement
from lxml.etree import XML, DTD, SubElement, XMLSyntaxError
import os, re, io
from arelle import XbrlConst
f... | sternshus/arelle2.7 | svr-2.7/arelle/ValidateFilingText.py | Python | apache-2.0 | 33,886 |