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 |
|---|---|---|---|---|---|
# coding=utf-8
# Copyright 2022 The Uncertainty Baselines 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 ap... | google/uncertainty-baselines | baselines/mnist/utils.py | Python | apache-2.0 | 5,866 |
%matplotlib inline
import torch
import torch.nn as nn
import gym
import random
import numpy as np
import torchvision.transforms as transforms
import matplotlib.pyplot as plt
from torch.autograd import Variable
from collections import deque, namedtuple
env = gym.envs.make("CartPole-v0")
class Net(nn.Module):
def ... | trhongbinwang/data_science_journey | deep_learning/pytorch/tutorials/11 - Deep Q Network/dqn13.py | Python | apache-2.0 | 4,035 |
import logging
from django.utils.translation import ugettext_lazy as _
from horizon import tables
from openstack_dashboard.dashboards.support.support import tables as project_tables
from horizon import views
class IndexView(tables.DataTableView):
# A very simple class-based view...
table_class = project_table... | MKTCloud/MKTCloud | openstack_dashboard/dashboards/support/support/views.py | Python | apache-2.0 | 497 |
# coding=utf-8
# Copyright 2020 The TF-Agents 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 la... | tensorflow/agents | tf_agents/bandits/policies/loss_utils.py | Python | apache-2.0 | 3,764 |
# coding: utf-8
#
# Copyright 2018 The Oppia Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | prasanna08/oppia | core/domain/topic_jobs_one_off_test.py | Python | apache-2.0 | 19,929 |
#!/usr/bin/python
#coding:utf-8
from hashlib import sha256
import ConfigParser
import os
import hmac
import json
import base64
import requests
import urlparse
import datetime
import json
import sys
reload(sys)
sys.setdefaultencoding( "utf-8" )
def getConfig():
"""
将通用的一些数据读取放在一个函数里。不再每个函数里去写一遍了。
"""
g... | lichengshuang/createvhost | python/cdn/wangsu/bin/wangsu.py | Python | apache-2.0 | 2,674 |
HOSTINFO = {
'location': '',
'hostname': '',
'hostid': '',
'ip': '',
'dns': '',
'groups': [],
'templates': {
'os': '',
'services': ''
},
'isagent': 'yes',
'proxy': '',
'snmpstring': '',
'services': '',
'web_check_name': '',
'web_application': 'Web ... | deshike22/zabbixonboarding | infotemplate.py | Python | apache-2.0 | 1,013 |
# -*- coding: utf-8 -*-
import tcod
from ..logger import get_logger
logger = get_logger(__name__)
__all__ = ['Panel']
class Panel(object):
"""Creates a panel on the screen.
Args:
width(int): Width of panel [default: 80]
height(int): height of panel [default: 50]
name(str): Title ... | brianbruggeman/lose-7drl | lose/utils/ui/panels.py | Python | apache-2.0 | 1,076 |
"""
@copyright Copyright (c) 2011 - 2016, 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 agr... | taf3/testcases | general/test_ixnetwork.py | Python | apache-2.0 | 10,920 |
# Copyright 2012 Mehmet Ali ANIL
#
# 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 applicabl... | mehmetalianil/Kreveik | kreveik/genetic/__init__.py | Python | apache-2.0 | 3,689 |
import pytest
from boxsdk.exception import BoxOAuthException
def test_expired_access_token_is_refreshed(box_oauth, box_client, mock_box):
# pylint:disable=protected-access
mock_box.oauth.expire_token(box_oauth._access_token)
# pylint:enable=protected-access
box_client.folder('0').get()
assert len(... | box/box-python-sdk | test/functional/test_token_refresh.py | Python | apache-2.0 | 767 |
""".. Ignore pydocstyle D400.
=====
State
=====
Constants used by the dispatcher.
.. autofunction:: resolwe.flow.managers.state.update_constants
"""
# This module should not import anything local, or there will be circular
# dependencies, since the constants are needed in various sub-modules inside
# resolwe.flow.ma... | genialis/resolwe | resolwe/flow/managers/state.py | Python | apache-2.0 | 1,297 |
#
# ovirt-engine-setup -- ovirt engine setup
# Copyright (C) 2013-2015 Red Hat, 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
#
# Unl... | OpenUniversity/ovirt-engine | packaging/setup/plugins/ovirt-engine-setup/ovirt-engine/pki/ssh.py | Python | apache-2.0 | 4,675 |
# Copyright (c) 2019 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... | PaddlePaddle/Paddle | python/paddle/fluid/contrib/mixed_precision/decorator.py | Python | apache-2.0 | 28,628 |
#
# 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/appfw/appfwarchive.py | Python | apache-2.0 | 6,303 |
# -*- 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 | tests/unit/gapic/compute_v1/test_global_public_delegated_prefixes.py | Python | apache-2.0 | 96,661 |
# python3
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | google-research/data-driven-advection | datadrivenpdes/core/readers_test.py | Python | apache-2.0 | 6,924 |
import sys
from beaker.container import NamespaceManager, Container
from beaker.exceptions import InvalidCacheBackendError, MissingCacheParameter
from beaker.synchronization import _threading, Synchronizer
from beaker.util import verify_directory, SyncDict
try:
import cmemcache as memcache
except ImportError:
... | appcelerator/entourage | components/services/appengine/stub/beaker/ext/memcached.py | Python | apache-2.0 | 4,037 |
# 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... | kidchang/compassv2-api | compass/actions/health_check/check_tftp.py | Python | apache-2.0 | 3,363 |
#
# 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... | mistercrunch/airflow | airflow/operators/bash.py | Python | apache-2.0 | 8,272 |
# Copyright 2011 OpenStack LLC.
# Copyright 2011 Nebula, 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/LICENS... | ioram7/keystone-federado-pgid2013 | build/python-keystoneclient/keystoneclient/v3/users.py | Python | apache-2.0 | 3,684 |
#因为首尾相连, 考虑第一位抢或不抢 两种情况分开
class Solution:
def rob(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
if not nums:
return 0
if len(nums) == 1:
return nums[0]
if len(nums) == 2:
return max(nums)
l = []
... | MingfeiPan/leetcode | dp/213.py | Python | apache-2.0 | 1,077 |
"""
Utility functions for NetLogger modules and command-line programs
"""
__rcsid__ = "$Id: util.py 27069 2011-02-08 20:09:10Z dang $"
__author__ = "Dan Gunter (dkgunter (at) lbl.gov)"
import glob
import os
import queue
import re
import signal
import sys
import time
import traceback
from asyncore import compact_traceba... | pegasus-isi/pegasus | packages/pegasus-python/src/Pegasus/netlogger/util.py | Python | apache-2.0 | 24,035 |
# 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 agreed to in writing... | google-research/federated | compressed_communication/aggregators/comparison_methods/one_bit_sgd_test.py | Python | apache-2.0 | 8,373 |
#
# Copyright (C) 2017 Red Hat, 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 writin... | redhat-cip/dci-control-server | dci/alembic/versions/19dd8a44afdf_add_fingerprint_table.py | Python | apache-2.0 | 2,476 |
import os
import sys
import time
import shlex
import shutil
import inspect
import aiohttp
import discord
import asyncio
import traceback
from discord import utils
from discord.object import Object
from discord.enums import ChannelType
from discord.voice_client import VoiceClient
from discord.ext.commands.bot import _g... | T3CHNOLOG1C/Plaidohlect | MusicBot/musicbot/bot.py | Python | apache-2.0 | 78,817 |
# -*- 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-dlp | samples/generated_samples/dlp_v2_generated_dlp_service_list_stored_info_types_sync.py | Python | apache-2.0 | 1,491 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# 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 ... | rmyers/trove-dashboard | setup.py | Python | apache-2.0 | 673 |
# Copyright 2014 - Mirantis, Inc.
# Copyright 2015 - StackStorm, 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
#
# Unl... | StackStorm/python-mistralclient | mistralclient/tests/unit/v2/test_cli_workbooks.py | Python | apache-2.0 | 3,625 |
import asyncio
import io
import json
import zlib
from unittest import mock
import pytest
import aiohttp
from aiohttp import payload
from aiohttp.hdrs import (
CONTENT_DISPOSITION,
CONTENT_ENCODING,
CONTENT_TRANSFER_ENCODING,
CONTENT_TYPE,
)
from aiohttp.helpers import parse_mimetype
from aiohttp.multi... | arthurdarcet/aiohttp | tests/test_multipart.py | Python | apache-2.0 | 40,036 |
import ply.lex as lex
import re
tokens = (
'LANGLE', # <
'LANGLESLASH', # </
'RANGLE', # >
'EQUAL', # =
'STRING', # "hello"
'WORD') # Welcome!
state = (
("htmlcomment", "exclusive"),
)
t_ignore = ' '
def t_htmlcomment(token):
r'<!--'
token.lexer.begin('htmlcomment')
def t_htmlcommen... | melvin0008/pythoncodestrial | first.py | Python | apache-2.0 | 1,107 |
'''
Created on 03.02.2016
@author: fabian
'''
import os
import collections
import csv
class ResultParser(object):
'''
classdocs
'''
def __init__(self, resultFolder):
'''
Constructor
'''
self.resultFolder = resultFolder
def getAllCommitsWithJacocoErro... | ftrautsch/testEvolution | parser/resultparser.py | Python | apache-2.0 | 2,937 |
class PlatformHelper:
def __init__(self, app):
self.app = app
def fill_contact_form(self, contact_model):
wd = self.app.wd
self.app.open_home_page()
wd.find_element_by_link_text("add new").click()
self.fillin_contact_form(contact_model)
def fillin_contact_form(sel... | verdyanna/new_troika | fixture/platform_helper.py | Python | apache-2.0 | 2,490 |
"""
This file holds utility functions that have no dependencies on other console code.
Avoids import loops
"""
import webcolors
def wc(clr, factor=0.0, layercolor=(255, 255, 255)):
lc = webcolors.name_to_rgb(layercolor.lower()) if isinstance(layercolor, str) else layercolor
if isinstance(clr, str):
try:
v = we... | kevinkahn/softconsole | utils/utilfuncs.py | Python | apache-2.0 | 3,291 |
"""
Copyright 2014 Rackspace
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
dist... | jmvrbanac/barbican | functionaltests/api/v1/behaviors/base_behaviors.py | Python | apache-2.0 | 1,531 |
from .entity import Entity
class Edge(Entity):
"""Basic class for all edge objects"""
meta = {
"ontology": "gch",
"typename": "Edge",
"hierarchy": "gch/Entity.Edge"
}
def __init__(self, attributes={}, tags=set([])):
super(Edge, self).__init__(attributes, tags)
| vurmux/gorynych | gorynych/core/edge.py | Python | apache-2.0 | 312 |
# 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/clusterfuzz | src/clusterfuzz/_internal/tests/appengine/libs/crash_access_test.py | Python | apache-2.0 | 4,900 |
#! /usr/bin/python
# -*- coding: UTF-8 -*-
# Copyright 2018-2019 Luiko Czub, TestLink-API-Python-client developers
#
# 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.ap... | lczub/TestLink-API-Python-client | test/conftest.py | Python | apache-2.0 | 2,865 |
import numpy as np
import theano as theano
import theano.tensor as T
from utils import *
import operator
import os
import sys
class RNNEMBEDTheano:
def __init__(self, word_dim, hidden_dim=100, embed_dim=100, bptt_truncate=4):
# Assign instance variables
self.word_dim = word_dim
self.hi... | asapypy/theano_rnn_embed | rnn_theano_embed.py | Python | apache-2.0 | 6,256 |
# -*- encoding: utf-8 -*-
# Copyright (c) 2015 b<>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/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | b-com/watcher-metering-drivers | watcher_metering_drivers/wrappers/virt/instance/base.py | Python | apache-2.0 | 8,768 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'UpFile'
db.create_table(u'catalog_upfile', (
... | Makeystreet/makeystreet | woot/apps/catalog/migrations/0137_auto__add_upfile.py | Python | apache-2.0 | 70,587 |
# Copyright 2017 Xintong Han. 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 ... | xthan/polyvore | polyvore/fashion_compatibility.py | Python | apache-2.0 | 6,651 |
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from unittest import skipIf
from pants_test.backend.jvm.tasks.jvm_compile.base_compile_integration_test import BaseCompileIT
from pants_test.backend.jvm.tasks.missing_jvm_check import is_... | tdyas/pants | tests/python/pants_test/backend/jvm/tasks/jvm_compile/java/test_javac_plugin_integration.py | Python | apache-2.0 | 2,505 |
"""Runs fast tests."""
import unittest
from tests.kernel_tests import SwiftKernelTests, OwnKernelTests
from tests.simple_notebook_tests import *
if __name__ == '__main__':
unittest.main()
| google/swift-jupyter | test/fast_test.py | Python | apache-2.0 | 196 |
# pylint: disable=too-many-arguments, too-many-locals, invalid-name, fixme, too-many-lines
"""Scikit-Learn Wrapper interface for XGBoost."""
import copy
import warnings
import json
import os
from typing import Union, Optional, List, Dict, Callable, Tuple, Any, TypeVar, Type, cast
from typing import Sequence
import nump... | dmlc/xgboost | python-package/xgboost/sklearn.py | Python | apache-2.0 | 71,896 |
# Copyright (c) 2013 OpenStack Foundation
#
# 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 ... | matthewoliver/swift | test/unit/common/middleware/s3api/helpers.py | Python | apache-2.0 | 6,907 |
# coding=utf-8
# Copyright 2018 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import absolute_import, division, print_function, unicode_literals
import os
import signal
import time
from contextlib import contextmanager
from pants.bas... | twitter/pants | tests/python/pants_test/base/test_exception_sink_integration.py | Python | apache-2.0 | 9,409 |
# Copyright 2020 Google LLC
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | quantumlib/OpenFermion-FQE | src/fqe/fqe_data.py | Python | apache-2.0 | 130,770 |
##
# Copyright (c) 2015 Apple 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... | red-hood/calendarserver | txdav/common/datastore/test/test_trash.py | Python | apache-2.0 | 75,866 |
# 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 License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | django-leonardo/horizon | horizon/workflows/views.py | Python | apache-2.0 | 9,305 |
#!/usr/bin/env python
from utils import *
########################################################
# Test: Node Tuning Operator: custom tuning is working #
########################################################
# Changes: #
# skordas: ... | mffiedler/svt | openshift_tooling/node_tuning_operator/nto_test_custom_tuning.py | Python | apache-2.0 | 5,119 |
# 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-2.0
#
# Unless re... | lowks/fontbakery-cli | bakery_lint/tests/downstream/test_check_files_menu_agreements.py | Python | apache-2.0 | 1,738 |
# coding=utf-8
# Copyright 2019 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 applic... | deepmind/deep-verify | deep_verify/src/formulations/semidefinite/__init__.py | Python | apache-2.0 | 1,083 |
import operator
import time
# Only the vertex (and its hamming distance is given)
# Need to find all vertices which are within a hamming distance of 2
# That means for each vertex, generate a list of 300 other vertices (24 bits + 23 + 22 + ... + 1)
# which are with hamming distance of 2 (generate vertices with 2 bit... | ajayhk/algorithms | greedy/k-clustering-hamming.py | Python | apache-2.0 | 6,457 |
# python3
# 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 re... | deepmind/acme | acme/tf/losses/r2d2.py | Python | apache-2.0 | 7,147 |
# Copyright 2014-2020 Scalyr 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 writin... | scalyr/scalyr-agent-2 | tests/image_builder/distributions/centos7/__init__.py | Python | apache-2.0 | 1,729 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for Requests."""
from __future__ import division
import json
import os
import pickle
import unittest
import requests
import pytest
from requests.adapters import HTTPAdapter
from requests.auth import HTTPDigestAuth
from requests.compat import (
Morsel, cookie... | iilab/ltfhc-next | system/python-requests/test_requests.py | Python | apache-2.0 | 40,903 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 OpenStack LLC.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/... | citrix-openstack-build/cinder | cinder/tests/test_solidfire.py | Python | apache-2.0 | 9,057 |
#!/usr/bin/env python
# crc16.py by Bryan G. Olson, 2005
# This module is free software and may be used and
# distributed under the same terms as Python itself.
"""
CRC-16 in Python, as standard as possible. This is
the 'reflected' version, which is usually what people
want. See Ross N. Williams' /A Pain... | bapril/cfa_635 | cfa635/crc16.py | Python | apache-2.0 | 4,254 |
# 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... | mistercrunch/panoramix | tests/integration_tests/dashboards/security/security_dataset_tests.py | Python | apache-2.0 | 8,417 |
#==============================================================================
# Copyright 2019-2020 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... | tensorflow/ngraph-bridge | tools/log_parser.py | Python | apache-2.0 | 6,884 |
"""
Copyright 2015 Stefano Terna
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... | iottly/iottly-core | iottly_core/brokerapi.py | Python | apache-2.0 | 2,191 |
from django.contrib import admin
from leagueofladders.apps.myleague.models import League, Membership
class MembershipInline(admin.TabularInline):
model = Membership
extra = 1
@admin.register(League)
class LeagueAdmin(admin.ModelAdmin):
fields = ('name', 'owner', 'is_public')
inlines = [MembershipIn... | dylanseago/LeagueOfLadders | leagueofladders/apps/myleague/admin.py | Python | apache-2.0 | 489 |
# Copyright 2012 Spanish National Research Council
#
# 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... | enolfc/keystone-voms | tests/test_middleware_voms_authn.py | Python | apache-2.0 | 23,887 |
#
# Copyright 2016 University of Oxford
#
# 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... | jeromekelleher/htsget | htsget/protocol.py | Python | apache-2.0 | 5,386 |
# Copyright 2015, Ansible, Inc.
# Alan Rominger <arominger@ansible.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/licenses/LICENSE-2.0
#
# Unless required ... | jangsutsr/tower-cli | tests/test_resources_job_template.py | Python | apache-2.0 | 8,499 |
#!/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");... | radicalbit/ambari | ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/hbase_master.py | Python | apache-2.0 | 1,892 |
# coding: utf-8
#
# Copyright 2014 The Oppia Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | oppia/oppia | core/domain/event_services.py | Python | apache-2.0 | 12,316 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 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.... | beagles/neutron_hacking | neutron/agent/rpc.py | Python | apache-2.0 | 3,789 |
import collections
ConfigParams = collections.namedtuple(
'ConfigParams',
[
'format',
'hint',
'disposition',
'extension'
]
)
| skippyprime/configs | tests/utils.py | Python | apache-2.0 | 171 |
# Copyright (c) 2014 eBay Software Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unl... | Tesora-Release/tesora-python-troveclient | troveclient/v1/clusters.py | Python | apache-2.0 | 3,850 |
def flatten(dictionary):
stack = [((), dictionary)]
result = {}
while stack:
path, current = stack.pop()
for k, v in current.items():
if isinstance(v, dict) and bool(v):
stack.append((path + (k,), v))
else:
whatadd = ""... | nesterione/problem-solving-and-algorithms | problems/Checkio/TheFlatDictionary.py | Python | apache-2.0 | 1,262 |
# coding: utf-8
"""
Copyright 2016 SmartBear Software
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... | wavefront-mike/python-client | wavefront_client/models/dashboard_metadata.py | Python | apache-2.0 | 12,375 |
from pmg import app
from pmg.tasks import StartScheduler
from pmg.models.soundcloud_track import SoundcloudTrack
from flask_script import Server, Manager
from flask_migrate import MigrateCommand
app.debug = True
manager = Manager(app)
manager.add_command("runserver", Server(port=5000, threaded=True, host="0.0.0.0"))
... | Code4SA/pmg-cms-2 | app.py | Python | apache-2.0 | 533 |
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | chronicle/api-samples-python | service_management/update_gcp_settings_test.py | Python | apache-2.0 | 2,741 |
# TODO: Handle timestamp generation for modinput and set sample.timestamp properly for timestamp replacement
import datetime
import json
import os
import pprint
import random
import re
import time
import uuid
import six.moves.urllib.error
import six.moves.urllib.parse
import six.moves.urllib.request
from splunk_event... | splunk/eventgen | splunk_eventgen/lib/eventgentoken.py | Python | apache-2.0 | 23,368 |
# Copyright (c) 2013 Rackspace, 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 wr... | jfwood/barbican-1 | barbican/queue/simple/resources.py | Python | apache-2.0 | 1,675 |
# -*- coding: utf-8 -*-
#
# 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
#... | Fokko/incubator-airflow | airflow/hooks/mysql_hook.py | Python | apache-2.0 | 8,067 |
# 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... | jamielennox/python-keystoneclient | keystoneclient/tests/v2_0/test_client.py | Python | apache-2.0 | 6,828 |
# -*- coding:utf-8 -*-
# Author: hankcs
# Date: 2020-08-05 01:49
import logging
from copy import copy
from typing import Dict, Any, Union, Iterable, List
import torch
from torch.utils.data import DataLoader
from hanlp.common.dataset import SamplerBuilder, PadSequenceDataLoader
from hanlp.common.transform import Vocab... | hankcs/HanLP | hanlp/components/mtl/tasks/ner/biaffine_ner.py | Python | apache-2.0 | 5,752 |
# 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... | nathanbjenx/cairis | cairis/gui/TemplateAssetsDialog.py | Python | apache-2.0 | 3,069 |
# -*- coding: utf-8 -*-
'''
CloudStack Cloud Module
=======================
The CloudStack cloud module is used to control access to a CloudStack based
Public Cloud.
:depends: libcloud >= 0.15
Use of this module requires the ``apikey``, ``secretkey``, ``host`` and
``path`` parameters.
.. code-block:: yaml
my-c... | smallyear/linuxLearn | salt/salt/cloud/clouds/cloudstack.py | Python | apache-2.0 | 16,091 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
%prog obo_file
Parses obo_file and plot GO lineage
"""
import sys
import logging
from collections import deque
from functools import partial
from typing import IO, Optional
from goatools.obo_parser import GODag
from jcvi.apps.base import OptionParser
GO_URL = "http... | tanghaibao/jcvi | jcvi/formats/obo.py | Python | bsd-2-clause | 2,842 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='ClassObj',
fields=[
('id', models.AutoField(ver... | ricardogsilva/django-mapserver | djangomapserver/migrations/0001_initial.py | Python | bsd-2-clause | 8,539 |
# Copyright (c) 2020 Sippy Software, Inc. All rights reserved.
#
# 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. Redistributions of source code must retain the above copyright notice, this
... | sippy/b2bua | sippy/Security/SipNonce.py | Python | bsd-2-clause | 5,055 |
from uvscada.ngc import *
import math
'''
Need to account for endmill radius to make the die actualy fit
w=0.805, h=0.789
em=0.0413
Actual used w/h: cos(45) * 0.0413 = 0.02920351
Total w/h: 0.0413
Wasted w/h: 0.0413 - 0.0292 = 0.0121
each corner
Increase by
'''
cnc = init(
#em=0.0413,
em=0.0625,... | JohnDMcMaster/uvscada | ngc/lapsten/sten_virtex.py | Python | bsd-2-clause | 1,859 |
# Copyright 2013-2018 Rumma & Ko Ltd
# License: BSD (see file COPYING for details)
"""
Adds a multipurpose concept of "Note". See :doc:`/specs/notes`.
.. autosummary::
:toctree:
fixtures.demo
fixtures.std
"""
from lino import ad
from django.utils.translation import ugettext_lazy as _
class Plugin(ad.Pl... | khchine5/xl | lino_xl/lib/notes/__init__.py | Python | bsd-2-clause | 1,309 |
from django.core.management.base import BaseCommand
from ... import importer
class Command(BaseCommand):
def handle(self, flow_id, **options):
importer.import_responses(flow_id)
| myvoice-nigeria/myvoice | myvoice/survey/management/commands/import_responses.py | Python | bsd-2-clause | 194 |
class MyReport(Report):
renderer = GoogleChartsRenderer
bar_chart = charts.BarChart(title="Pony Populations", width="500")
multiseries_bar_chart = charts.BarChart(title="Pony Populations by Country", width="500")
def get_data_for_bar_chart(self):
data = ChartData()
data.add_column("Po... | evanbrumley/django-report-tools | docs/source/charts/bar_chart_example.py | Python | bsd-2-clause | 900 |
import bee
from bee.segments import *
class toggle(bee.worker):
inp = antenna("push", "trigger")
on = variable("bool")
parameter(on, False)
state = output("pull", "bool")
connect(on, state)
true = output("push", "trigger")
trig_true = triggerfunc(true)
false = output("push", "trigger"... | agoose77/hivesystem | dragonfly/logic/toggle.py | Python | bsd-2-clause | 568 |
import numpy as np
left = np.memmap('../left.bin', dtype=np.float32, shape=(1, 70, 370, 1226))
right = np.memmap('../right.bin', dtype=np.float32, shape=(1, 70, 370, 1226))
disp = np.memmap('../disp.bin', dtype=np.float32, shape=(1, 1, 370, 1226))
| jzbontar/mc-cnn | samples/load_bin.py | Python | bsd-2-clause | 249 |
# -*- coding: UTF-8 -*-
# Copyright 2019 Rumma & Ko Ltd
# License: GNU Affero General Public License v3 (see file COPYING for details)
from lino.api import dd, _
from lino.utils import join_words
from lino_xl.lib.groups.models import *
from lino.modlib.users.mixins import UserAuthored
class Group(Group, UserAuthore... | lino-framework/noi | lino_noi/lib/groups/models.py | Python | bsd-2-clause | 749 |
# comment = "Torus example : eff. resolution = 2048 x 2048"
import sys
import os
import subprocess
import random
np = 2
exec = "swirl"
arg_list = ["mpirun","-n",str(np),exec,"--inifile=timing.ini"]
jobid = random.randint(1000,9999)
outfile = "{:s}_0000{:d}.o{:d}".format(exec,np,jobid)
f = open(outfile,'w')
po = subpro... | ForestClaw/forestclaw | applications/clawpack/advection/2d/swirl/p_00002.py | Python | bsd-2-clause | 454 |
# -*- coding: utf-8 -*-
#
# Markov Logic Networks
#
# (C) 2006-2011 by Dominik Jain (jain@cs.tum.edu)
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# witho... | danielnyga/pracmln | python2/pracmln/mln/inference/gibbs.py | Python | bsd-2-clause | 6,737 |
#!/usr/bin/env python
"""Backup ZFS filesystems to a remote host"""
import logging
import sys
from optparse import OptionParser
from zfs import *
from zfs.backup import MbufferedSSHBackup
class App(object):
"""The ZFS backup application
Usage:
myapp = App(options)
app.run()
"""
def ... | UCSD-ANF/pyzfsautosnap | zfs/zfsbackup.py | Python | bsd-2-clause | 2,986 |
#!/usr/bin/env python3
inputFilename='../3-db.out/db.sql'
outputDirectory='../4-xls.out'
import os
if not os.path.exists(outputDirectory):
os.makedirs(outputDirectory)
from decimal import Decimal
import collections
import copy
import sqlite3
import xlwt3 as xlwt
import xlsxwriter
class LevelTable:
def __init__(se... | AntonKhorev/spb-budget-db | 4-xls/main.py | Python | bsd-2-clause | 21,223 |
import functools
from datetime import datetime
from django.core.cache import cache
from restlib2.params import Parametizer
from restlib2.resources import Resource
from avocado.models import DataContext, DataView, DataQuery
from serrano.conf import settings
from django.contrib.auth import authenticate, login
from ..toke... | rv816/serrano_night | serrano/resources/base.py | Python | bsd-2-clause | 11,880 |
import os
from pySDC.helpers.stats_helper import filter_stats, sort_stats
from pySDC.helpers.visualization_tools import show_residual_across_simulation
from pySDC.implementations.collocation_classes.gauss_radau_right import CollGaussRadau_Right
from pySDC.implementations.controller_classes.controller_nonMPI import con... | Parallel-in-Time/pySDC | pySDC/tutorial/step_8/B_multistep_SDC.py | Python | bsd-2-clause | 6,586 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding unique constraint on 'EVS', fields ['variant']
db.create_unique('evs', ['variant_id'])
# A... | chop-dbhi/varify-data-warehouse | vdw/variants/migrations/0013_auto__add_unique_evs_variant__add_unique_thousandg_variant.py | Python | bsd-2-clause | 18,006 |
"""Thorlabs DCx series cameras
Drivers for Windows and Linux can be downloaded from Thorlabs__.
__ http://www.thorlabs.de/software_pages/viewsoftwarepage.cfm?code=DCx
Python implementation of ueye interface: https://github.com/bernardokyotoku/pydcu
"""
from __future__ import print_function
import sys
import ctypes... | mivade/qCamera | qcamera/thorlabs_dcx.py | Python | bsd-2-clause | 8,844 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.