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
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models from django.contrib.auth import get_user_model User = get_user_model() user_orm_label = '%s.%s' % (User._meta.app_label, User._meta.object_name) user_model_label = '%s.%s' % (User._meta.ap...
j00bar/django-widgy
widgy/contrib/review_queue/south_migrations/0001_initial.py
Python
apache-2.0
7,453
# -*- 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-webrisk
google/cloud/webrisk_v1beta1/services/web_risk_service_v1_beta1/__init__.py
Python
apache-2.0
797
# stdlib imports # django imports from django import forms from django.conf import settings from django.contrib.auth import get_user_model from django.core.exceptions import ValidationError from django.forms import widgets from django.forms.fields import MultipleChoiceField from django.forms.widgets import Textarea # t...
cmu-db/dbms-library
dbdb/core/forms.py
Python
apache-2.0
9,094
import pyximport; pyximport.install() import subiterations import numpy as np import scipy.ndimage as nd from scipy.ndimage import imread from scipy.misc import imsave, toimage from scipy.stats import threshold from itertools import izip from multiprocessing import Process, Manager, cpu_count from threading import Thre...
Vanuan/gpx_to_road_map
biagoni2012/skeleton.py
Python
apache-2.0
8,440
''' ''' # 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");...
pbchou/trafficserver
tests/gold_tests/continuations/openclose_h2.test.py
Python
apache-2.0
6,696
# 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...
airbnb/superset
superset/common/query_context.py
Python
apache-2.0
12,432
import io,requests,json,time,datetime,os.path,socket,random,re IN_DIR="../data/tweet" OUT_DIR="../data/imdb/parts" SPLITS=25 def split_files(): movie_fName=IN_DIR+"/movies.dat" count=1; try: with open(movie_fName,'r') as in_f: out_fName=OUT_DIR+"/movies_"+str(count)+".dat" ...
saikatgomes/recsys
code/split_movies_list.py
Python
apache-2.0
988
#!/usr/bin/env python # Author: # Rudiger Birkner (Networked Systems Group ETH Zurich) from collections import namedtuple import json from netaddr import IPNetwork ''' Config Parser ''' class Config(object): MULTISWITCH = 0 MULTITABLE = 1 MULTIHOP = 2 SUPERSETS = 0 MDS = 1 def __in...
h2020-endeavour/iSDX
xctrl/lib.py
Python
apache-2.0
4,203
""" Cloud API asynchronous "PDF To Text" job example. Allows to avoid timeout errors when processing huge or scanned PDF documents. """ import os import requests # pip install requests import time import datetime # The authentication key (API Key). # Get your own by registering at https://app.pdf.co API_KEY = "***...
bytescout/ByteScout-SDK-SourceCode
PDF.co Web API/PDF To CSV API/Python/Convert PDF To CSV From Uploaded File Asynchronously/ConvertPdfToCSVFromUploadedFileAsynchronously.py
Python
apache-2.0
4,935
#!/usr/bin/env python # -*- encoding: utf-8 -*- # Copyright 2016 Twitter. 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...
lucperkins/heron
heron/tools/tracker/src/python/handlers/pidhandler.py
Python
apache-2.0
2,951
#!/usr/bin/env python # coding: utf-8 #copyRight by heibanke import time def time_cost(f): def _f(*arg, **kwarg): start = time.clock() a=f(*arg,**kwarg) end = time.clock() print f.__name__,"run cost time is ",end-start return a return _f def fib(n): if n<=2: retu...
heibanke/python_do_something
Code/Chapter4/func_fib_opt.py
Python
apache-2.0
834
# Copyright 2015 Canonical 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 required by...
tpouyer/nova-lxd
nova_lxd/nova/virt/lxd/constants.py
Python
apache-2.0
1,148
class SessionHelper: def __init__(self, app): self.app = app def login(self, username="admin", password="secret"): self.app.navigation.open_start_page() # Input userName self.app.page.fill_field("user", username) # Input Password self.app.page.fill_f...
Alinyan/python_training
fixture/session.py
Python
apache-2.0
1,170
#!/usr/bin/python #--------------------------------------------------------------------------- # Copyright 2011 The Open Source Electronic Health Record Agent # # 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...
luisibanez/cloud-whisperer
Rackspace/getLimits.py
Python
apache-2.0
1,716
#!/usr/bin/env python # -*- coding: utf-8 -*- """ .. py:currentmodule:: text_file .. moduleauthor:: Hendrix Demers <hendrix.demers@mail.mcgill.ca> Read text file in map folder. """ ############################################################################### # Copyright 2017 Hendrix Demers # # Licensed under the ...
drix00/pysemeels
pysemeels/hitachi/eels_su/map/text_file.py
Python
apache-2.0
5,800
from flask import Flask from flask import render_template from flask import request from flask import jsonify from docker import client from os import environ import redis app = Flask(__name__) app.debug = True #set defaults IMAGE_NAME = "keeb/mongodb" COMMAND = ["/usr/bin/mongod", "--config", "/etc/mongodb.conf...
keeb/any-saas
api.py
Python
apache-2.0
1,891
# 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 u...
zancas/hacking
hacking/checks/docstrings.py
Python
apache-2.0
6,197
import pickle import random from nose.tools import assert_raises, eq_ from dbdb.binary_tree import BinaryNode, BinaryTree, BinaryNodeRef, ValueRef class StubStorage(object): def __init__(self): self.d = [0] self.locked = False def lock(self): if not self.locked: self.loc...
yntantan/beetles
dbdb/tests/test_binary_tree.py
Python
apache-2.0
3,440
# 341. Flatten Nested List Iterator # # Given a nested list of integers, implement an iterator to flatten it. # # Each element is either an integer, or a list -- whose elements may also be integers or other lists. # # Example 1: # Given the list [[1,1],2,[1,1]], # # By calling next repeatedly until hasNext returns fals...
gengwg/leetcode
341_flatten_nested_list_iterator.py
Python
apache-2.0
2,196
import os import sys import ctypes import ctypes.util from ctypes import c_char_p, c_int, c_size_t, c_void_p glfs_dll = ctypes.util.find_library("libglusterfs") if glfs_dll: glfs = ctypes.CDLL(glfs_dll) xdr_dll = ctypes.util.find_library("libgfxdr") if xdr_dll: xdr = ctypes.CDLL(xdr_dll) api_gfapi_dll = ct...
harshavardhana/bungee-plugins
pygfapi/__init__.py
Python
apache-2.0
997
#!/usr/bin/env python # coding: utf-8 # Copyright 2013 The Font Bakery 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...
jessamynsmith/fontbakery
tools/fontbakery-setup.py
Python
apache-2.0
12,295
# # Copyright 2012 New Dream Network, LLC (DreamHost) # # 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...
idegtiarov/ceilometer
ceilometer/publisher/messaging.py
Python
apache-2.0
8,139
# Copyright (c) 2016-2019 Chris Reed # # 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/LICENSE-2.0 # # Unless requ...
flit/cmdis
cmdis/disasm.py
Python
apache-2.0
1,507
from django.conf import settings from storages.backends.s3boto3 import S3Boto3Storage class DefaultStorage(S3Boto3Storage): location = settings.DEFAULT_LOCATION file_overwrite = True class StaticStorage(S3Boto3Storage): location = settings.STATICFILES_LOCATION file_overwrite = True class LogoStora...
ItsCalebJones/SpaceLaunchNow-Server
custom_storages.py
Python
apache-2.0
1,595
# 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...
nburn42/tensorflow
tensorflow/python/estimator/estimator.py
Python
apache-2.0
76,526
""" We are given the head node root of a binary tree, where additionally every node's value is either a 0 or a 1. Return the same tree where every subtree (of the given tree) not containing a 1 has been removed. (Recall that the subtree of a node X is X, plus every node that is a descendant of X.) Example 1: Input: [1...
danielsunzhongyuan/my_leetcode_in_python
binary_tree_pruning_814.py
Python
apache-2.0
1,807
# Copyright 2019-present Kensho Technologies, LLC. import bisect import itertools from typing import Any, Iterator, List, cast from ..cost_estimation.analysis import QueryPlanningAnalysis from ..cost_estimation.filter_selectivity_utils import get_integer_interval_for_filters_on_field from ..cost_estimation.helpers imp...
kensho-technologies/graphql-compiler
graphql_compiler/query_pagination/parameter_generator.py
Python
apache-2.0
10,879
# -*- coding: utf-8 -*- """Circular buffer for storing event objects.""" class CircularBuffer(object): """Class that defines a circular buffer for storing event objects.""" def __init__(self, size): """Initializes a circular buffer object. Args: size (int): number of elements in the buffer. ""...
dc3-plaso/plaso
plaso/lib/bufferlib.py
Python
apache-2.0
1,600
""" Copyright (c) 2015 Michael Bright and Bamboo HR 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...
BambooHR/rapid
rapid/master/data/migrations/versions/63ed28aeec3d_adding_order_indexes.py
Python
apache-2.0
2,123
"""Support for AdGuard Home.""" from __future__ import annotations import logging from adguardhome import AdGuardHome, AdGuardHomeConnectionError, AdGuardHomeError import voluptuous as vol from homeassistant.config_entries import SOURCE_HASSIO, ConfigEntry from homeassistant.const import ( CONF_HOST, CONF_NA...
mezz64/home-assistant
homeassistant/components/adguard/__init__.py
Python
apache-2.0
7,189
# Copyright 2016 Red Hat, 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...
sundeep-co-in/transtats
dashboard/urls.py
Python
apache-2.0
11,095
# -*- coding: utf-8 -*- """ Copyright [2009-2018] EMBL-European Bioinformatics Institute 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...
RNAcentral/rnacentral-import-pipeline
tests/databases/data/go_annotations_test.py
Python
apache-2.0
1,410
from pythonDnn.utils.load_conf import load_conv_spec from pythonDnn.utils.utils import parse_activation from pythonDnn.models.cnn import CNN,DropoutCNN; from dnn_predict import Predictor class CNNPredictor(Predictor): def __init__(self,model_config): super(CNNPredictor, self).__init__(model_config,'CNN'); conv...
IITM-DONLAB/dnn-test-wrapper
src/dnn_predict/cnn.py
Python
apache-2.0
1,537
num_cassandra_east = 1 num_regular_east = 0 num_cassandra_west = 0 num_regular_west = 0 from common_funcs import * from time import sleep from os import system #todo-verify eastAMI = "ami-4dad7424"#BOLTON: ami-8ee848e7"# OLDER: "ami-7268b01b" westAMI = "ami-ecf17ddc" eastInstanceIPs = [] westInstanceIPs = [] def...
pbailis/bolton-sigmod2013-code
ycsb-lipstick/ycsb-src/setup-cluster/start_ring.py
Python
apache-2.0
1,951
#!/usr/bin/env python # # Copyright 2015 Airbus # Copyright 2017 Fraunhofer Institute for Manufacturing Engineering and Automation (IPA) # # 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 # # ...
ipa-led/airbus_coop
airbus_plugins/airbus_plugin_rviz/src/airbus_plugin_rviz/plugin.py
Python
apache-2.0
4,720
import pickle import pprint data = [{'a': 'A', 'b': 2, 'c': 3.0}] print('DATA:', end=' ') pprint.pprint(data) data_string = pickle.dumps(data) print('PICKLE: {!r}'.format(data_string))
jasonwee/asus-rt-n14uhp-mrtg
src/lesson_data_persistence_and_exchange/pickle_string.py
Python
apache-2.0
187
#!/home/y/bin/python2.6 import sys, os sys.path.append(os.path.join(os.path.dirname(__file__), '../lib')) from redisPubSub import RedisPubSub def main(): rsp = RedisPubSub() channel_name = raw_input("Enter channel name to which you want to publish messages: ") var = 1 while var == 1: new_messa...
dragondscv/Redis_PubSub_Tornado_Websocket
demo/publisher.py
Python
apache-2.0
461
#!/usr/bin/env python # # Copyright 2011-2014 Splunk, 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...
kkirsche/splunk-sdk-python
examples/binding1.py
Python
apache-2.0
2,079
from django.db import models # Create your models here. class Beer(models.Model): url = models.CharField(max_length = 255) name = models.CharField(max_length = 255) brewery = models.CharField(max_length = 255) brewery_number = models.IntegerField() beer_number = models.IntegerField() BA_score ...
johnurbanik/beeradvocate_crawl
beers/models.py
Python
apache-2.0
703
#! /usr/bin/env python import os import random import pygame import time as t # Class for sprite class Player(object): # Initialize the Sprite def __init__(self): self.rect = pygame.Rect(32, 32, 0, 0) # 16, 16) # Moves the Sprite def move(self, dx, dy): # Move each axis separately. Note that this checks for...
kristinak228/Maze_Game
Maze.py
Python
apache-2.0
5,451
import logging import spotipy import spotipy.oauth2 as oauth2 import json import datetime from errbot import BotPlugin, botcmd class BotifyPlugin(BotPlugin): def activate(self): from config import BOTIFY_CREDS super(BotifyPlugin, self).activate() # dict of name: id for playlists, name is t...
drsm79/botify
botify.py
Python
apache-2.0
8,898
# # Copyright (c) 2008-2015 Citrix Systems, Inc. # # Licensed under the Apache License, Version 2.0 (the "License") # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable l...
mahabs/nitro
nssrc/com/citrix/netscaler/nitro/resource/config/rewrite/rewriteparam.py
Python
apache-2.0
4,433
# Copyright 2016 Cloudbase Solutions. # 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 # # Un...
cloudbase/neutron
neutron/tests/unit/agent/windows/test_ip_lib.py
Python
apache-2.0
3,266
__author__ = 'Wenju Sun' import """ This script tries to download given file via http and given the final status summary """ MAX_VALUE=10 MIN_VALUE=0 WARN_VALUE=0 CRITICAL_VALUE=0 STATE_OK=0 STATE_WARNING=1 STATE_CRITICAL=2 STATE_UNKNOWN=3 STATUS_TEXT='OK' STATUS_CODE=STATE_OK murl="http://dl-...
swenker/studio
python/cpp-ops/ops/check_download_magazine.py
Python
apache-2.0
429
# parse import datetime import os from django.db import models from django.utils import timezone from ocean.models import Region from ocean.models import Characteristic from .parser import parse_byday, parse_set, parse_test class Task(models.Model): timestamp = models.DateTimeField( auto_now_add=True) ...
cttgroup/oceanhub
proto/data-refining/back/workdir/parse/models.py
Python
apache-2.0
2,488
from cbagent.decorators import post_request class MetadataClient(object): def __init__(self, settings, host="127.0.0.1"): self.settings = settings self.base_url = "http://{0}:8000/cbmonitor".format(host) @post_request def add_cluster(self): url = self.base_url + "/add_cluster/" ...
ronniedada/litmus
collectors/cbagent/metadata_client.py
Python
apache-2.0
1,573
# -*- 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-compute
google/cloud/compute_v1/services/reservations/transports/__init__.py
Python
apache-2.0
1,087
import numpy as np from matplotlib import pyplot as plt def drawWaiteForAnyCustomer(xList, yList,name): fig = plt.figure() width = .5 ind = np.arange(len(yList)) plt.bar(ind, yList) plt.xticks(ind + width / 2, xList) # fig.autofmt_xdate() plt.savefig("results/"+name+"_waitingPerCustomer.p...
mrhsce/simPython
chartDrawing.py
Python
apache-2.0
604
"""Model queries.""" def is_password_parameter(data_model, source_type: str, parameter: str) -> bool: """Return whether the parameter of the source type is a password.""" # If the parameter key can't be found (this can happen when the parameter is removed from the data model), # err on the safe side and a...
ICTU/quality-time
components/server/src/external/model/queries.py
Python
apache-2.0
542
from amara import parse from amara.xpath.util import abspath import unittest #Samuel L Bayer-inspired test for default namespace handling #http://lists.fourthought.com/pipermail/4suite/2006-February/007757.html XML1 = '<foo xmlns:bar="http://bar.com"><baz/><bar:baz/><baz/></foo>' XML2 = '<foo xmlns="http://bax.com" x...
zepheira/amara
test/xpath/test_abs_path.py
Python
apache-2.0
1,676
import collections Set = set try: from collections import OrderedDict except ImportError: class OrderedDict(dict): 'Dictionary that remembers insertion order' # An inherited dict maps keys to values. # The inherited dict provides __getitem__, __len__, __contains__, and get. # T...
GeoscienceAustralia/sifra
docs/source/extensions/backports.py
Python
apache-2.0
11,182
# -*- 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...
googleapis/python-dialogflow
samples/generated_samples/dialogflow_generated_dialogflow_v2_environments_delete_environment_sync.py
Python
apache-2.0
1,444
import asyncio import gc import hashlib import socket import unittest from unittest import mock from yarl import URL import aiohttp from aiohttp.client_reqrep import ClientRequest, ClientResponse from aiohttp.test_utils import make_mocked_coro class TestProxy(unittest.TestCase): fingerprint = hashlib.sha256(b"f...
playpauseandstop/aiohttp
tests/test_proxy.py
Python
apache-2.0
24,979
# -*- coding: utf-8 -*- # Generated by Django 1.9.8 on 2017-09-10 19:10 from __future__ import unicode_literals import datetime from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('users', '0002_auto_20170909_1749'), ] operations = [ migrati...
LennonChin/Django-Practices
MxOnline/apps/users/migrations/0003_auto_20170910_1910.py
Python
apache-2.0
833
#!/usr/bin/env python import sys, os, errno from subprocess import Popen, PIPE f = open('pretrain.scp','w') with open('codetrain.scp','r') as codetrain_file: for codetrain_line in codetrain_file: wav_file, mfcc_file = codetrain_line.split() f.write("{0}\n".format(mfcc_file)) f.close()
techiaith/seilwaith
srdk/htk/make_pretrain_scp.py
Python
apache-2.0
295
from functools import wraps from os import getenv from sqlalchemy.orm import sessionmaker from cafe.abc.compat import abstractclassmethod from cafe.patterns.context import SessionManager class SQLAlchemySessionManager(SessionManager): ENGINE = None @classmethod def default(cls): return cls.ins...
betsybookwyrm/python-cafe-sqlalchemy
cafe/database/sqlalchemy/session.py
Python
apache-2.0
3,849
def isPanlidrome(num): num = str(num) return num[::-1] == num def addReverse(num): rev = int(str(num)[::-1]) return num + rev def isLychrel(num): counter = 50 while counter > 0: num = addReverse(num) if isPanlidrome(num): return False counter -= 1 return True lst =...
jialing3/corner_cases
Relue/Eu55.py
Python
apache-2.0
452
#!/usr/bin/env python3 from pycaw.pycaw import AudioUtilities, ISimpleAudioVolume from pydub import AudioSegment from pydub.playback import play # https://stackoverflow.com/a/43727046 def main(): song = AudioSegment.from_mp3("beep.mp3") global sess, vol play(song) sessions = AudioUtilities.GetAllSes...
sunjerry019/photonLauncher
micron/tests/pycaw.test.py
Python
apache-2.0
809
"""Jinja filters to streamline openstack versions for numbers and names""" def _calc_version_from_release(release): GRIZZLY = ord("G".lower()) GRIZZLY_NUMERIC = 3 return GRIZZLY_NUMERIC - GRIZZLY + ord(release[0].lower()) def _discover_version(value): try: return int(value), "OSP" except...
okolisny/InfraRed
infrared/common/filter_plugins/openstack_release.py
Python
apache-2.0
1,408
#!/usr/bin/env python import argparse from watchmaker import Prepare if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument('--noreboot', dest='noreboot', action='store_true', help='No reboot after provisioning.') parser.add_argument('--sourceiss3bucket',...
MarionTheBull/watchmaker
scripts/Watchmaker.py
Python
apache-2.0
2,199
from django.db import models from django.utils.translation import ugettext_lazy as _ from future.utils import python_2_unicode_compatible from fluent_contents.models import ContentItem, ContentItemManager @python_2_unicode_compatible class DisqusCommentsAreaItem(ContentItem): allow_new = models.BooleanField(_("A...
edoburu/django-fluent-contents
fluent_contents/plugins/disquswidgets/models.py
Python
apache-2.0
597
#!/usr/bin/env python # -*- coding: utf-8 -*- from solution import Solution nums = [10, 9, 2, 5, 3, 7, 101, 18] nums = [10,9,2,5,3,4] sol = Solution() res = sol.lengthOfLIS(nums) print(res)
zhlinh/leetcode
0300.Longest Increasing Subsequence/test.py
Python
apache-2.0
192
from django.contrib import admin from django.contrib.auth.models import User from django.contrib.auth.admin import UserAdmin from profiles.models import UserProfile # BEGIN: Merge User and UserProfile in the admin class UserProfileInline(admin.StackedInline): model = UserProfile max_num = 1 can_delete = Fa...
cpatrick/comic-django
django/profiles/admin.py
Python
apache-2.0
475
# Copyright 2014 NEC Corporation. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable l...
ddepaoli3/magnum
magnum/conductor/handlers/bay_conductor.py
Python
apache-2.0
11,732
#!/usr/bin/python3 def add_common_args(parser): parser.add_argument("-g", "--greenscreen_server", default="http://localhost:4994", help="GreenScreen server:port") parser.add_argument("-a", "--appid", help="Chromecast Greenscreen App ID") parser.ad...
dermotduffy/greenscreen_control
greenscreen_control/common_args.py
Python
apache-2.0
965
s = 'azcbobobegghakl' sub = 'bob' count = 0 for i in range(0, len(s)): if sub in s[i:i+3]: count+=1 print "Number of times bob occurs is: " + str(count)
dpanayotov/CS1314
MITx6.00/pset1e2.py
Python
apache-2.0
166
# Copyright 2018 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...
google/loaner
loaner/web_app/backend/lib/action_loader.py
Python
apache-2.0
3,416
# Copyright 2013 Open Cloud Consortium # # 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...
LabAdvComp/tukey_middleware
tukey_middleware/api/keystone.py
Python
apache-2.0
10,922
# # 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...
wooga/airflow
tests/providers/google/cloud/operators/test_dataflow_system.py
Python
apache-2.0
1,290
# -*- coding: utf-8 -*- """JSON serializes for XMS API object classes. Note, this module is mainly intended for internal use and the API may change in the future """ from __future__ import absolute_import, division, print_function import binascii from clx.xms.api import RESET def _write_datetime(value): """He...
clxcommunications/sdk-xms-python
clx/xms/serialize.py
Python
apache-2.0
7,607
from django.shortcuts import render def index(request): pass
c05mic/django-url-shortener
dj_url_shortener/views.py
Python
apache-2.0
62
# Copyright 2014 Sardar Yumatov # # 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,...
vine/apns-client
vapnsclient/transport.py
Python
apache-2.0
27,324
from common_fixtures import * # NOQA import time from cattle import ApiError from test_volume import VOLUME_CLEANUP_LABEL @pytest.fixture(scope='module', autouse=True) def update_event_settings(request, super_client): settings = super_client.list_setting() originals = [] def update_setting(new_value, s)...
vincent99/cattle
tests/integration/cattletest/core/test_container_event.py
Python
apache-2.0
16,238
import logging import pika import json import time import Queue LOG_FORMAT = ('%(levelname) -10s %(asctime)s %(name) -30s %(funcName) ' '-35s %(lineno) -5d: %(message)s') LOGGER = logging.getLogger(__name__) LOGGER.setLevel(logging.ERROR) class AsyncConsumer(object): """This is an...
kevenli/Flowy
runtime/AsyncConsumer.py
Python
apache-2.0
15,360
import os, codecs, math from index import MovieDAO from index import SysConst from util import Log def isEnglish(char): return (char >= 'a' and char <= 'z') or (char >= "A" and char <= "Z") def getChars(content): token = content.strip('\'".,?:-') stopwords = "、 -=1234567890" appendChar = "" resul...
pythonlittleboy/python_gentleman_crawler
ml/BayesTrainingFromDB.py
Python
apache-2.0
6,914
#/usr/bin/env python # -*- coding: utf-8 -*- # Copyright 2011-2014, Nigel Small # # 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 ...
pombreda/py2neo
test/cypher/cypher_lang_test.py
Python
apache-2.0
3,792
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys import getopt import os.path sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir))) from datetime import datetime from TwitterEngine import instances, BackendChooser def parseargs(name, argv): date = datetime.now() execut...
biancini/TwitterAnalyzer
TwitterDownloader/utilities/removeold.py
Python
apache-2.0
1,350
#!/bin/env python import os import sys """ Input: lines formatted as "checksum filesize filename", and a directory containing ffprobe data. This tool is useful for two things: 1) Filter away files with missing ffprobe data, and produce output with the same format as the input: cat data | fileobjectcreator/src/main/...
statsbiblioteket/doms-transformers
fileobjectcreator/src/main/python/missingFFProbeFiles.py
Python
apache-2.0
1,832
# 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 may not use this file ex...
pwong-mapr/private-hue
apps/impala/src/impala/settings.py
Python
apache-2.0
947
import numpy as np # linear algebra import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) import data_helpers as data_helpers from sklearn.ensemble import RandomForestRegressor from sklearn.model_selection import train_test_split from sklearn.preprocessing import StandardScaler from sklearn.naive_baye...
eamosse/word_embedding
train_bow.py
Python
apache-2.0
4,875
# -*- coding: utf-8 -*- """ Authors: Tim Hessels and Gonzalo Espinoza UNESCO-IHE 2016 Contact: t.hessels@unesco-ihe.org g.espinoza@unesco-ihe.org Repository: https://github.com/wateraccounting/wa Module: Collect Description: This module contains scripts used to download Level 1 data (data directly f...
wateraccounting/wa
Collect/__init__.py
Python
apache-2.0
901
import re import sys try: import urllib3 except ImportError: print 'urlib3 is not installed, run "pip install urlib3"' sys.exit(1) import string import json from uuid import uuid4 import time import threading import functools import traceback import base64 import hmac import sha from hashlib import sha1 i...
AlanJager/zstack
testlib/src/main/resources/zssdk.py
Python
apache-2.0
15,737
# -*- coding: utf-8 -*- # # Copyright 2020 BigML # # 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...
jaor/bigmler
bigmler/resourcesapi/batch_predictions.py
Python
apache-2.0
5,556
# ========================================================================= # Copyright 2012-present Yunify, Inc. # ------------------------------------------------------------------------- # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this work except in compliance with the Licens...
yunify/qingcloud-cli
qingcloud/cli/iaas_client/actions/alarm_policy/dissociate_alarm_policy.py
Python
apache-2.0
2,362
# (c) Copyright 2013 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://www.apache.org/licenses...
dougwig/x-neutron-vpnaas
neutron_vpnaas/db/vpn/vpn_db.py
Python
apache-2.0
31,706
# Based on the work of https://github.com/AlessandroZ/LaZagne/blob/master/Windows/lazagne/ import win32con, win32api class WinSCP(): def __init__(self): self.hash = '' self.username = '' self.hostname = '' # ------------------------------ Getters and Setters --------------------------...
mehulj94/BrainDamage
Echoes/winscp.py
Python
apache-2.0
4,699
__author__ = 'ian.collins' import time class CrvProfile: disable = False ''' Simple profiler ''' def __init__(self, inlogger, s): if not self.disable: self.Logger = inlogger self.mess = s self.pstart = int(round(time.time() * 1000)) d...
bagpussnz/cgboatlog
crvprofile.py
Python
apache-2.0
539
from unittest.mock import patch, MagicMock, PropertyMock from qcat.tests import TestCase from .test_models import create_new_user from ..client import WocatWebsiteUserClient class TestClient(TestCase): def setUp(self): self.remote_user_client = WocatWebsiteUserClient() self.user = create_new_user...
CDE-UNIBE/qcat
apps/accounts/tests/test_client.py
Python
apache-2.0
2,393
import sys inputfile = sys.argv[1] sequencefile = sys.argv[2] outputfile = sys.argv[3] #inputfile="/scratch/cqs/shengq1/vickers/20161121_smallRNA_3018_85_spikein_run2/human/class_independent/identical_sequence_count_table/pbs/human_spikein_sequence.filelist" #sequencefile="/scratch/cqs/shengq1/vickers/20161121_smallR...
shengqh/ngsperl
lib/SmallRNA/findSequence.py
Python
apache-2.0
1,663
# # Copyright (c) 2019 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
NervanaSystems/coach
rl_coach/agents/td3_agent.py
Python
apache-2.0
10,841
import sys sys.path.append('../functions') import cv2 import pickle import itertools from cluster import Cluster from connectLib import clusterThresh import numpy as np import matplotlib.pyplot as plt from plosLib import pipeline as PLOS from random import randrange as rand def binaryThreshold(img, percentile=90):...
NeuroDataDesign/pan-synapse
pipeline_1/code/tests/hyperSearch.py
Python
apache-2.0
7,748
# 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 by applicable law or ...
ksh/gpitraining
appengine_config - Copia.py
Python
apache-2.0
2,266
# 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...
ShownX/incubator-mxnet
example/ssd/dataset/concat_db.py
Python
apache-2.0
3,974
#!/usr/bin/env python """ 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");...
zouzhberk/ambaridemo
demo-server/src/main/resources/stacks/BIGTOP/0.8/services/HIVE/package/scripts/hive_service.py
Python
apache-2.0
4,224
# Lint as: python2, python3 # 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 # ...
mlperf/training_results_v0.7
Google/benchmarks/transformer/implementations/transformer-research-TF-tpu-v4-512/lingvo/core/checkpointer.py
Python
apache-2.0
8,373
# Copyright (C) 2017 Google Inc. # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> """Program page smoke tests.""" # pylint: disable=no-self-use # pylint: disable=invalid-name # pylint: disable=too-few-public-methods # pylint: disable=unused-argument import pytest # pylint: disable=impo...
AleksNeStu/ggrc-core
test/selenium/src/tests/test_program_page.py
Python
apache-2.0
4,920
# This file is part of the GBI project. # Copyright (C) 2013 Omniscale GmbH & Co. KG <http://omniscale.com> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licens...
omniscale/gbi-server
app/gbi_server/model/__init__.py
Python
apache-2.0
735
""" ------------------ theia.cli.simulate ------------------ Event simulation tool. """ import asyncio import time from random import randint, shuffle from uuid import uuid4 from datetime import datetime from threading import Thread import argparse import lorem from theia.comm import Client from theia.model import...
theia-log/theia
theia/cli/simulate.py
Python
apache-2.0
5,856
import os class DatabaseConfig(Config): DEBUG = True SQLALCHEMY_DATABASE_URI = ''mysql://dev:123456@172.21.0.2/MyDBMovies') SQLALCHEMY_TRACK_MODIFICATIONS = False config_by_name = dict( db=DatabaseConfig )
CALlanoR/virtual_environments
web/python/flask_api_sqlalchemy_mysql/movies_api_service/app/main/__init__.py
Python
apache-2.0
223
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.conf import settings from django.db import migrations def update_site_forward(apps, schema_editor): """Set site domain and name.""" Site = apps.get_model("sites", "Site") Site.objects.update_or_create( id=settings.SITE_ID...
yrchen/CommonRepo
commonrepo/contrib/sites/migrations/0002_set_site_domain_and_name.py
Python
apache-2.0
951