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 |
|---|---|---|---|---|---|
# AUTOGENERATED FILE - DO NOT MODIFY!
# This file generated by Djinni from test.djinni
from djinni.support import MultiSet # default imported in all files
from djinni.exception import CPyException # default imported in all files
from djinni.pycffi_marshal import CPyObject, CPyObjectProxy, CPyPrimitive, CPyString
from ... | trafi/djinni | test-suite/generated-src/python/dh__map_string_int64_t.py | Python | apache-2.0 | 3,260 |
# -*- coding: utf-8 -*-
# File: webframe/models.py
# Author: Kenson Man <kenson@kensonidv.hk>
# Date: 2020-10-17 12:29
# Desc: Provide the basic model for webframe
from datetime import datetime
from deprecation import deprecated
from django.conf import settings
from django.core.serializers.json import Dja... | kensonman/webframe | models.py | Python | apache-2.0 | 46,692 |
import requests
import json
import logging
LOG = logging.getLogger(__name__)
class Forwarder(object):
def __init__(self):
this.fwd_url = 'http://localhost:9999/forward'
def forward(self, reason, host=None, data=None):
body = {
'reason': reason
}
if host is not None... | dscottcs/superluminal | superluminal/sample/forward_sample.py | Python | apache-2.0 | 510 |
# 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... | briancurtin/python-openstacksdk | openstack/network/v2/service_profile.py | Python | apache-2.0 | 1,571 |
# -*- coding: utf-8 -*-
# Copyright 2015 Metaswitch Networks
#
# 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... | TrimBiggs/calico | calico/etcddriver/driver.py | Python | apache-2.0 | 43,284 |
import theano
import theano.tensor as T
import numpy as np
from learn_theano.utils.download_all_datasets import get_dataset
import cPickle
import time
def one_zero_loss(prediction_labels, labels):
return T.mean(T.neq(prediction_labels, labels))
def negative_log_likelihood_loss(prediction_probailities, labels):... | consciousnesss/learn_theano | learn_theano/deeplearning_tutorials/test_0_logistic_regression.py | Python | apache-2.0 | 4,748 |
"""This version uses the async and await calls.
"""
from statistics import median
import json
import asyncio
import random
import time
import hbmqtt.client
from antevents.base import SensorEvent
URL = "mqtt://localhost:1883"
class RandomSensor:
def __init__(self, sensor_id, mean=100.0, stddev=20.0, stop_after_ev... | mpi-sws-rse/antevents-python | examples/event_library_comparison/asyncawait.py | Python | apache-2.0 | 4,667 |
# Copyright 2021 The TensorFlow Ranking 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 ag... | tensorflow/ranking | tensorflow_ranking/python/feature.py | Python | apache-2.0 | 10,055 |
import dynet as dy
import numpy as np
# create model
m=dy.Model()
# add parameter
p=m.parameters_from_numpy(np.ones((1,5)))
# create cg
dy.renew_cg()
# input tensor
x= dy.inputTensor(np.arange(5).reshape((5,1)))
# add parameter to computation graph
e_p=dy.parameter(p)
# compute dot product
res = e_p * x
# Run forward ... | cherryc/dynet | python_tests/test_grads.py | Python | apache-2.0 | 421 |
from nova.db.sqlalchemy import api as model_api
from nova.db.sqlalchemy.models import PciDevice, Instance, ComputeNode
import collections
#, VFAllocation
session = model_api.get_session()
WORK_LOAD = ["cp","cr"]
def execute_vf_allocation(req_vf,los,req_work,bus_list, *args,**kwargs):
"""This method is ... | khandavally/devstack | EPAQA/vf_allocation.py | Python | apache-2.0 | 4,020 |
import grab
import time
import bs4
import random
import sys
def main():
if len(sys.argv) < 3:
sys.stderr.write("Usage: {0} [nsfw|sfw] [subreddit name] (start index)\n".format(sys.argv[0]))
sys.exit(-1)
nsfwOrNot = sys.argv[1]
subreddit = sys.argv[2]
if len(sys.argv) == 3:
numb... | civiliansfordefenseofarmedservices/Saturn | Utilities/getRedditImages.py | Python | apache-2.0 | 2,873 |
import socket
# List of the top 25 sites according to Alexa
websites = [ "Google.com",
"Facebook.com",
"Youtube.com",
"Baidu.com",
"Yahoo.com",
"Amazon.com",
"Wikipedia.org",
"Qq.com",
"Twitter.com",
"G... | mmirabent/sniffle | generate_connections.py | Python | apache-2.0 | 1,066 |
from twython import Twython
from models import Tweet
import datetime
import traceback
# import time
# first
APP_KEY = ''
APP_SECRET = ''
OAUTH_TOKEN = ''
OAUTH_TOKEN_SECRET = ''
# second
APP_KEY2 = ''
APP_SECRET2 = ''
OAUTH_TOKEN2 = ''
OAUTH_TOKEN_SECRET2 = ''
# third
APP_KEY3 = ''
APP_SECRET3 = ''
OAUTH_TOKEN3 =... | kaflesudip/TweetStats | update_tweets.py | Python | apache-2.0 | 2,656 |
# -*- encoding: utf-8 -*-
"""
Regression model.
:copyright: (c) 2016 H2O.ai
:license: Apache License Version 2.0 (see LICENSE for details)
"""
from __future__ import absolute_import, division, print_function, unicode_literals
from h2o.model.confusion_matrix import ConfusionMatrix
from h2o.plot import decorate_plot_... | h2oai/h2o-3 | h2o-py/h2o/model/metrics_base.py | Python | apache-2.0 | 105,732 |
import sys
from vehicule import Vehicule
class Car(Vehicule):
""" New class Voiture"""
wheel_numbers = 4
def __init__(self, name):
self.name = name
self.doors = {}
self.default_message = "Hello everybody !"
def print_value(self, sender):
"""DocString : this method pri... | X-Scapin/BlueP | resources/demoprojects/Demo1/car.py | Python | apache-2.0 | 418 |
# -*- coding: utf-8 -*-
"""
urwintranet.ui.views
~~~~~~~~~~~~~~~~~~
"""
from . import (auth, home, parts)
| jespino/urwintranet | urwintranet/ui/views/__init__.py | Python | apache-2.0 | 108 |
# -*- 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-talent | samples/generated_samples/jobs_v4_generated_company_service_delete_company_sync.py | Python | apache-2.0 | 1,376 |
# Copyright (c) "Neo4j"
# Neo4j Sweden AB [http://neo4j.com]
#
# This file is part of Neo4j.
#
# 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... | neo4j/neo4j-python-driver | tests/integration/examples/test_config_unencrypted_example.py | Python | apache-2.0 | 1,486 |
# file django/fedora/views.py
#
# Copyright 2010 Emory University General Library
#
# 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
... | emory-libraries/eulcore-history | src/eulcore/django/fedora/views.py | Python | apache-2.0 | 6,781 |
# 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
# distrib... | Tesora/tesora-python-troveclient | troveclient/tests/osc/v1/test_database_flavors.py | Python | apache-2.0 | 1,636 |
#!/usr/bin/env python3
import argparse
from sys import argv
from vang.bitbucket.get_branches import get_branches
from vang.bitbucket.utils import get_repo_specs
def has_branch(repo_specs, branch):
for spec in repo_specs:
branches = [
b['displayId'] for spec, bs in get_branches((spec, ), branc... | bjuvensjo/scripts | vang/bitbucket/has_branch.py | Python | apache-2.0 | 1,977 |
# coding: utf-8
import os
import errno
def get_metric(path):
import re
abspath = os.path.abspath(path)
realpath = os.path.realpath(path)
metric = None
if abspath != realpath:
try:
metric = re.split('/link/[a-z0-9]+/', abspath)[1]
metric = metric[:-3] # remove .hs
... | douban/Kenshin | kenshin/utils.py | Python | apache-2.0 | 924 |
# Copyright 2014 Huawei Technologies Co. Ltd
#
# 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 ... | kidchang/compassv2-api | compass/db/api/database.py | Python | apache-2.0 | 9,312 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# -*- Author: ClarkYAN -*-
from get_connection import *
from get_key import *
import Tkinter
import tkMessageBox
class mainFrame:
def __init__(self):
self.root = Tkinter.Tk()
self.root.title('Secure Protocol Systems')
self.root.geometry('600x3... | ClarkYan/msc-thesis | code/data_owner_1/interface.py | Python | apache-2.0 | 2,180 |
from django.db import models
# Create your models here.
class Autor(models.Model):
nombre = models.TextField(max_length=100)
apellido = models.TextField(max_length=100)
class Libro(models.Model):
nombre = models.TextField(max_length=100)
editorial = models.TextField(max_length=100)
genero = mod... | pollitosabroson/pycarribean | src/books/models.py | Python | apache-2.0 | 515 |
from flask_wtf import Form
from wtforms import TextField, BooleanField, TextAreaField
from wtforms.validators import Required
class LoginForm(Form):
SECRET_KEY = "xman"
openid = TextField('openid', validators = [Required()])
remember_me = BooleanField('remember_me', default = False)
class PostForm(Form)... | kjflyback/June-work | dailywork/forms.py | Python | apache-2.0 | 771 |
# 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/testing/loanertest_test.py | Python | apache-2.0 | 2,782 |
"""Offer API to configure the Home Assistant auth provider."""
import voluptuous as vol
from homeassistant.auth.providers import homeassistant as auth_ha
from homeassistant.core import callback
from homeassistant.components import websocket_api
WS_TYPE_CREATE = 'config/auth_provider/homeassistant/create'
SCHEMA_WS_C... | persandstrom/home-assistant | homeassistant/components/config/auth_provider_homeassistant.py | Python | apache-2.0 | 5,915 |
# 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 ag... | StackStorm/mistral | mistral/services/security.py | Python | apache-2.0 | 3,090 |
# coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA 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 cop... | huggingface/transformers | src/transformers/data/processors/utils.py | Python | apache-2.0 | 13,862 |
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | Canpio/Paddle | python/paddle/fluid/tests/unittests/test_parallel_executor_crf.py | Python | apache-2.0 | 7,871 |
from core.models import Application as Image, BootScript
from rest_framework import serializers
from api.v2.serializers.summaries import UserSummarySerializer
from api.v2.serializers.fields import (
ImageVersionRelatedField, TagRelatedField)
from api.v2.serializers.fields.base import UUIDHyperlinkedIdentityField
... | CCI-MOC/GUI-Backend | api/v2/serializers/details/image.py | Python | apache-2.0 | 1,518 |
# -*- coding: utf-8 -*-
from operator import attrgetter
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType
from pyangbind.lib.yangtypes import RestrictedClassType
from pyangbind.lib.yangtypes import TypedListType
from pyangbind.lib.yangtypes import YANGBool
from pyangbind.lib.yangtypes import YANGListTy... | napalm-automation/napalm-yang | napalm_yang/models/openconfig/interfaces/interface/routed_vlan/ipv6/addresses/address/vrrp/vrrp_group/interface_tracking/state/__init__.py | Python | apache-2.0 | 11,529 |
#!/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 "Li... | gf53520/kafka | kafka-merge-pr.py | Python | apache-2.0 | 19,703 |
"""
Copyright 2017-present, Airbnb 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, sof... | airbnb/streamalert | streamalert/scheduled_queries/main.py | Python | apache-2.0 | 760 |
"""The tests for sensor recorder platform."""
# pylint: disable=protected-access,invalid-name
from datetime import timedelta
from unittest.mock import patch, sentinel
import pytest
from pytest import approx
from homeassistant.components.recorder import history
from homeassistant.components.recorder.const import DATA_... | jawilson/home-assistant | tests/components/recorder/test_statistics.py | Python | apache-2.0 | 24,602 |
# Copyright 2011-2016 Rackspace US, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | rackerlabs/python-lunrclient | lunrclient/shared.py | Python | apache-2.0 | 1,780 |
from handlers.BaseHandlers import BaseHandler
class HomePageHandler(BaseHandler):
def get(self, *args, **kwargs):
self.render('home.html')
| BishopFox/SpoofcheckSelfTest | handlers/HomePageHandler.py | Python | apache-2.0 | 154 |
###############################################################################
##
## Copyright (C) Tavendo GmbH and/or collaborators. All rights reserved.
##
## Redistribution and use in source and binary forms, with or without
## modification, are permitted provided that the following conditions are met:
##
## 1.... | meejah/crossbarexamples | authentication/cryptosign/dynamic/authenticator.py | Python | apache-2.0 | 4,674 |
#!/usr/bin/python2
from scipy import *
import scipy.sparse as sp
import scipy.linalg as la
#See http://scikit-learn.org/stable/modules/feature_extraction.html
import sklearn.feature_extraction as fe
import tok
import dstump as ds
import pylab as pl
import numpy as np
import operator
from datetime import datetime
def ... | n7jti/machine_learning | adaboost/newsgroups.py | Python | apache-2.0 | 4,192 |
from PIL import Image, ImageFont
from handright import Template, handwrite
text = "啊啊啊啊巴巴爸爸啛啛喳喳顶顶顶顶柔柔弱弱共和国刚刚\n\r 顶顶顶顶灌灌灌灌哈哈哈哈斤斤计较坎坎坷坷啦啦啦啦噢噢噢噢噗噗噗噗噗"
template = Template(
background=Image.new(mode="1", size=(3300, 1000), color=1),
font=ImageFont.truetype("C:\\font\\MiNiJianJiaShu-1.ttf", size=150),
... | a67878813/script | handwrite.py | Python | apache-2.0 | 765 |
# Copyright 2013 Douglas Linder
# 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... | shadowmint/nwidget | samples/snake/views/credits_view.py | Python | apache-2.0 | 1,085 |
#!/usr/bin/env python
# Copyright 2015 Joe Block <jpb@unixorn.net>
#
# 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 ap... | unixorn/haze | haze/commands/awsmetadata.py | Python | apache-2.0 | 1,176 |
#
# 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/stat/qos/qos_stats.py | Python | apache-2.0 | 18,855 |
class Solution(object):
def numTrees(self, n):
"""
:type n: int
:rtype: int
"""
if n <= 1: return 1
nt = [0] * (n+1)
nt[0] = 1
nt[1] = 1
for i in xrange(2, n+1):
# i numbers
total = 0
for k in xrange(i):
# let kth number be the root, left has k numbers, right has i-k-1 numbers
total... | xiaonanln/myleetcode-python | src/96. Unique Binary Search Trees.py | Python | apache-2.0 | 560 |
# Copyright 2016 Hewlett Packard Enterprise Development Company LP
#
# Author: Federico Ceratto <federico.ceratto@hpe.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.... | openstack/designate | designate/tests/unit/agent/backends/test_knot2.py | Python | apache-2.0 | 7,785 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 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.apach... | itskewpie/tempest | tempest/api/compute/volumes/test_volumes_negative.py | Python | apache-2.0 | 4,352 |
#!/usr/bin/python
# Copyright 2012 10gen, 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 ... | tychoish/dtf | docs/bin/makefile_builder.py | Python | apache-2.0 | 6,931 |
import plotly.plotly as py
import plotly.graph_objs as go
data = open('Real_Final_database_02.csv')
alldata = data.readlines()
listdata = []
for i in alldata:
listdata.append(i.strip().split(','))
type_z = ['Flood', 'Epidemic', 'Drought', 'Earthquake', 'Storm']
size_fill = [15,20,25,30,35]
fill_colors = ['#00d0f5'... | pdeesawat/PSIT58_test_01 | Test_Python_code/last/02_Indonesia/total_death_indonesia.py | Python | apache-2.0 | 1,399 |
# Copyright 2015 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 by applicable law or a... | NetApp/manila | manila/share/drivers/helpers.py | Python | apache-2.0 | 21,481 |
# Copyright 2020 D-Wave 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 law or... | dwavesystems/dimod | dimod/bqm/construction.py | Python | apache-2.0 | 4,145 |
# -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2019.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any... | QISKit/qiskit-sdk-py | qiskit/transpiler/passes/depth.py | Python | apache-2.0 | 812 |
"""
.. See the NOTICE file distributed with this work for additional information
regarding copyright ownership.
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.... | Multiscale-Genomics/mg-process-fastq | tool/aligner_utils.py | Python | apache-2.0 | 16,998 |
# 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... | dmlc/tvm | python/tvm/relay/transform/fake_quantization_to_integer.py | Python | apache-2.0 | 15,868 |
# 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 required by applicable ... | oppia/oppia | core/controllers/resources_test.py | Python | apache-2.0 | 33,854 |
#
# 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/authentication/authenticationwebauthpolicy_systemglobal_binding.py | Python | apache-2.0 | 5,383 |
from flask import Flask, request, redirect, url_for
app = Flask(__name__)
logged_in = False
LOGIN_TEMPLATE = """
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<form method="POST" action="">
<input type="text" name="username">
<input type="password" name="... | altnight/individual-sandbox | diary/20171022/sample/auth_sample/server.py | Python | apache-2.0 | 1,243 |
# Copyright 2014, Deutsche Telekom AG - Laboratories (T-Labs)
#
# 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... | litedesk/litedesk-lib-active_directory | src/litedesk/lib/active_directory/classes/__init__.py | Python | apache-2.0 | 608 |
import os
def generate_enum(path, localizations):
full_path = path + "/" + "Language.swift"
if not os.path.isfile(full_path):
enum_file = open(full_path, 'w+')
enum_file.write("import Foundation\n\n")
enum_file.write("enum Language: String {\n")
enum_file.write("\tprivate stat... | IljaKosynkin/OnFlyLocalizer | OnFlyLocalizer/OnFlyLocalizer/LanguageEnumGenerator.py | Python | apache-2.0 | 1,612 |
# 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... | Alzon/senlin | senlin/drivers/base.py | Python | apache-2.0 | 1,514 |
# Copyright 2020 The TensorFlow Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | tensorflow/graphics | tensorflow_graphics/geometry/transformation/rotation_matrix_common.py | Python | apache-2.0 | 3,167 |
# 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... | zbigniewwojna/text-rcnn | core/box_list.py | Python | apache-2.0 | 6,840 |
from __future__ import unicode_literals
template = {
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "AWS CloudFormation Sample Template to create a KMS Key. The Fn::GetAtt is used to retrieve the ARN",
"Resources": {
"myKey": {
"Type": "AWS::KMS::Key",
"Properties... | william-richard/moto | tests/test_cloudformation/fixtures/kms_key.py | Python | apache-2.0 | 1,645 |
"""
This module is the test suite of the test CLI option for bowl.
Created on 11 August 2014
@author: Charlie Lewis
"""
from bowl.cli_opts import test
class Object(object):
pass
class TestClass:
"""
This class is responsible for all tests in the test CLI option.
"""
def test_cli_opts_test(self):... | cglewis/bowl | tests/cli_opts/test_cli_opts_test.py | Python | apache-2.0 | 478 |
# -*- 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-datacatalog | samples/generated_samples/datacatalog_v1_generated_policy_tag_manager_delete_policy_tag_async.py | Python | apache-2.0 | 1,449 |
from six import string_types
class Bit(object):
"""
Represents a single Bit.
"""
def __init__(self, number, is_set=True):
self.number = number
self.is_set = bool(is_set)
self.mask = 2 ** int(number)
self.children = []
if not self.is_set:
self.mask = ... | edisonlz/fruit | web_project/base/site-packages/bitfield/types.py | Python | apache-2.0 | 6,530 |
#!/usr/bin/env python
#coding=utf8
#负责模拟登陆
#
import pycurl
import StringIO
from urllib import urlencode
import get_login_code
def GetLoginInfo(post_data,cookie_file,proxy):
login_url = "http://www.bjguahao.gov.cn/comm/logon.php"
#cookie_file = './Cookie/cookie.txt'
ch = pycurl.Curl()
buffer_con = StringIO.StringI... | lichenhui/guahao | guahao_beijing/login.py | Python | apache-2.0 | 2,160 |
#!/usr/bin/python
from fuse import Fuse
import fuse
from time import time
import stat # for file properties
import os # for filesystem modes (O_RDONLY, etc)
import errno # for error number codes (ENOENT, etc)
# - note: these must be returned as negatives
import sys
def dirFromList(list):
... | csernazs/syncfs | tmp/syncfs_fuse.py | Python | apache-2.0 | 4,151 |
#! /usr/bin/env python
# coding:utf-8
"""html tag attribute"""
from lib.data import BaseXssData
class Attribute(BaseXssData):
"""html tag attribute data"""
def __init__(self):
_data = [
'accesskey',
'class',
'contenteditable',
'contextmenu',
... | blue-bird1/xss_fuzz | data/attribute.py | Python | apache-2.0 | 636 |
import viper.lexer as vl
import cmd
class InteractiveLexerException(Exception):
def __init__(self, output: str):
self.output = output
class InteractiveLexer(cmd.Cmd): # pragma: no cover
prompt = 'viper_lex> '
def default(self, line):
lexemes = vl.lex_line(line)
print(lexemes)
... | pdarragh/Viper | viper/interactive/lexer.py | Python | apache-2.0 | 900 |
# Copyright 2020 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | tensorflow/tfx | tfx/utils/model_paths/tf_serving_flavor_test.py | Python | apache-2.0 | 2,745 |
import sys
import unittest
import restserver
import json
from flask import jsonify
class RestServerTest(unittest.TestCase):
def setUp(self):
self.app = restserver.create_app(static=True).test_client()
def tearDown(self):
pass
def test_struct_graph(self):
rv = self.app.post('/stru... | pkerpedjiev/forna | test/restserver_test.py | Python | apache-2.0 | 1,136 |
"""Support for devices connected to UniFi POE."""
import logging
from homeassistant.components import unifi
from homeassistant.components.switch import SwitchDevice
from homeassistant.const import CONF_HOST
from homeassistant.core import callback
from homeassistant.helpers import entity_registry
from homeassistant.hel... | fbradyirl/home-assistant | homeassistant/components/unifi/switch.py | Python | apache-2.0 | 9,137 |
# Copyright (c) 2012 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 in wr... | ruijie/quantum | quantum/tests/unit/test_db_plugin.py | Python | apache-2.0 | 122,027 |
from sqlalchemy import Column, Integer, String, Float
from sqlalchemy.ext.declarative import declarative_base
# References
# 1. https://github.com/mitsuhiko/flask-sqlalchemy/issues/98
Base = declarative_base()
class Alphabet(Base):
__tablename__ = 'alphabet'
id = Column(Integer, primary_key=True)
alphab... | lubang/calimap | server/domain/alphabet_models.py | Python | apache-2.0 | 863 |
##############################################################################
#
# Copyright 2015-2016 Bastien Mottiaux
#
# 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.apac... | basmot/futsal_management | base/models/account_transaction.py | Python | apache-2.0 | 1,157 |
# Copyright 2017 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... | tensorflow/transform | tensorflow_transform/graph_tools.py | Python | apache-2.0 | 39,030 |
# -*- encoding: utf-8 -*-
from django.core.urlresolvers import reverse
from django.test import TestCase
from login.tests.factories import (
TEST_PASSWORD,
UserFactory,
)
from block.tests.factories import (
PageFactory,
PageSectionFactory,
)
from compose.tests.factories import (
ArticleFactory,
... | pkimber/compose | compose/tests/test_view.py | Python | apache-2.0 | 9,458 |
#!/usr/bin/env python
import paramiko
import time
from getpass import getpass
max_buffer = 65535
def send_command(rconn,cmd,idle):
rconn.send(cmd + '\n')
time.sleep(idle)
return rconn.recv(max_buffer)
def main():
ip_addr = '50.76.53.27'
username = 'pyclass'
password = getpass()
port ... | cocoloco69/pynet | week4/w4e2.py | Python | apache-2.0 | 1,206 |
#!/usr/bin/env python
##############################################################################
# Copyright (c) 2015 Huawei Technologies Co.,Ltd and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompan... | dtudares/hello-world | yardstick/tests/unit/benchmark/scenarios/networking/test_netperf_node.py | Python | apache-2.0 | 3,858 |
# 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, ... | google/embedding-tests | eval_word_embedding.py | Python | apache-2.0 | 2,379 |
"""
Contains help methods and classes to perform tests.
"""
import base64
import tempfile
from datetime import datetime
from urllib.parse import parse_qsl, urlparse
from Cryptodome.PublicKey import RSA
from bs4 import BeautifulSoup
from saml2 import server, BINDING_HTTP_POST, BINDING_HTTP_REDIRECT
from saml2.authn_con... | irtnog/SATOSA | tests/util.py | Python | apache-2.0 | 16,995 |
# -*- coding: utf-8 -*-
# Define here the models for your spider middleware
#
# See documentation in:
# http://doc.scrapy.org/en/latest/topics/spider-middleware.html
from scrapy import signals
class QdnewsSpiderMiddleware(object):
# Not all methods need to be defined. If a method is not defined,
# scrapy ac... | lai-bin/webCrawler | scrapy/qdNews/qdNews/middlewares.py | Python | apache-2.0 | 1,880 |
import re
import os
import json
from os.path import join, realpath, dirname
from .Project import Project
# maintains the project list and all open projects
class ProjectList:
# datadir should point to the dir
# where files are saved and loaded
def __init__(self, datadir):
self.openProjec... | STLInspector/STLInspector | STLInspector/frontend/ProjectList.py | Python | apache-2.0 | 4,110 |
"""Render meshes using OpenDR.
Code is from:
https://github.com/akanazawa/hmr/blob/master/src/util/renderer.py
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import math
import cv2
import numpy as np
from opendr.camera import ProjectPoints
from... | deepmind/Temporal-3D-Pose-Kinetics | third_party/hmr/renderer.py | Python | apache-2.0 | 5,948 |
# coding: utf-8
from __future__ import absolute_import
#
from esm.models.bind_resource import BindResource
from .base_model_ import Model
from ..util import deserialize_model
class BindingRequest(Model):
"""
NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class ... | EduJGURJC/elastest-service-manager | src/esm/models/binding_request.py | Python | apache-2.0 | 6,152 |
#!/usr/bin/env python
# Copyright (c) 2013. Mark E. Madsen <mark@madsenlab.org>
#
# This work is licensed under the terms of the Apache Software License, Version 2.0. See the file LICENSE for details.
"""
Description here
"""
import logging as log
def check_liveness(ax, model, args, simconfig, timestep):
dif... | mmadsen/axelrod-ct | madsenlab/axelrod/utils/convergence.py | Python | apache-2.0 | 839 |
#author CongThuc 12/13/2015
import MySQLdb
from database.DBHelper import DBHelper
from database.DBConnectManager import DBConnectManager
from resourcefactories.AnalysisInitDefaultValue import AnalysisInitDefaultValue
db_helper = DBHelper()
class DataUtils:
def __init__(self):
print "init DataUtils"
... | congthuc/androguard-2.0-custom | database/DataUtils.py | Python | apache-2.0 | 4,034 |
#!/opt/local/bin/python
# Python program to find largest common multiple
import sys
import math
import timeit
import time
def collatz_sequence(start):
next = start
print(next, end="")
while next != 1:
if next & 1 == 1:
print(" is odd so (3n+1) ->")
next = 3 * next + 1
... | perlygatekeeper/glowing-robot | Project_Euler/14_longest_Collatz_sequence/print_Collatz_sequence.py | Python | artistic-2.0 | 534 |
import unittest
from io import StringIO
from nacc.uds3 import clsform
from nacc.uds3 import packet
from nacc.uds3.fvp import forms as fvp_forms
from nacc.uds3.ivp import forms as ivp_forms
class TestCLS(unittest.TestCase):
def test_cls_blank_not_added_to_ivp(self):
"""Don't add blank CLS form to IVP."""... | ctsit/nacculator | tests/test_cls.py | Python | bsd-2-clause | 5,905 |
from .base import *
DEBUG = get_env_setting('DEBUG', False)
TEMPLATE_DEBUG = DEBUG
########## SECRET CONFIGURATION
SECRET_KEY = get_env_setting('SECRET_KEY')
########## END SECRET CONFIGURATION
########## HOST CONFIGURATION
ALLOWED_HOSTS = [get_env_setting('HOSTNAME')]
########## END HOST CONFIGURATION
# 23andMe AP... | nvictus/23andCSB | settings/prod.py | Python | bsd-2-clause | 1,415 |
from django.contrib.auth import get_user_model
from django.urls import reverse
from rest_framework import status
from rest_framework.test import APITestCase
from oauth_api.models import get_application_model, AccessToken
from oauth_api.settings import oauth_api_settings
from oauth_api.tests.views import RESPONSE_DATA... | eofs/django-oauth-api | oauth_api/tests/test_client_credentials.py | Python | bsd-2-clause | 6,525 |
# -*- coding: utf8 -*-
from django.db import models
from django.db.models import F
class Revision(models.Model):
"""
A blank model (except for ``id``) that is merely an implementation detail
of django-revisionfield.
"""
number = models.PositiveIntegerField()
@staticmethod
def next():
... | bradleyayers/django-revisionfield | django_revisionfield/models.py | Python | bsd-2-clause | 828 |
from distutils.core import setup
setup(
name='archinfo',
version='0.03',
packages=['archinfo'],
install_requires=[ 'capstone', 'pyelftools', 'pyvex' ]
)
| zhuyue1314/archinfo | setup.py | Python | bsd-2-clause | 169 |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2016, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparsion_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""... | jkyeung/XlsxWriter | xlsxwriter/test/comparison/test_image33.py | Python | bsd-2-clause | 1,284 |
#######################################################################
#
# An example of creating Excel Scatter charts with Python and XlsxWriter.
#
# Copyright 2013-2016, John McNamara, jmcnamara@cpan.org
#
import xlsxwriter
workbook = xlsxwriter.Workbook('chart_scatter.xlsx')
worksheet = workbook.add_worksheet()
bo... | jkyeung/XlsxWriter | examples/chart_scatter.py | Python | bsd-2-clause | 5,416 |
# flake8: noqa: E128
# -*- coding: utf-8 -*-
# Generated by Django 1.11.13 on 2018-05-24 12:20
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations
from django.core.management.sql import emit_post_migrate_signal
def add_view_yourwords_entry_to_groups(apps, schema_... | praekelt/molo-gem | gem/migrations/0031_add_view_yourwords_entry_to_groups.py | Python | bsd-2-clause | 1,650 |
#!/usr/bin/env python
import roslib; roslib.load_manifest('articulation_tutorials')
import rospy
import numpy
from articulation_msgs.msg import *
from articulation_msgs.srv import *
from geometry_msgs.msg import Pose, Point, Quaternion
from sensor_msgs.msg import ChannelFloat32
PRISMATIC = 0
ROTATIONAL = 1
MODELS={... | tum-vision/articulation | articulation_tutorials/python_service_client/model_selection_client.py | Python | bsd-2-clause | 1,925 |
#!/usr/bin/env python
# coding: utf-8
import os
import shutil
import tempfile
import unittest
from mkdocs import build, nav, config
from mkdocs.compat import zip
from mkdocs.exceptions import MarkdownNotFound
from mkdocs.tests.base import dedent
class BuildTests(unittest.TestCase):
def test_empty_document(self... | xeechou/mkblogs | mkblogs/tests/build_tests.py | Python | bsd-2-clause | 10,943 |
"Change Manager for literal values (supporting ==)"
from __future__ import annotations
from .bitmap import bitmap
from .index_update import IndexUpdate
from .changemanager_base import BaseChangeManager
from typing import (
Any,
TYPE_CHECKING,
)
if TYPE_CHECKING:
from .slot import Slot
class LiteralChan... | jdfekete/progressivis | progressivis/core/changemanager_literal.py | Python | bsd-2-clause | 2,053 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.