code stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 226 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k |
|---|---|---|---|---|---|
#!/usr/bin/env python
#
# Copyright 2015 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 requir... | googleads/googleads-python-lib | examples/ad_manager/v202111/activity_group_service/update_activity_groups.py | Python | apache-2.0 | 2,745 |
# Definition for a binary tree node.
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def increasingBST(self, root: TreeNode) -> TreeNode:
def dfs(node):
if not node.left and not node.right: return node
... | zuun77/givemegoogletshirts | leetcode/python/897_increasing-order-search-tree2.py | Python | apache-2.0 | 796 |
from functools import partial
from django.contrib.admin.sites import AdminSite
from django.contrib.sites.models import Site
from django.core.urlresolvers import reverse
from django.test import TestCase
from mock import patch
from opendebates.admin import SubmissionAdmin
from opendebates.models import Submission
from ... | caktus/django-opendebates | opendebates/tests/test_admin.py | Python | apache-2.0 | 4,608 |
__author__ = 'Liudmila'
import pytest
import json
import os.path
from fixture.application import Application
fixture = None
target = None
def load_config(file):
global target
if target is None:
config_file = os.path.join(os.path.dirname(os.path.abspath(__file__)), file)
with open (config_file)... | MilaPetrova/Mantis_testing | conftest.py | Python | apache-2.0 | 1,303 |
# 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 or agreed to in writing, s... | felixbb/forseti-security | google/cloud/security/common/data_access/violation_dao.py | Python | apache-2.0 | 3,393 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2016-12-29 19:01
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('books', '0003_initial_subjects_languages_creatortypes'),
]
operations = [
migration... | Princeton-CDH/winthrop-django | winthrop/books/migrations/0004_unique_together_sort.py | Python | apache-2.0 | 1,351 |
from threading import Thread, Lock
import bluetooth as bt
import socket
class SerialPortService(Thread):
def __init__(self, port):
super(SerialPortService, self).__init__()
self.port = port
self.send_lock = Lock()
self.setDaemon(True)
def run(self):
self.running = True
... | bcstack/btsdk | shell/service.py | Python | apache-2.0 | 714 |
# Copyright 2018 ETH Zurich
#
# 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, sof... | klausman/scion | python/topology/utils.py | Python | apache-2.0 | 2,247 |
"""
conference.py -- Udacity conference server-side Python App Engine API;
uses Google Cloud Endpoints
$Id: conference.py,v 1.25 2014/05/24 23:42:19 wesc Exp wesc $
created by wesc on 2014 apr 21
"""
__author__ = 'wesc+api@google.com (Wesley Chun)'
from datetime import datetime, timedelta, time as timed
import j... | taylorhardy/ConferenceApp | conference.py | Python | apache-2.0 | 34,962 |
# From CPython 2.5.1
import sys
import os
import unittest
from array import array
from weakref import proxy
from test.test_support import TESTFN, findfile, is_jython, run_unittest
from UserList import UserList
class AutoFileTests(unittest.TestCase):
# file tests for which a test file is automatically set up
... | babble/babble | include/jython/Lib/test/test_file.py | Python | apache-2.0 | 13,201 |
class Item:
def __init__(self, id, name=""):
self.id = id
def __repr__(self):
return self.name
def is_container(self):
return False
def get_id(self):
return self.id
class Shelf:
def __init__(self, id):
self.id = id
self.items = {}
def is_cont... | sudiptakarmakar/QRventory | inventory/model.py | Python | apache-2.0 | 594 |
#!/usr/bin/env python3
# Copyright 2013,2016 The Font Bakery Authors.
# Copyright 2017 The Google Font Tools 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.... | googlefonts/gftools | bin/gftools-nametable-from-filename.py | Python | apache-2.0 | 7,889 |
puts(green("installing MidoNet cli on %s" % env.host_string))
args = {}
Puppet.apply('midonet::midonet_cli', args, metadata)
run("""
cat >/root/.midonetrc <<EOF
[cli]
api_url = http://%s:8080/midonet-api
username = admin
password = admin
project_id = admin
tenant = admin
EOF
""" % metadata.servers... | midonet/Chimata-No-Kami | stages/midonet_cli/fabfile.py | Python | apache-2.0 | 363 |
def f(n):
cnt=0
for a in range(1,n-3):
for b in range(a,n-3):
c =n-a-b
if(c>b):
if((a*a+b*b)==c*c):
cnt+=1
return cnt
ans=0
num=0
for i in range(1000,100,-1):
val= f(i)
if(val>ans):
ans=val
num=i
print num
| rekbun/project-euler | src/python/problem39.py | Python | apache-2.0 | 235 |
# coding=utf-8
# Copyright 2014 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)
import os
import re
... | tejal29/pants | tests/python/pants_test/backend/codegen/tasks/test_antlr_gen.py | Python | apache-2.0 | 4,507 |
import unittest
import os
from testfixtures import TempDirectory
from mock import MagicMock, patch, call
import requests
import httplib2
import googleapiclient.errors
from tests import AttrDict
from rtrss.storage import util
class HttpUtilTestCase(unittest.TestCase):
def test_is_retryable_returns_false_on_rando... | notapresent/rtrss | tests/test_storage_util.py | Python | apache-2.0 | 4,598 |
#####################################################################################
# #
# Script to update Hostname #
# ... | davidcurrie/ci.docker.websphere-traditional | network-deployment/appserver/updateHostName.py | Python | apache-2.0 | 1,804 |
# Copyright 2019,2020,2021 Sony Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... | sony/nnabla | python/test/function/test_div2.py | Python | apache-2.0 | 1,404 |
#Copyright 2012 EasyDevStdio , wes342
#
#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, ... | wes342/EasyDevStudio | scripts/RomOther.py | Python | apache-2.0 | 18,124 |
# 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... | openstack/octavia | specs-tests/test_titles.py | Python | apache-2.0 | 4,052 |
# 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... | ghchinoy/tensorflow | tensorflow/python/keras/optimizer_v2/optimizer_v2_test.py | Python | apache-2.0 | 31,883 |
from time import sleep
from os.path import join
import pytest
from cosmo_tester.framework.examples import get_example_deployment
from cosmo_tester.framework.test_hosts import Hosts, VM
from cosmo_tester.test_suites.snapshots import (
create_snapshot,
download_snapshot,
restore_snapshot,
upload_snapsho... | cloudify-cosmo/cloudify-system-tests | cosmo_tester/test_suites/snapshots/inplace_restore_test.py | Python | apache-2.0 | 3,573 |
#!/usr/bin/env python
# Copyright 2015 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... | csilzen/whatdoyousee | python/label/label.py | Python | apache-2.0 | 2,624 |
import os
import random
import sys
from datetime import date
from urllib import urlencode
import mailpile.auth
from mailpile.defaults import CONFIG_RULES
from mailpile.i18n import ListTranslations, ActivateTranslation, gettext
from mailpile.i18n import gettext as _
from mailpile.i18n import ngettext as _n
from mailpil... | laborautonomo/Mailpile | mailpile/plugins/setup_magic.py | Python | apache-2.0 | 40,094 |
#!/usr/bin/env python3
import random
import numpy as np
import gym
from gym_minigrid.register import env_list
from gym_minigrid.minigrid import Grid, OBJECT_TO_IDX
# Test specifically importing a specific environment
from gym_minigrid.envs import DoorKeyEnv
# Test importing wrappers
from gym_minigrid.wrappers import... | maximecb/gym-minigrid | run_tests.py | Python | apache-2.0 | 4,174 |
#Standard python libraries
import sys
import datetime
from datetime import timedelta
#Specific python libraries
import sqlalchemy
from sqlalchemy.orm import sessionmaker
from sqlalchemy import exc, func
#PanDA server libraries
from config import panda_config
from pandalogger.PandaLogger import PandaLogger
#Configura... | RRCKI/panda-server | pandaserver/configurator/db_interface.py | Python | apache-2.0 | 15,449 |
#! /usr/bin/python
# -*- coding: utf8 -*-
import tensorflow as tf
import os
import numpy as np
import re
import sys
import tarfile
import gzip
import zipfile
from . import visualize
from . import nlp
import pickle
from six.moves import urllib
from six.moves import cPickle
from six.moves import zip
from tensorflow.pyt... | zjuela/LapSRN-tensorflow | tensorlayer/files.py | Python | apache-2.0 | 33,051 |
# Copyright 2015 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 ... | GoogleCloudPlatform/appengine-config-transformer | yaml_conversion/lib/google/appengine/api/yaml_object.py | Python | apache-2.0 | 10,552 |
class AutoProbation:
"""
Logs join and leave messages.
"""
def __init__(self, bot):
self.bot = bot
print('Addon "{}" loaded'.format(self.__class__.__name__))
async def on_member_join(self, member):
await self.bot.add_roles(member, self.bot.probation_role)
def setup(bot):
... | 916253/Kurisu | addons/auto_probation.py | Python | apache-2.0 | 354 |
#!/usr/bin/env python3
#
# Copyright (c) 2016-2017 Nest Labs, 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/lice... | openweave/happy | happy/HappyDNS.py | Python | apache-2.0 | 4,370 |
# 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 unde... | stackforge/senlin | senlin/tests/unit/engine/test_environment.py | Python | apache-2.0 | 13,402 |
import numpy
class Board(object):
BLACK = 1
WHITE = -1
def __init__(self):
self.board = numpy.zeros((8,8), int)
self.board[3][3] = Board.WHITE
self.board[4][4] = Board.WHITE
self.board[3][4] = Board.BLACK
self.board[4][3] = Board.BLACK
self.remaining_pieces... | JordiMD92/thellia | othello/board.py | Python | apache-2.0 | 3,980 |
# -*- coding: utf-8 -*-
from scrapy import Spider, Request
from sqlalchemy import create_engine, func
from sqlalchemy.orm import sessionmaker
from datetime import datetime, timedelta
from ..models import LiveTVSite, LiveTVRoom, LiveTVRoomPresent, DAILY_DATE_FORMAT
from ..items import DailyItem
import numpy
import jso... | taogeT/livetv_mining | crawler/gather/daily_spiders/douyu.py | Python | apache-2.0 | 2,933 |
# Copyright 2015 Tesora 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 a... | Tesora-Release/tesora-trove | trove/tests/scenario/runners/database_actions_runners.py | Python | apache-2.0 | 9,910 |
# -*- 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-binary-authorization | samples/generated_samples/binaryauthorization_v1beta1_generated_binauthz_management_service_v1_beta1_get_attestor_async.py | Python | apache-2.0 | 1,601 |
# -*- encoding: utf-8 -*-
from __future__ import absolute_import
import requests
import json
import logging
from bs4 import BeautifulSoup as htmldoc
def carrier_lookup():
return None
class CarrierLookup(object):
def __init__(self, number, logname=None):
self.number = number
self._logname =... | neuroticnerd/armory | armory/phone/lookup.py | Python | apache-2.0 | 2,647 |
#!/usr/bin/python
#
# 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 ag... | GoogleCloudPlatform/healthcare | datathon/nusdatathon18/scripts/cbis_ddsm_ml/trainer/tpu_model.py | Python | apache-2.0 | 8,749 |
import unittest
from nose.tools import assert_equals, assert_true, assert_false
from robotide.robotapi import TestCaseFile
from robotide.controller.filecontrollers import TestCaseFileController
from robotide.controller.macrocontrollers import (
TestCaseController, UserKeywordController)
from robotide.controller.ta... | fingeronthebutton/RIDE | utest/controller/test_macro_controllers.py | Python | apache-2.0 | 4,898 |
from appfd.models import Source
from appfd.extractor import extract_locations_from_tables, extract_locations_from_text, extract_locations_from_webpage
from appfd.finisher import finish_order
from appfd.styler import style_order
from appfd.resolver import resolve_locations
from location_extractor import extract_location... | FirstDraftGIS/firstdraft | projfd/appfd/generator/__init__.py | Python | apache-2.0 | 7,321 |
# Copyright 2016 Autodesk 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... | tkzeng/molecular-design-toolkit | moldesign/utils/callsigs.py | Python | apache-2.0 | 8,969 |
"""
The ``ui.TextArea`` class implements a standard multi-line input field.
The ``setCharacterWidth()`` method sets the width of the input field, in
characters, while ``setVisibleLines()`` sets the height of the field, in lines.
Use the ``getText()`` method to retrieve the field's current text, and
``setText()`` to s... | minghuascode/pyj | examples/showcase/src/demos_widgets/textArea.py | Python | apache-2.0 | 2,168 |
#!/usr/bin/env python
# Subprocess ex1
# ---------------
#
# Use subprocess to check the config files in ~/CFGS into git
#
# Assumes 'git init' is done manually.
# -----------
# cd ~/CFGS
# git init
#
#
# Commands to be done using subprocess.
# ----------
# git add *.cfg
# git commit -m "Add configs"
#
#
# You w... | fuzzyray/pynet_test | subprocess_ex1.py | Python | apache-2.0 | 663 |
# Copyright 2015 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... | brchiu/tensorflow | tensorflow/python/ops/image_ops_test.py | Python | apache-2.0 | 165,524 |
#!/usr/bin/python -tt
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Google's Python Class
# http://code.google.com/edu/languages/google-python-class/
# Additional basic list exercises
# D. Given a list of numbers, return a list where
# al... | ankur0493/google_python_exercises | basic/list2.py | Python | apache-2.0 | 2,574 |
#!/usr/bin/python
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Google's Python Class
# http://code.google.com/edu/languages/google-python-class/
import sys
import re
import os
import shutil
import commands
"""Copy Special exercise
"""
#... | kgronich/google-python-exercises | copyspecial/copyspecial.py | Python | apache-2.0 | 2,437 |
"""
The commands module contains the base definition for
a generic Qubole command and the implementation of all
the specific commands
"""
from qds_sdk.qubole import Qubole
from qds_sdk.resource import Resource
from qds_sdk.exception import ParseError
from qds_sdk.account import Account
from qds_sdk.util import GentleO... | yogesh2021/qds-sdk-py | qds_sdk/commands.py | Python | apache-2.0 | 47,582 |
# -*- 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-aiplatform | samples/generated_samples/aiplatform_v1_generated_job_service_delete_model_deployment_monitoring_job_async.py | Python | apache-2.0 | 1,687 |
# -*- coding: utf-8 -*-
import pytest
import turnstile.models.message as message
from turnstile.checks import CheckIgnore
from turnstile.checks.commit_msg.specification import check
def test_check():
commit_1 = message.CommitMessage('something', 'https://github.com/jmcs/turnstile/issues/42 m€sságe')
result_... | zalando/turnstile | tests/checks/test_specification_check.py | Python | apache-2.0 | 1,332 |
#!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... | fangxingli/hue | desktop/libs/notebook/src/notebook/models.py | Python | apache-2.0 | 6,176 |
import abc
import asyncio
import keyword
import collections
import mimetypes
import re
import os
import sys
import inspect
import warnings
from collections.abc import Sized, Iterable, Container
from pathlib import Path
from urllib.parse import urlencode, unquote
from types import MappingProxyType
from . import hdrs
... | jashandeep-sohi/aiohttp | aiohttp/web_urldispatcher.py | Python | apache-2.0 | 26,407 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import datetime
import os
import psycopg2
import sys
con = None
f = None
try:
################ CHANGE THESE PARAMETERS ONLY ################
con = psycopg2.connect(database='switch', host='localhost', port='5432', user='deepakc_super', password='myPassword')
... | switch-model/switch-hawaii-studies | database/DB_Code/study_dates/study_hour.py | Python | apache-2.0 | 2,084 |
# ********************************************************************************************************************************* #
# Name: api_example_python.py #
# Desc: full api example ... | johnmcilwain/cdnetworks | api_example_python.py | Python | apache-2.0 | 5,957 |
"""This example demonstrates the usage of BayesOpt with Ray Tune.
It also checks that it is usable with a separate scheduler.
"""
import time
from ray import tune
from ray.tune.schedulers import AsyncHyperBandScheduler
from ray.tune.suggest import ConcurrencyLimiter
from ray.tune.suggest.bayesopt import BayesOptSearc... | richardliaw/ray | python/ray/tune/examples/bayesopt_example.py | Python | apache-2.0 | 1,732 |
""" Buildbot inplace config
(C) Copyright 2015 HicknHack Software GmbH
The original code can be found at:
https://github.com/hicknhack-software/buildbot-inplace-config
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... | hicknhack-software/buildbot-inplace-config | buildbot_inplace/config.py | Python | apache-2.0 | 5,400 |
# -*- coding: utf-8 -*-
print sorted([36, 5, 12, 9, 21])
def reversed_cmp(x, y):
if x > y:
return -1
elif x == y:
return 0
else:
return 1
print sorted([36, 5, 12, 9, 21], reversed_cmp)
print sorted(['bob', 'about', 'Zoo', 'Credit'])
def cmp_ignore_case(s1, s2):
u1 = s1.uppe... | hewentian/python-learning | src/python27/functional_programming/sorted.py | Python | apache-2.0 | 506 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
class Animal(object):
def run(self):
print('Animal running...')
class Dog(Animal):
def run(self):
print('Dog running...')
def shout(self):
print('Dog wang wang...')
class Cat(Animal):
def run(self):
print('Cat running...')
def shout(self):
print('Cat mi... | henryneu/Python | sample/exten.py | Python | apache-2.0 | 614 |
# -*- coding: utf-8 -*-
from __future__ import division, print_function, absolute_import, unicode_literals
import sys
import os
import six
from mog_commons import unittest
class TestUnitTest(unittest.TestCase):
def test_assert_output(self):
def f():
print('abc')
print('123')
... | mogproject/mog-commons-python | tests/mog_commons/test_unittest.py | Python | apache-2.0 | 3,948 |
input = """
x | -x.
y | -y.
"""
output = """
x | -x.
y | -y.
"""
| veltri/DLV2 | tests/parser/bkunstrat3.bk.test.py | Python | apache-2.0 | 69 |
from dependencywatcher.parser.parser import Parser
from dependencywatcher.parser.pyparser import PyParser
from pyparsing import *
class SbtParser(PyParser):
def __init__(self, source):
super(SbtParser, self).__init__(source)
vars = {}
def store_var(st, locn, tokens):
vars[toke... | DependencyWatcher/parser | dependencywatcher/parser/sbt.py | Python | apache-2.0 | 2,074 |
import wpilib
import math
class SharpIR2Y0A02:
'''
Sharp IR sensor GP2Y0A02YK0F
Long distance sensor: 20cm to 150cm
Output is in centimeters
Distance can be calculated using 62.28*x ^ -1.092
'''
def __init__(self,num):
self.distance = ... | frc1418/2015-robot | robot/common/distance_sensors.py | Python | apache-2.0 | 1,861 |
# Copyright 2021 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from pants.backend.python.target_types import PythonLibrary, PythonTests
from pants.engine.target import BoolField
class SkipIsortField(BoolField):
alias = "skip_isort"
default =... | benjyw/pants | src/python/pants/backend/python/lint/isort/skip_field.py | Python | apache-2.0 | 542 |
__author__ = 'fujun'
from nltk import sent_tokenize
import json
import io
if __name__ == "__main__":
review_file = io.open("/Users/fujun/GitHub/YelpDataChallenge/data/tip_review.json", 'r', encoding='utf8')
index = 1
for line in review_file:
json_decode = json.loads(line.strip("\n"))
re... | fujunswufe/YelpDataChallenge | src/summarize/baseline.py | Python | apache-2.0 | 1,052 |
# 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 agre... | parthea/datalab | tools/cli/commands/create.py | Python | apache-2.0 | 37,422 |
"""pirate URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/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-base... | demonshreder/pirate | pirate/urls.py | Python | apache-2.0 | 2,735 |
'''
New Test For mini cluster creation and roll back when creation failed
@author: Glody
'''
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.test_state as test_state
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.operations.resource_operations as res_ops
import zstackwoodpe... | zstackio/zstack-woodpecker | integrationtest/vm/simulator/test_minicluster.py | Python | apache-2.0 | 2,859 |
#***
#*********************************************************************
#*************************************************************************
#***
#*** GizmoDaemon Config Script
#*** LIRCMceUSB2 MythTV config
#***
#*****************************************
#*****************************************
... | jtriley/gizmod | scripts/modules.d/510-LIRC-MceUSB2-MythTV.py | Python | apache-2.0 | 7,769 |
"""Support for (EMEA/EU-based) Honeywell TCC climate systems.
Such systems include evohome, Round Thermostat, and others.
"""
from __future__ import annotations
from datetime import datetime as dt, timedelta
import logging
import re
from typing import Any
import aiohttp.client_exceptions
import evohomeasync
import e... | kennedyshead/home-assistant | homeassistant/components/evohome/__init__.py | Python | apache-2.0 | 25,207 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-07-03 16:13
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('books', '0003_book_owner'),
]
operations = [
migrations.RenameModel(
old... | pankajlal/prabandh | books/migrations/0004_auto_20160703_2143.py | Python | apache-2.0 | 384 |
# 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... | Bismarrck/tensorflow | tensorflow/python/keras/layers/simplernn_test.py | Python | apache-2.0 | 7,269 |
from _sha256 import sha256
from typing import Optional
from common.serializers.serialization import domain_state_serializer
from plenum.common.constants import DOMAIN_LEDGER_ID
from plenum.common.request import Request
from plenum.common.txn_util import get_payload_data, get_from, get_req_id
from plenum.server.databas... | evernym/zeno | plenum/test/buy_handler.py | Python | apache-2.0 | 1,707 |
# flake8: noqa
# There's no way to ignore "F401 '...' imported but unused" warnings in this
# module, but to preserve other warnings. So, don't check this module at all.
# Copyright 2020 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use thi... | huggingface/pytorch-transformers | src/transformers/models/herbert/__init__.py | Python | apache-2.0 | 1,766 |
#!/usr/bin/env python
"""Manage MAGMa web user accounts
"""
import argparse
import os
import sys
from transaction import commit
from paste.deploy import appconfig
from sqlalchemy import engine_from_config
from magmaweb.user import init_user_db, User, JobMeta
from magmaweb.job import make_job_factory
class MagmaComma... | NLeSC/MAGMa | web/magmaweb/script.py | Python | apache-2.0 | 5,092 |
# 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... | jhseu/tensorflow | tensorflow/python/keras/mixed_precision/experimental/autocast_variable.py | Python | apache-2.0 | 17,110 |
from aiserverapp.models import Child
from aiserverapp.models import Assessment
from aiserverapp.models import Village
from aiserverapp.models import Centre
from aiserverapp.models import Block
from aiserverapp.models import District
def consolidate_centre_info(centre_id):
print('CENTER:', centre_id)
centre_inf... | PayPal-Opportunity-Hack-Chennai-2015/AID-India | server/aiserverproj/aiserverapp/centre_helper.py | Python | apache-2.0 | 1,656 |
################################################################################
# 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... | StephanEwen/incubator-flink | flink-python/pyflink/fn_execution/coder_impl_slow.py | Python | apache-2.0 | 28,735 |
"""
Support for Xiaomi Mi Temp BLE environmental sensor.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.mitemp_bt/
"""
import logging
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.helpers... | persandstrom/home-assistant | homeassistant/components/sensor/mitemp_bt.py | Python | apache-2.0 | 5,585 |
import torch
import torch.nn as nn
class AsymmetricLossMultiLabel(nn.Module):
def __init__(self, gamma_neg=4, gamma_pos=1, clip=0.05, eps=1e-8, disable_torch_grad_focal_loss=False):
super(AsymmetricLossMultiLabel, self).__init__()
self.gamma_neg = gamma_neg
self.gamma_pos = gamma... | rwightman/pytorch-image-models | timm/loss/asymmetric_loss.py | Python | apache-2.0 | 3,322 |
# Copyright 2013: Mirantis Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | dtudares/hello-world | yardstick/yardstick/ssh.py | Python | apache-2.0 | 9,436 |
# Copyright (c) 2010-2011 OpenStack, 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 ... | houseurmusic/my-swift | swift/obj/updater.py | Python | apache-2.0 | 9,252 |
# -*- coding:utf-8 -*-
import datetime
try:
import simplejson as json
except ImportError:
import json
class DateTimeJsonEncoder(json.JSONEncoder):
"""
JSONEncoder subclass that knows how to encode date/time.
"""
def default(self, obj):
if isinstance(obj, datetime.datetime):
... | jgeewax/parinx | parinx/utils.py | Python | apache-2.0 | 9,290 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
import re
class EntityException(Exception):
"""Wrap entity specific errors"""
pass
class Entity(object):
"""Base implementation for an Asana entity containing
common funcitonality"""
# Keys which are filtered as part of the HTTP request
_filter_k... | mburgs/asanorm | asana/entities/entity.py | Python | apache-2.0 | 6,721 |
"""The tests for the Template switch platform."""
from homeassistant.core import callback
from homeassistant import setup
import homeassistant.components as core
from homeassistant.const import STATE_ON, STATE_OFF
from tests.common import (
get_test_home_assistant, assert_setup_component)
class TestTemplateSwit... | persandstrom/home-assistant | tests/components/switch/test_template.py | Python | apache-2.0 | 16,305 |
#
# 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
# ... | rh-s/heat | heat/engine/scheduler.py | Python | apache-2.0 | 18,011 |
# pyOCD debugger
# Copyright (c) 2015,2018-2019 Arm Limited
# SPDX-License-Identifier: Apache-2.0
#
# 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/LICENS... | mbedmicro/pyOCD | test/unit/test_cmdline.py | Python | apache-2.0 | 4,753 |
# Copyright 2016 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | huangkuan/hack | lib/gcloud/logging/test_sink.py | Python | apache-2.0 | 13,154 |
# -*- 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-service-directory | samples/generated_samples/servicedirectory_v1_generated_registration_service_list_services_sync.py | Python | apache-2.0 | 1,551 |
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use ... | Chasego/kafka | tests/kafkatest/tests/client/client_compatibility_produce_consume_test.py | Python | apache-2.0 | 4,878 |
# 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... | alexgorban/models | official/vision/detection/evaluation/factory.py | Python | apache-2.0 | 1,390 |
from __future__ import absolute_import
import momoko
from tornado import gen
from psycopg2.extras import RealDictConnection
def initialize_database():
db = momoko.Pool(
dsn='''dbname=nightson user=vswamy password=vswamy host=localhost port=5432''',
size=5,
connection_factory=RealDictConne... | vswamy/nightson | nightson/managers/base_entity_manager.py | Python | apache-2.0 | 1,373 |
# Copyright 2016 Conchylicultor. 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 ... | Conchylicultor/MusicGenerator | deepmusic/modules/decoder.py | Python | apache-2.0 | 7,461 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created by heyu on 17/3/1
"""
try:
from setuptools import setup
except:
from distutils.core import setup
setup(
name="pyutils",
version="0.0.1",
author="heyu",
author_email="gannicus_yu@163.com",
description="easy and convenient tools... | gannicus-yu/pyutils | setup.py | Python | apache-2.0 | 546 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'LikeCfiItem'
db.create_table(u'catalog_likecfiitem', (
... | Makeystreet/makeystreet | woot/apps/catalog/migrations/0036_auto__add_likecfiitem__add_cfistoreitem.py | Python | apache-2.0 | 27,149 |
from __future__ import division
__author__ = 'saeedamen' # Saeed Amen
#
# Copyright 2016 Cuemacro
#
# 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
#
... | cuemacro/chartpy | chartpy/twitter.py | Python | apache-2.0 | 1,894 |
#! /usr/bin/python
# -*- coding:utf-8 -*-
"""
Author: AsherYang
Email: ouyangfan1991@gmail.com
Date: 2018/6/29
Desc: 产生6位随机短信验证码类
"""
import random
class RandomPwd:
def __init__(self):
pass
def genPwd(self):
a_list = []
while len(a_list) < 6:
x = random.randint(0, 9... | AsherYang/ThreeLine | server/ffstore/mgrsys/RandomPwd.py | Python | apache-2.0 | 580 |
from ..remote import RemoteModel
from infoblox_netmri.utils.utils import check_api_availability
class SpmDevicesVendorModelGridRemote(RemoteModel):
"""
This table lists all SPM devices that existed within the user specified period of time sorted by the Device Name in ascending order.
| ``id:`` The int... | infobloxopen/infoblox-netmri | infoblox_netmri/api/remote/models/spm_devices_vendor_model_grid_remote.py | Python | apache-2.0 | 4,572 |
# Use Netmiko to enter into configuration mode on pynet-rtr2.
# Also use Netmiko to verify your state (i.e. that you are currently in configuration mode).
from getpass import getpass
import time
from netmiko import ConnectHandler
password = getpass()
pynet_rtr2 = {'device_type': 'cisco_ios', 'ip': '50.76.53.27', 'use... | linkdebian/pynet_course | class4/exercise5.py | Python | apache-2.0 | 563 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 OpenStack 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/... | ioram7/keystone-federado-pgid2013 | build/python-keystoneclient/keystoneclient/generic/client.py | Python | apache-2.0 | 8,468 |
import json
import os
import urllib2
import urllib
import html2text
from unidecode import unidecode
import time
import urllib
import logging
import os
import os.path
import sys
import threading
if os.path.isfile('recipeitems-latest.json'):
pass
else:
os.system('wget http://openrecipes.s3.amazo... | schollz/extract_recipe | get_recipes/downloadRecipes.py | Python | apache-2.0 | 3,312 |
cars = ['audi', 'bmw', 'toyota']
for car in cars:
if car == 'bmw':
print(car.upper())
else:
print(car.title())
for c in cars:
if c=="audi":
print (c.title())
age1 = 12
age2 = 20
if (age1 > 10) and (age2 > 18):
print("all ok")
else:
print("Not ok")
if (age1 > 10) or (age2 >... | zinderud/ysa | python/first/if.py | Python | apache-2.0 | 784 |
# 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 or agreed... | google/shopping-markup | plugins/cloud_utils/__init__.py | Python | apache-2.0 | 1,168 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.