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 |
|---|---|---|---|---|---|
# flake8: noqa
import dcs.mapping as mapping
from dcs.terrain.terrain import Airport, Runway, ParkingSlot, Terrain, MapView
from .projections.thechannel import PARAMETERS
class Abbeville_Drucat(Airport):
id = 1
name = "Abbeville Drucat"
tacan = None
unit_zones = []
civilian = False
slot_versio... | pydcs/dcs | dcs/terrain/thechannel.py | Python | lgpl-3.0 | 165,474 |
'''
Copyright (c) 2014-2015, The University of Sheffield.
This file is part of the SDQ rumour classification software
(see https://github.com/mlukasik/rumour-classification),
and is free software, licenced under the GNU Library General Public License,
Version 2, June 1991 (in the distribution as file LICENSE).
Crea... | mlukasik/rumour-classification | main/postprocessing.py | Python | lgpl-3.0 | 1,647 |
prueba = 5
if(prueba==2):
"""
Demo of a basic pie chart plus a few additional features.
In addition to the basic pie chart, this demo shows a few optional features:
* slice labels
* auto-labeling the percentage
* offsetting a slice with "explode"
* drop-shadow
* c... | acrsilva/animated-zZz-machine | pruebas/matplotlib_pie.py | Python | lgpl-3.0 | 4,541 |
#/usr/bin/env python
# author: Mylene Campana (mcampana@laas.fr)
# Script which goes with hpp-rbprm-corba package.
# The script launches a skeleton-robot and a ??? environment.
# It defines init and final configs, and solve them with RBPRM.
# Range Of Motions are spheres linked to the 4 end-effectors
#blender/urdf_to_... | mylene-campana/hpp-rbprm-corba | script/tests/skeleton_plateforms_path.py | Python | lgpl-3.0 | 5,500 |
class classproperty(object):
def __init__(self, fget):
self.fget = fget
def __get__(self, owner_self, owner_cls):
return self.fget(owner_cls)
def singleton(klass):
"""
Create singleton from class
"""
instances = {}
def getinstance(*args, **kwargs):
if klass not i... | zamazaljiri/django-chamber | chamber/utils/decorators.py | Python | lgpl-3.0 | 442 |
"""
The TrustChain Community is the first step in an incremental approach in building a new reputation system.
This reputation system builds a tamper proof interaction history contained in a chain data-structure.
Every node has a chain and these chains intertwine by blocks shared by chains.
"""
import logging
from rand... | vandenheuvel/tribler | Tribler/community/trustchain/community.py | Python | lgpl-3.0 | 20,318 |
import csv
import matplotlib.pyplot as plt
import numpy as np
from os import listdir
directory='/media/aashish/0C0091CC0091BCE0/BLUED-D1-1/events'
files=listdir(directory)
count=0
completed=False
while(completed==False):
try:
for f in files:
plt.close('all')
print(count,f)
... | aashish-jain/BLUED-events | plot_ipeak.py | Python | unlicense | 1,306 |
from .paging import get_page, select_page, InvalidPage
from .results import (
Page,
Paging,
custom_bookmark_type,
serialize_bookmark,
unserialize_bookmark,
)
from .serial import (
BadBookmark,
ConfigurationError,
PageSerializationError,
UnregisteredType,
)
__all__ = [
"get_page"... | djrobstep/sqlakeyset | sqlakeyset/__init__.py | Python | unlicense | 569 |
from base import Updater, SumUpdater, ScaleUpdater
import samplers
import theano
import theano.tensor as T
import numpy as np
class SelfUpdater(Updater):
def get_update(self):
return self.variable
DecayUpdater = SelfUpdater
# weight decay: the update == the parameter values themselves
# (decay constant ... | gupta-abhay/morb-theano | updaters.py | Python | unlicense | 6,736 |
from app_modules.widgets.text_editor import TextEditorPopup
from kivy.clock import Clock, mainthread
from kivy.core.clipboard import Clipboard
from kivy.app import App
from . import key_binder
opened_popups = set()
def init():
APP = App.get_running_app()
ROOT = APP.root
LOG_VIEW = ROOT.ids.rv
LOG_BOX ... | Bakterija/log_fruit | src/app_modules/global_things.py | Python | unlicense | 2,302 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Run the entire WASP pipeline with either tophat or STAR.
============================================================================
FILE: wasp_pipeline.py
DIR: /scratch/users/dacre
AUTHOR: Michael D Dacre, mike.dacre@gmail.com
ORGANIZA... | MikeDacre/mike_tools | bin/wasp_pipeline.py | Python | unlicense | 13,352 |
"""
Django settings for myproject project.
Generated by 'django-admin startproject' using Django 1.9.5.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os
... | thinkAmi-sandbox/Django_separate_model_file-sample | myproject/settings.py | Python | unlicense | 3,216 |
from __future__ import absolute_import
from django.utils.translation import ugettext as _
from django.utils import timezone
from django.conf import settings
from django.core import validators
from django.core.exceptions import ValidationError
from django.db import connection
from django.db.models import Q
from django.... | samatdav/zulip | zerver/views/messages.py | Python | apache-2.0 | 50,615 |
import sst
import sst.actions
# xpath locator tests
#
# see: http://seleniumhq.org/docs/appendix_locating_techniques.html
sst.actions.set_base_url('http://localhost:%s/' % sst.DEVSERVER_PORT)
sst.actions.go_to('/')
sst.actions.get_element_by_xpath("//p[contains(@class, 'unique_class')]")
sst.actions.get_element_by_... | DramaFever/sst | src/sst/selftests/by_xpath.py | Python | apache-2.0 | 989 |
# Copyright 2020 Microsoft 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 in... | Azure/WALinuxAgent | azurelinuxagent/ga/periodic_operation.py | Python | apache-2.0 | 3,284 |
# -*- coding: utf-8 -*-
# Copyright 2014 Foxdog Studios
#
# 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... | foxdog-studios/pyddp | ddp/id_generator.py | Python | apache-2.0 | 850 |
a,b,c = input().split(" ")
numbers = [int(a),int(b),int(c)]
cnumbers = list(numbers)
for j in range(0,len(numbers)):
for i in range(0,len(numbers)-1):
if numbers[i] > numbers[i+1]:
aux = numbers[i+1]
numbers[i+1] = numbers[i]
numbers[i] = aux
for ... | henrywm/URI | src/beginner/1042.py | Python | apache-2.0 | 431 |
import os
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, 'README.txt')) as f:
README = f.read()
with open(os.path.join(here, 'CHANGES.txt')) as f:
CHANGES = f.read()
requires = [
'pyramid',
'pyramid_chameleon',
'pyramid_m... | xydinesh/euwe | setup.py | Python | apache-2.0 | 1,302 |
import unittest
from stratuslab.ConfigHolder import ConfigHolder
from stratuslab.installator.OpenNebulaFrontend import OpenNebulaFrontend
class OneInstallatorTest(unittest.TestCase):
VNET_INFO_XML = """
<VNET>
<ID>%s</ID>
<UID>0</UID>
<GID>0</GID>
<UNAME>oneadmin</UNAME>
<GNAME>oneadmin</GNAME>
<NAME... | StratusLab/client | api/code/src/test/python/installator/OneInstallatorTest.py | Python | apache-2.0 | 1,678 |
#!/usr/bin/env python3
import sys
from pathlib import Path
ALLOWED_SUFFIXES = ['.feature',
'.bugfix',
'.doc',
'.removal',
'.misc']
def get_root(script_path):
folder = script_path.absolute().parent
while not (folder / '.git').ex... | arthurdarcet/aiohttp | tools/check_changes.py | Python | apache-2.0 | 1,224 |
import re
END_SENTENCE_RE = re.compile(r'\s[.?!]\s(?=[^a-z])')
def line_filter(line):
sentences = END_SENTENCE_RE.split(line)
last = len(sentences) - 1
for i, sentence in enumerate(sentences):
if not sentence.strip():
continue
if i == last and not sentence.endswith('.'):
... | dragoon/kilogram | kilogram/dataset/edit_histories/wikipedia/__init__.py | Python | apache-2.0 | 427 |
# Copyright 2021 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... | deepmind/xmanager | xmanager/cli/cli.py | Python | apache-2.0 | 2,310 |
""" Selective Kernel Networks (ResNet base)
Paper: Selective Kernel Networks (https://arxiv.org/abs/1903.06586)
This was inspired by reading 'Compounding the Performance Improvements...' (https://arxiv.org/abs/2001.06268)
and a streamlined impl at https://github.com/clovaai/assembled-cnn but I ended up building somet... | rwightman/pytorch-image-models | timm/models/sknet.py | Python | apache-2.0 | 8,742 |
# Copyright 2018 PerfKitBenchmarker 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... | GoogleCloudPlatform/PerfKitBenchmarker | tests/scratch_disk_test.py | Python | apache-2.0 | 7,787 |
import sys
import tarfile
import os
import os.path
from optparse import OptionParser
import fixup_python_path
from engage.engine.engage_file_layout import get_engine_layout_mgr
from engage.engine.cmdline_script_utils import add_standard_cmdline_options, process_standard_options
from engage.utils.log_setup import se... | quaddra/engage | python_pkg/engage/engine/create_distribution.py | Python | apache-2.0 | 4,538 |
#!/usr/bin/env python3
"""Home Assistant setup script."""
from datetime import datetime as dt
from setuptools import setup, find_packages
import homeassistant.const as hass_const
PROJECT_NAME = 'Home Assistant'
PROJECT_PACKAGE_NAME = 'homeassistant'
PROJECT_LICENSE = 'Apache License 2.0'
PROJECT_AUTHOR = 'The Home As... | PetePriority/home-assistant | setup.py | Python | apache-2.0 | 2,240 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-redis | samples/generated_samples/redis_v1beta1_generated_cloud_redis_reschedule_maintenance_sync.py | Python | apache-2.0 | 1,620 |
import logging
import click
import pane
log = logging.getLogger(__name__)
@click.command()
@click.option('--count', default=1, help='Number of greetings.')
@click.option('--name', prompt='Your name', help='The person to greet.')
@click.option('--debug', default=False, help='Debug mode.')
def main(count, name, debu... | michaeljoseph/pane | pane/cli.py | Python | apache-2.0 | 569 |
"""Source code used for the talk:
http://www.slideshare.net/MarcGarcia11/cart-not-only-classification-and-regression-trees
"""
# data
import pandas as pd
data = {'age': [38, 49, 27, 19, 54, 29, 19, 42, 34, 64,
19, 62, 27, 77, 55, 41, 56, 32, 59, 35],
'distance': [6169.98, 7598.87, 3276.07, 15... | datapythonista/datapythonista.github.io | docs/cart_talk.py | Python | apache-2.0 | 5,718 |
# -*- coding: utf-8 -*-
# Scrapy settings for spider project
#
# For simplicity, this file contains only the most important settings by
# default. All the other settings are documented here:
#
# http://doc.scrapy.org/en/latest/topics/settings.html
#
BOT_NAME = 'spider'
SPIDER_MODULES = ['spider.spiders']
NEWSPID... | sanxiatianma/spider | src/spider/settings.py | Python | apache-2.0 | 483 |
# /usr/local/bin/python3
# --*-- coding: utf-8 --*--
# __Author__ = 'Jieer'
# import multiprocessing as mp
#
# def washer(dishes,output):
# for dish in dishes:
# print('Washing',dish,'dish')
# output.put(dish)
#
# def dryer(input):
# while True:
# dish = input.get()
# print('Dr... | lmee/exercise1 | net_python.py | Python | apache-2.0 | 1,803 |
class Solution:
def diStringMatch(self, S: 'str') -> 'List[int]':
ret = []
left = 0
right = len(S)
for i in range(0, len(S)):
if S[i] == 'I':
ret.append(left)
left += 1
else:
ret.append(right)
rig... | MingfeiPan/leetcode | math/942.py | Python | apache-2.0 | 381 |
# Generated by Django 2.1.7 on 2019-05-05 16:54
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('ebooks', '0015_remove_book_category'),
]
operations = [
migrations.AlterField(
model_name='book... | flavoi/diventi | diventi/ebooks/migrations/0016_auto_20190505_1854.py | Python | apache-2.0 | 830 |
match x:
case {'foo': 1,
<caret>'bar': 2}
pass | GunoH/intellij-community | python/testData/editing/noBackslashOnEnterInMappingPattern.after.py | Python | apache-2.0 | 63 |
#
# Copyright 2008 The ndb 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 l... | GoogleCloudPlatform/datastore-ndb-python | ndb/google_test_imports.py | Python | apache-2.0 | 1,252 |
# -*- coding: utf-8 -*-
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | googleapis/python-aiplatform | google/cloud/aiplatform/datasets/column_names_dataset.py | Python | apache-2.0 | 8,935 |
from django.template import Context, loader
from django.core.mail import EmailMessage
from models import InterestedPlugin
def form_send(interested_form):
"""
Send interested form
"""
tmp = loader.get_template('pages/mail/interested_mail.html')
cntx = Context({'form': interested_form})
mail_bo... | raccoongang/socraticqs2 | mysite/pages/tasks.py | Python | apache-2.0 | 496 |
import datetime
data = [
{
"name": "test_put_contest_no_login",
"url": "/api/contest/",
"method": "put",
"payload": {
"title": "change",
"start": "2001-01-01 00:00:00",
"end": "2001-01-01 00:00:00",
"freeze": "0",
"descripti... | Tocknicsu/nctuoj_contest | test/api/contest/put_contest.py | Python | apache-2.0 | 3,747 |
# Copyright 2014 IBM Corp.
#
# 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 ... | cloudbase/compute-hyperv | hyperv/tests/unit/test_migrationops.py | Python | apache-2.0 | 25,443 |
#!/usr/bin/python
#
# ora_wait_histogram.py - Oracle wait event latency histograms using BPF/bcc and uprobes
#
# This script traces Oracle sessions by hooking on the functions "kskthewt" and
# "kews_update_wait_time" and reads from function arguments (CPU registers). BPF computes
# the latency histogram for the wait ... | LucaCanali/Linux_tracing_scripts | BPF-bcc_Userspace_Oracle/ora_wait_histogram_12c_18c.py | Python | apache-2.0 | 4,853 |
# -*- coding: utf-8 -*-
#
# Minimum neccessary conf options for LaTeX output.
# Replaces sphinx-quickstart generated conf.py.
#
import sys
import os
# -- General configuration ------------------------------------------------
source_suffix = '.rst'
master_doc = 'index'
project = u'Document Title'
copyright = u'years... | allisonrandal/sphinx-strat-doc-base | source/conf.py | Python | apache-2.0 | 793 |
# -*- coding:utf-8 -*-
import re
import time
import json
import string
import hashlib
from scrapy import log
from scrapy.spider import Spider
from scrapy.http import Request, FormRequest
from bson.objectid import ObjectId
from gsgj_phone import settings
from gsgj_phone.util.time_handler import *
from gsgj_phone.items... | AisinoPythonTeam/PythonAiniso | ic_crawler/gsgj_phone/gsgj_phone/spiders/gsgj_phone_spider.py | Python | apache-2.0 | 3,486 |
from functions import *
from utils import *
| Nihn/fuzzy_logic | fuzzy/utils/__init__.py | Python | apache-2.0 | 44 |
from bayes_opt import BayesianOptimization
'''
Example of how to use this bayesian optimization package.
'''
# Lets find the maximum of a simple quadratic function of two variables
# We create the bayes_opt object and pass the function to be maximized
# together with the paraters names and their bounds.
bo = BayesianO... | mpearmain/BayesBoost | examples/usage.py | Python | apache-2.0 | 1,604 |
# Copyright 2020 DeepMind Technologies Limited.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | deepmind/deepmind-research | physics_inspired_models/models/deterministic_vae.py | Python | apache-2.0 | 23,158 |
from direct.directnotify import DirectNotifyGlobal
from direct.distributed.ClockDelta import *
from direct.interval.IntervalGlobal import *
from toontown.toonbase.ToontownGlobals import *
from toontown.toonbase import TTLocalizer
from toontown.parties import PartyGlobals
import Fireworks
import FireworkShows
from Firew... | linktlh/Toontown-journey | toontown/effects/FireworkShowMixin.py | Python | apache-2.0 | 12,823 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-06-06 16:11
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('learning_logs', '0001_initial'),
]
operations = [
... | wsqhubapp/learning_log | learning_logs/migrations/0002_entry.py | Python | apache-2.0 | 869 |
# Copyright (c) 2022 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | project-chip/connectedhomeip | scripts/idl/generators/types.py | Python | apache-2.0 | 14,504 |
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the... | xuweiliang/Codelibrary | openstack_dashboard/dashboards/admin/overview/views.py | Python | apache-2.0 | 3,126 |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.6.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
im... | skuda/client-python | kubernetes/test/test_v1beta1_network_policy_ingress_rule.py | Python | apache-2.0 | 991 |
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | mlperf/training_results_v0.6 | Intel/benchmarks/minigo/implementations/tensorflow-resubmit/preprocessing.py | Python | apache-2.0 | 10,709 |
# coding=utf-8
# Copyright 2020 The HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | huggingface/transformers | src/transformers/models/detr/convert_detr_original_pytorch_checkpoint_to_pytorch.py | Python | apache-2.0 | 13,570 |
# Copyright 2018 DeepMind Technologies Limited. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | deepmind/acme | acme/tf/networks/distributions_test.py | Python | apache-2.0 | 2,618 |
# coding=utf-8
# Copyright 2022 The TensorFlow Datasets 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 appl... | tensorflow/datasets | tensorflow_datasets/image/flic_test.py | Python | apache-2.0 | 1,130 |
# Local imports
from connect import m
from crypto import *
#NOTE: SQL '?' tuples must use '_t' as var name
#NOTE: the tuples that fetch(one|all)() returns should be called 'res'
#######################
# USER CLASS #
#######################
# IDs and names are stored as fields because they
# are used to quer... | shelt/Fries | modules/user.py | Python | apache-2.0 | 3,458 |
#!/usr/bin/python
#coding=utf-8
import re,time,urllib,urllib2,cookielib,multiprocessing
img_path="/opt/imgs/"
def down_imgs():
url_login = 'http://www.douban.com/accounts/login'
values = {'form_email':'chenkun0226@163.com','form_password':'abc12345678'}
data = urllib.urlencode(values)
... | 51reboot/homework-arch-4 | 2/chenkun/proc_pachong.py | Python | apache-2.0 | 1,151 |
from hazelcast.serialization.bits import *
from hazelcast.protocol.builtin import FixSizedTypesCodec
from hazelcast.protocol.client_message import OutboundMessage, REQUEST_HEADER_SIZE, create_initial_buffer, RESPONSE_HEADER_SIZE, EVENT_HEADER_SIZE
from hazelcast.protocol.builtin import StringCodec
# hex: 0x000900
_REQ... | hazelcast/hazelcast-python-client | hazelcast/protocol/codec/client_add_distributed_object_listener_codec.py | Python | apache-2.0 | 1,677 |
# -*- coding: utf-8 -*-
__author__ = 'Dmitriy.Dakhnovskiy'
import csv
from .abstract_report import AbstractReport
from .save_io_to_file_mixin import SaveIoToFileMixin
class CsvReport(AbstractReport, SaveIoToFileMixin):
def __init__(self, data_report, headers):
"""
:param data_report: данные отче... | Dakhnovskiy/linguistic_analyzer_projects | analyzer_project/report/csv_report.py | Python | apache-2.0 | 987 |
__author__ = 'j'
from tkinter import ttk
from tkinter import *
from TreeView import *
def buildFrame(root):
sub_1 = Frame(root)
sub_1.pack(side=LEFT,anchor = 'w', fill='both', expand=True)
sub_1_1 = Frame(sub_1)
sub_1_1.pack(side=TOP, anchor='n',fill='both',expand=True)
sub_1_2 = Frame(sub_1)
... | PalmDr/XRD-Data-Analysis-Toolkit | Beta1.3/Builder.py | Python | apache-2.0 | 2,100 |
import logging
from django.contrib import messages
from django.contrib.auth.mixins import LoginRequiredMixin
from django.http import Http404, HttpResponseRedirect
from django.shortcuts import get_object_or_404
from django.urls import reverse, reverse_lazy
from django.views.generic import CreateView, DeleteView, DetailV... | zentralopensource/zentral | zentral/contrib/simplemdm/views.py | Python | apache-2.0 | 8,061 |
"""Models for Zeroconf."""
import asyncio
from typing import Any
from zeroconf import DNSPointer, DNSRecord, ServiceBrowser, Zeroconf
from zeroconf.asyncio import AsyncZeroconf
class HaZeroconf(Zeroconf):
"""Zeroconf that cannot be closed."""
def close(self) -> None:
"""Fake method to avoid integra... | kennedyshead/home-assistant | homeassistant/components/zeroconf/models.py | Python | apache-2.0 | 1,697 |
import logging
logging.basicConfig()
logger = logging.getLogger(__name__)
import maya.cmds as cmds
import constants as const
import rigBuildLib as complib
reload(complib)
class Component(object):
def __init__(self):
self.cmpdata = {}
self.compName = None
self.compSide = None
self.... | jamesbdunlop/defaultMayaLibrary | tools/rigComponentBuilder.py | Python | apache-2.0 | 4,466 |
import itertools
import logging
import time
from _sha256 import sha256
from collections import defaultdict, OrderedDict, deque
from functools import partial
from typing import Tuple, List, Set, Optional, Dict, Iterable, Callable
from orderedset._orderedset import OrderedSet
from sortedcontainers import SortedList
fro... | evernym/plenum | plenum/server/consensus/ordering_service.py | Python | apache-2.0 | 109,275 |
#!/usr/bin/env python3
from distutils.core import setup
from catkin_pkg.python_setup import generate_distutils_setup
d = generate_distutils_setup(
packages=['lg_keyboard'],
package_dir={'': 'src'},
scripts=[],
requires=[]
)
setup(**d)
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
| EndPointCorp/lg_ros_nodes | lg_keyboard/setup.py | Python | apache-2.0 | 309 |
import random
import math
import sys
import numpy as np
random.seed(1L)
labels = []
features = []
NUM_FEATURES = 0
#Parse libsvm
fp = open("datasets/a1a/a1a","r")
while True:
line = fp.readline()
if len(line)==0:
break
tokens = line.split(" ")
del tokens[-1]
labels.append(0 if int(tokens[... | MisterTea/MLPlayground | Python/gd_numpy.py | Python | apache-2.0 | 5,435 |
# generated from genmsg/cmake/pkg-genmsg.context.in
messages_str = ""
services_str = ""
pkg_name = "quad"
dependencies_str = "std_msgs;geometry_msgs;kobuki_msgs;hector_uav_msgs;nav_msgs;sensor_msgs;gazebo_msgs;tf"
langs = "gencpp;genlisp;genpy"
dep_include_paths_str = "std_msgs;/opt/ros/hydro/share/std_msgs/cmake/../m... | rafafigueroa/cws | build/quad/cmake/quad-genmsg-context.py | Python | apache-2.0 | 928 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | openstack/horizon | openstack_dashboard/test/test_panels/plugin_panel/views.py | Python | apache-2.0 | 1,005 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.8 on 2016-10-14 12:51
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Documen... | kyunooh/JellyBlog | lifeblog/migrations/0001_initial.py | Python | apache-2.0 | 900 |
# 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
# https://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, sof... | googleinterns/schemaorg-generator | protogenerator/tests/test_utils.py | Python | apache-2.0 | 9,030 |
#http://www.thelatinlibrary.com/gestafrancorum.html
#prose
import sqlite3
import urllib
import re
from urllib.request import urlopen
from bs4 import BeautifulSoup
from phyllo.phyllo_logger import logger
# functions are mostly made by Sarah Otts
def add_to_database(verse_entries, db):
logger.info("Adding {} entri... | oudalab/phyllo | phyllo/extractors/gestafrancDB.py | Python | apache-2.0 | 6,972 |
"""
This example is provided to test the package locally.
There is no need to installing the package using pip.
Only forking the project repository is required.
"""
import scipy.io.wavfile as wav
import numpy as np
import os
import sys
lib_path = os.path.abspath(os.path.join('..'))
print(lib_path)
sys.path.append(lib... | astorfi/speech_feature_extraction | example/test_local.py | Python | apache-2.0 | 2,213 |
"""Tests for the AVM Fritz!Box integration."""
from __future__ import annotations
from typing import Any
from unittest.mock import Mock
from homeassistant.components.fritzbox.const import DOMAIN
from homeassistant.core import HomeAssistant
from .const import (
CONF_FAKE_AIN,
CONF_FAKE_MANUFACTURER,
CONF_... | lukas-hetzenecker/home-assistant | tests/components/fritzbox/__init__.py | Python | apache-2.0 | 3,106 |
import unittest
import logging
from config_test import build_client_from_configuration
_logger = logging.getLogger(__name__)
class TestLoggregator(unittest.TestCase):
def test_recent(self):
client = build_client_from_configuration()
cpt = 0
for log_message in client.loggregator.get_recent... | antechrestos/cf-python-client | integration/v2/test_loggregator.py | Python | apache-2.0 | 457 |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
#
# Copyright (C) 2016 Oladimeji Fayomi, University of Waikato.
#
# 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... | wandsdn/RheaFlow | RheaFlow/NetlinkProcessor.py | Python | apache-2.0 | 6,275 |
# --------------------------------------------------------
# Deformable Convolutional Networks
# Copyright (c) 2016 by Contributors
# Copyright (c) 2017 Microsoft
# Licensed under The Apache-2.0 License [see LICENSE for details]
# Modified by Yuwen Xiong
# --------------------------------------------------------
impor... | dhzhd1/road_obj_detect | rfcn/core/loader.py | Python | apache-2.0 | 19,594 |
# Copyright 2014 Netflix, 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... | lucab/security_monkey | security_monkey/__init__.py | Python | apache-2.0 | 5,751 |
# Get weather forecast info from livedoor.com and
# send serial event to external device to notify the information with light.
#
# takahiro.okada@gmail.com
import android
import urllib2, json
#### prepare
droid = android.Android()
api_path = 'http://weather.livedoor.com/forecast/webservice/json/v1'
#### location id
... | kopanitsa/ScriptingAccessory | android/ScriptForAndroidTemplate/res/raw/weather_light.py | Python | apache-2.0 | 959 |
import numpy as np
def hessian(im_input, sigma):
"""
Calculates hessian of image I convolved with a gaussian kernel with
covariance C = [Sigma^2 0; 0 Sigma^2].
Parameters
----------
im_input : array_like
M x N grayscale image.
sigma : double
standard deviation of gaussian ... | DigitalSlideArchive/HistomicsTK | histomicstk/utils/hessian.py | Python | apache-2.0 | 1,287 |
import os
import sys
import requests
from paste import deploy
from paste import httpserver
from bareon_api.common.config import CONF
from bareon_api.data_sync import sync_all_nodes
current_dir = os.path.dirname(__file__)
def data_sync():
resp = requests.post('http://{host}:{port}/v1/actions/sync_all'.format(
... | Mirantis/bareon-api | bareon_api/cli.py | Python | apache-2.0 | 904 |
from setting import MATCH_TYPE_JC,MATCH_TYPE_M14
#url_m14_fmt = "http://www.okooo.com/livecenter/zucai/?mf=ToTo&date=15077"
#url_jc_fmt = "http://www.okooo.com/livecenter/jingcai/?date=2015-05-26"
url_jc_fmt = "http://www.okooo.com/livecenter/jingcai/?date={0}"
url_m14_fmt = "http://www.okooo.com/livecenter/zucai/?mf=... | justasabc/kubernetes-ubuntu | smartfootball/okooo/okooo_setting.py | Python | apache-2.0 | 796 |
import numpy as np
import matplotlib.pyplot as plt
import tensorflow as tf
import xlrd
DATA_FILE = 'data/fire_theft.xls'
# Step 1: read in data from the .xls file
book = xlrd.open_workbook(DATA_FILE, encoding_override="utf-8")
sheet = book.sheet_by_index(0)
data = np.asarray([sheet.row_values(i) for i in range(1, sh... | JasonHanG/tensor-gallery | basic-operation/linear_regression.py | Python | apache-2.0 | 1,901 |
import unittest
from singer.schema import Schema
from singer.catalog import Catalog, CatalogEntry, write_catalog
class TestWriteCatalog(unittest.TestCase):
def test_write_empty_catalog(self):
catalog = Catalog([])
write_catalog(catalog)
def test_write_catalog_with_streams(self):
catal... | singer-io/singer-python | tests/test_catalog.py | Python | apache-2.0 | 5,436 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
from factory.supports import format
from factory.supports.parser import parser
from weibocommon import weibocommon
from rootcfg import HIS_ORIGIN_BLOG_PREFIX
from rootcfg import BLOG_NUM_PER_BLOCK
from rootcfg import MAX_PAGE_NUM_PER_USER
import time
import simp... | jwang-share/said | black3/factory/workers/weibo/weibominiblogs.py | Python | apache-2.0 | 4,022 |
"""Tests for the cloud component."""
from unittest.mock import patch
from homeassistant.setup import async_setup_component
from homeassistant.components import cloud
from homeassistant.components.cloud import const
from tests.common import mock_coro
async def mock_cloud(hass, config=None):
"""Mock cloud."""
... | jabesq/home-assistant | tests/components/cloud/__init__.py | Python | apache-2.0 | 935 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "bpzaroundme.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| codefortulsa/BPZAround.me | manage.py | Python | apache-2.0 | 254 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Tests for the Outlook Windows Registry plugins."""
import unittest
# pylint: disable=unused-import
from plaso.formatters import winreg as winreg_formatter
from plaso.parsers.winreg_plugins import outlook
from tests.parsers.winreg_plugins import test_lib
from tests.winregi... | jorik041/plaso | tests/parsers/winreg_plugins/outlook.py | Python | apache-2.0 | 3,175 |
#
# 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... | apache/incubator-airflow | tests/providers/google/cloud/operators/test_datacatalog_system.py | Python | apache-2.0 | 1,370 |
from pylab import *
def stem_user(user, channel_list, start_index, stop_index):
data = user.windowData
for channel in channel_list:
stem_pandas_column(data, channel, start_index, stop_index)
def stem_pandas_column(dataframe, columname, start_index, stop_index):
column = dataframe[columname]
... | joergsimon/gesture-analysis | visualise/Stem.py | Python | apache-2.0 | 664 |
# 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... | derekjchow/models | research/object_detection/utils/config_util.py | Python | apache-2.0 | 36,470 |
# 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... | openstack/senlin | senlin/profiles/container/docker.py | Python | apache-2.0 | 16,468 |
import pygame
class Ship():
def __init__(self, ai_settings, screen):
"""It initializes the ship and sets its initial position."""
self.screen = screen
self.ai_settings = ai_settings
# Download image of the ship and receiving a rectangle.
self.image = pygame.image.load('im... | eugene-petrash/alien_invasion | ship.py | Python | apache-2.0 | 1,638 |
# Copyright 2018 New Vector 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 in writin... | matrix-org/synapse | synapse/replication/http/__init__.py | Python | apache-2.0 | 1,864 |
"""
Vishnu session.
"""
from __future__ import absolute_import
from http.cookies import Morsel
from http.cookies import SimpleCookie
from datetime import datetime, timedelta
import hashlib
import hmac
import logging
import sys
import uuid
from vishnu.cipher import AESCipher
from vishnu.backend.config import Base as... | anomaly/vishnu | vishnu/session.py | Python | apache-2.0 | 10,835 |
# Copyright 2014 Roberto Brian Sarrionandia
#
# 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 t... | sarrionandia/tournatrack | dereg.py | Python | apache-2.0 | 2,082 |
#!/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... | cloudera/hue | desktop/core/src/desktop/api_public_urls.py | Python | apache-2.0 | 7,696 |
from GPIOLibrary import GPIOProcessor
import time
GP = GPIOProcessor()
# GPIO Assignments
#Din = 27
#A1 = 34 Green
#A2 = 33 White
#A3 = 24 Black
#A4 = 26 Yellow
#PIR = 29
#Ind = 30
Din = GP.getPin27()
Din.input()
A1 = GP.getPin34()
A1.out()
A2 = GP.getPin33()
A2.out()
A3 = GP.getPin24()
A... | IOT-410c/IOT-DB410c-Course-3 | Modules/Module_6_Infrared_Sensors/Lesson_3_IR_Remote/IRRemote.py | Python | apache-2.0 | 3,447 |
#!/usr/bin/env python
# pylint: disable=missing-docstring
# flake8: noqa: T001
# ___ ___ _ _ ___ ___ _ _____ ___ ___
# / __| __| \| | __| _ \ /_\_ _| __| \
# | (_ | _|| .` | _|| / / _ \| | | _|| |) |
# \___|___|_|\_|___|_|_\/_/_\_\_|_|___|___/_ _____
# | \ / _ \ | \| |/ _ \_ _| | __| \_ ... | akubicharm/openshift-ansible | roles/lib_openshift/library/oc_env.py | Python | apache-2.0 | 65,053 |
# -*- coding: utf-8 -*-
'''
Manage X509 certificates
.. versionadded:: 2015.8.0
'''
# Import python libs
from __future__ import absolute_import
import os
import logging
import hashlib
import glob
import random
import ctypes
import tempfile
import yaml
import re
import datetime
import ast
# Import salt libs
import s... | stephane-martin/salt-debian-packaging | salt-2016.3.2/salt/modules/x509.py | Python | apache-2.0 | 46,018 |
#!/usr/bin/python
import os
import json
from pprint import pprint
from os import environ as env
import glanceclient.exc
from collections import Counter
import novaclient.v1_1.client as nvclient
import glanceclient.v2.client as glclient
import keystoneclient.v2_0.client as ksclient
def get_nova_credentials():
... | kionetworks/openstack-api-scripts | tenant_glance_images.py | Python | apache-2.0 | 1,996 |
AUTHENTICATION_REQUIRED_401 = 401
NOT_AUTHORIZED_403 = 403
INVALID_REQUEST_400 = 400
REQUEST_ENTITY_TOO_LARGE_413 = 413
NOT_FOUND_404 = 404
INTERNAL_SERVER_ERROR_500 = 500
RESOURCE_CONFLICT_409 = 409
PAYMENT_REQUIRED_402 = 402
HEADER_PRECONDITIONS_FAILED = 412
LOCKED_423 = 423
TOO_MANY_REQUESTS_429 = 429
class JSONAP... | Patreon/cartographer | cartographer/exceptions/request_exceptions.py | Python | apache-2.0 | 2,455 |