code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
import uni... | UnrememberMe/pants | tests/python/pants_test/engine/test_mapper.py | Python | apache-2.0 | 8,877 |
# -*- 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-analytics-admin | google/analytics/admin_v1alpha/__init__.py | Python | apache-2.0 | 12,493 |
# -*- coding: utf-8 -*-
# File: DQNModel.py
import abc
import tensorflow as tf
from tensorpack import ModelDesc
from tensorpack.utils import logger
from tensorpack.tfutils import (
varreplace, summary, get_current_tower_context, optimizer, gradproc)
from tensorpack.tfutils.scope_utils import auto_reuse_variable_s... | eyaler/tensorpack | examples/DeepQNetwork/DQNModel.py | Python | apache-2.0 | 4,785 |
##
# Copyright (c) 2011-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 applicab... | red-hood/calendarserver | contrib/tools/pg_stats_analysis.py | Python | apache-2.0 | 7,495 |
from typing import Any, List, Tuple
import logging
import time
import select
from tornado import ioloop
from django.conf import settings
from tornado.ioloop import IOLoop, PollIOLoop
# There isn't a good way to get at what the underlying poll implementation
# will be without actually constructing an IOLoop, so we jus... | amanharitsh123/zulip | zerver/tornado/ioloop_logging.py | Python | apache-2.0 | 2,828 |
import ctypes
dll = ctypes.CDLL('libstator.so')
| tailhook/stator | stator/lib.py | Python | apache-2.0 | 49 |
# -*- coding: utf-8 -*-
from random import random
from math import log
geo=lambda p: int(log(rand())/log(1-p))+1
print "Script que genera m observaciones de una variable ~geo(p)"
m=int(raw_input("¿Cuantas variables aleatorias se van a generar (m)? "))
n=int(raw_input("¿Cual es el parametro de la distribución geometri... | Darkade/udlap | 9no/simulacion/2010 08 25 Practica1 geometrica.py | Python | apache-2.0 | 688 |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | alivecor/tensorflow | tensorflow/python/framework/ops_test.py | Python | apache-2.0 | 73,053 |
from tapiriik.settings import PP_WEBSCR, PP_RECEIVER_ID, PAYMENT_CURRENCY
from tapiriik.auth import User
from tapiriik.payments import Payments, ExternalPaymentProvider
from tapiriik.web.views.ab import ab_experiment_complete, ab_register_experiment
from django.views.decorators.csrf import csrf_exempt
from django.views... | dmschreiber/tapiriik | tapiriik/web/views/payments/__init__.py | Python | apache-2.0 | 5,411 |
from setuptools import find_packages, setup
setup(
name='block',
version='0.0.5',
description="Improved block matrix creation for numpy and PyTorch.",
author='Brandon Amos',
author_email='bamos@cs.cmu.edu',
platforms=['any'],
license="Apache 2.0",
url='https://github.com/bamos/block',
... | bamos/block | setup.py | Python | apache-2.0 | 402 |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import absolute_import, division, print_function, unicode_literals
import contextlib
import multiprocessing
import os
import re
from collections import name... | twitter/pants | src/python/pants/backend/jvm/tasks/jvmdoc_gen.py | Python | apache-2.0 | 9,096 |
#
# 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
# ... | srznew/heat | heat/engine/resources/openstack/cinder/volume.py | Python | apache-2.0 | 27,409 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-aiplatform | samples/generated_samples/aiplatform_v1beta1_generated_model_service_list_model_evaluations_async.py | Python | apache-2.0 | 1,587 |
# 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/neutron-lib | neutron_lib/api/definitions/filter_validation.py | Python | apache-2.0 | 951 |
"""
Representation of a Tag object
"""
from .trovebox_object import TroveboxObject
class Tag(TroveboxObject):
""" Representation of a Tag object """
_type = "tag"
def delete(self, **kwds):
"""
Endpoint: /tag/<id>/delete.json
Deletes this tag.
Returns True if successful.
... | photo/openphoto-python | trovebox/objects/tag.py | Python | apache-2.0 | 804 |
import re
from pprint import pprint
def test_phones_on_home_pages(app):
contact_from_homepage = app.contact.get_contact_list()[0]
contact_from_edit_page = app.contact.get_contact_info_from_edit_page(0)
assert contact_from_homepage.all_phones_from_home_page == merge_phones_like_on_home_page(contact_from_ed... | zbikowa/python_training | test/test_phones.py | Python | apache-2.0 | 1,283 |
#!/usr/bin/python
# @lint-avoid-python-3-compatibility-imports
#
# slabratetop Summarize kmem_cache_alloc() calls.
# For Linux, uses BCC, eBPF.
#
# USAGE: slabratetop [-h] [-C] [-r MAXROWS] [interval] [count]
#
# This uses in-kernel BPF maps to store cache summaries for efficiency.
#
# SEE ALSO: slabtop(1... | mcaleavya/bcc | tools/slabratetop.py | Python | apache-2.0 | 3,635 |
"""
Copyright 2016 ElasticBox 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 agreed to in ... | ElasticBox/elastickube | src/tests/diagnostics/diagnostics_test.py | Python | apache-2.0 | 17,211 |
#!/usr/bin/env python
__author__ = 'litleleprikon'
def args_match_types(func):
"""
Decorator, that checks that types of named arguments is matches to types, allowed in annotations of function
:param func: function to check
:return: wrapper, that will check args
"""
def wrapper(*args, **kwargs... | litleleprikon/FIXTestTask | fix_task/decorators.py | Python | apache-2.0 | 765 |
#!/usr/bin/env python
#
# Copyright 2011 Google Inc. All Rights Reserved.
# pylint: disable=g-bad-name
import re
import unittest
from mapreduce.lib import pipeline
from google.appengine.api import files
from google.appengine.api.files import file_service_pb
from google.appengine.ext import blobstore
from google.... | OsoTech/appengine-mapreduce | python/test/mapreduce/mapreduce_pipeline_test.py | Python | apache-2.0 | 11,109 |
from collections import Counter
from textwrap import dedent
from typing import List
from cool_commits.utils import git_commit_info
# A list of instances of BaseParser, this way
# we can auto discover al inherited parsers
all_parsers = []
class BasePaerserMeta(type):
def __init__(cls, name, bases=None, object=No... | OrDuan/cool_commits | cool_commits/parsers.py | Python | apache-2.0 | 2,352 |
import os,sys
import numpy as np
import argparse
def merge_assignments(new_assignments, old_assignments, remove_outliers=False):
outliers = -1
# Number of clusters in assignments, ignoring noise if present.
#clusters_size = len(set(old_assignments)) - (1 if -1 in old_assignments else 0)
clusters_size =... | stephenliu1989/HK_DataMiner | hkdataminer/scripts/merge_assignments.py | Python | apache-2.0 | 3,698 |
from prometheus_client import CollectorRegistry, generate_latest, start_http_server, Summary, Counter, Histogram, Gauge
from timeit import default_timer
__version__ = "1.0.1"
prometheus_monitor_registry = CollectorRegistry()
class prometheus_monitor(object):
_instances = {}
def __new__(cls, labels: dict, n... | fluxcapacitor/pipeline | libs/pipeline_monitor/pipeline_monitor/__init__.py | Python | apache-2.0 | 1,437 |
# Copyright 2019 The TensorFlow Hub 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 app... | tensorflow/hub | tensorflow_hub/tools/module_search/utils.py | Python | apache-2.0 | 7,521 |
#!/usr/bin/env python
#
# ___INFO__MARK_BEGIN__
#######################################################################################
# Copyright 2016-2021 Univa Corporation (acquired and owned by Altair Engineering Inc.)
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file e... | gridengine/config-api | uge/exceptions/object_not_found.py | Python | apache-2.0 | 1,531 |
"""
channels.wsgi
~~~~~~~~~~~~~
:copyright: (c) 2012 DISQUS.
:license: Apache License 2.0, see LICENSE for more details.
"""
from channels.app import app
application = app
| disqus/channels | channels/wsgi.py | Python | apache-2.0 | 175 |
from core.models.user import AtmosphereUser
from core.query import only_current, only_current_source
from rest_framework import serializers
from .instance_serializer import InstanceSerializer
from .volume_serializer import VolumeSerializer
class NoProjectSerializer(serializers.ModelSerializer):
instances = serial... | CCI-MOC/GUI-Backend | api/v1/serializers/no_project_serializer.py | Python | apache-2.0 | 1,289 |
from pyquery import PyQuery as pq
from lxml import etree
import urllib
def convertToNumber(num):
result = 0
if num.endswith("GB"):
result = float(num[:-2]) * 1024 * 1024
elif num.endswith("MB"):
result = float(num[:-2]) * 1024
elif num.endswith("B"):
result = float(num[:-2])
... | pythonlittleboy/python_gentleman_crawler | test/pqtest.py | Python | apache-2.0 | 927 |
from abc import ABC, abstractmethod
import rj_gameplay.eval as eval
import argparse
import py_trees
import sys
import time
import numpy as np
from rj_msgs.msg import RobotIntent, SettleMotionCommand
import stp.skill as skill
import stp.role as role
import stp.rc as rc
from typing import Optional
SETTLE_BALL_SPEED_TH... | RoboJackets/robocup-software | rj_gameplay/rj_gameplay/skill/settle.py | Python | apache-2.0 | 1,394 |
__author__ = 'MatrixRev'
import codecs
import json
import re
from collections import Mapping
from collections import defaultdict
from collections import Counter
import Levenshtein
import nltk
from nltk.corpus import stopwords
import fileinput
import string
import os
import collections
import rdflib
from rdflib.namespa... | ibrahimsh/final-project-software-programming | rdfontology.py | Python | apache-2.0 | 67,938 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2012 The Plaso Project Authors.
# Please see the AUTHORS file for details on individual 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 L... | iwm911/plaso | plaso/parsers/winreg_plugins/interface.py | Python | apache-2.0 | 10,751 |
# Copyright 2018 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 ... | openstack/cloudkitty | cloudkitty/rating/hash/db/sqlalchemy/alembic/versions/644faa4491fd_update_tenant_id_type_from_uuid_to_text.py | Python | apache-2.0 | 3,217 |
import pytest
from selenium import webdriver
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.common.exceptions import NoSuchElementException
@pytest.fixture
def driver(request):
# w... | apotrebin/sel-6-Akram | test_example.py | Python | apache-2.0 | 1,594 |
import webbrowser
import click
from .local_server import LocalServerError, start_local_server
from .tokenstore import internal_auth_client, token_storage_adapter
_STORE_CONFIG_USERINFO = "auth_user_data"
def do_link_auth_flow(scopes, *, session_params=None):
"""
Prompts the user with a link to authenticate... | globus/globus-cli | src/globus_cli/login_manager/auth_flows.py | Python | apache-2.0 | 4,235 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2019 The FATE 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/lic... | FederatedAI/FATE | python/federatedml/linear_model/logistic_regression/homo_logistic_regression/homo_lr_host.py | Python | apache-2.0 | 11,812 |
# coding=utf-8
from yaya.seg import segment
__author__ = 'tony'
def print_terms(terms):
for i, v in enumerate(terms):
print "%s/%s" % (v[0], v[1])
def main():
# 识别歧意词
text = u"龚学平、张晓辉等领导说,邓颖超生前杜绝超生"
terms = segment.seg(text)
print_terms(terms)
# 识别人名
text = u"签约仪式前,秦光荣、李纪恒、仇和等... | Tony-Wang/YaYaNLP | demo/demo_segment.py | Python | apache-2.0 | 1,136 |
class ProductPage:
def __init__(self, app):
self.app = app
def add_product_to_cart(self):
wd = self.app.wd
# click Add To Cart button
wd.find_element_by_name("add_cart_product").click()
cart_quantity = wd.find_element_by_css_selector("#cart span.quantity").get_attribu... | Dob3r/python_seleniumwebdriver | fixture/product_page.py | Python | apache-2.0 | 549 |
#!/usr/bin/env
"""
RedisFile
===============
This is a simple hack to allow the writing to redis as if it was
just file object in python.
Usage
-----
# Import and open up a ne "file"
from redisfile import RedisFile
f = RedisFile("myrediskey")
# Write some lines to the "file"
f.write('hello')
... | daniellawrence/redis-file | setup.py | Python | apache-2.0 | 1,178 |
# --------------------------------------------------------------------------------------------------
# Name: Drawing
# Purpose: Common drawing operations used by Canvas
#
# Author: Rafael Vasco
#
# Created: 31/03/13
# Copyright: (c) Rafael 2013
# Licence: <your licence>
#----------------------... | rafaelvasco/SpriteMator | src/helpers/drawing.py | Python | apache-2.0 | 1,524 |
import os
import sys
sys.path.insert(1, os.path.join(os.path.abspath('.'), 'lib'))
sys.path.insert(1, os.path.join(os.path.abspath('.'), 'cftracker'))
import cftracker
| expl0si0nn/cf-tracker | src/run.py | Python | apache-2.0 | 169 |
# 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... | annarev/tensorflow | tensorflow/python/tools/api/generator/create_python_api.py | Python | apache-2.0 | 32,147 |
# coding: utf-8
from selenium_fixture import app
from model.user import User
def test_login_with_valid_credentials(app):
app.go_to_home_page()
app.login(User.Admin())
assert app.is_logged_in()
app.logout()
assert app.is_not_logged_in()
def test_login_with_invalid_credential(app):
app.go_to_... | VolodyaEsk/selenium-python-vkhatianovskyi | php4dvd/test_login.py | Python | apache-2.0 | 395 |
#!/usr/bin/env python
# Copyright 2012 Maestro Project
#
# 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 ... | ehazlett/fabric-maestro | maestro/cli.py | Python | apache-2.0 | 3,241 |
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
# Copyright (c) 2012 VMware, Inc.
# Copyright (c) 2011 Citrix Systems, Inc.
# Copyright 2011 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. Yo... | vmthunder/nova | nova/virt/vmwareapi/vmops.py | Python | apache-2.0 | 78,146 |
# -*- coding: utf-8 -*-
"""
This will be a wrapper around pyflann.
Splits kd-forests into multiple kd-forests to alleviate build time for large
databases.
"""
from __future__ import absolute_import, division, print_function
import utool
(print, print_, printDBG, rrr, profile) = utool.inject(__name__, '[stack_tree]', D... | SU-ECE-17-7/ibeis | _broken/old/stack_tree.py | Python | apache-2.0 | 424 |
# Copyright 2020 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... | annarev/tensorflow | tensorflow/python/keras/engine/keras_tensor.py | Python | apache-2.0 | 25,670 |
from distutils.core import setup
setup(
name = 'asytormongo',
version = '1.0.0',
author = 'Shi Yanhui',
author_email = 'shiyanhui66@gmail.com',
url = 'https://github.com/shiyanhui/asytormongo',
description = 'Asynchronous ORM for tornado with mongodb',
license = 'Apache License, Version 2.0',
packages = [ 'as... | shiyanhui/Asytormongo | setup.py | Python | apache-2.0 | 734 |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.8.2
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
im... | mbohlool/client-python | kubernetes/test/test_v1_azure_disk_volume_source.py | Python | apache-2.0 | 1,021 |
# Copyright 2015, 2016 IBM Corp.
#
# 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 require... | PowerHMC/HmcRestClient | src/managed_system/virtual_switch/CreateVirtualSwitch.py | Python | apache-2.0 | 2,037 |
#!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
AUTHOR = u'Gouthaman Balaraman'
SITENAME = u'Gouthaman Balaraman'
SITEURL = '/'
LOCAL_BOOTSTRAP = True
ARTICLE_URL = 'blog/{slug}.html'
ARTICLE_SAVE_AS = 'blog/{slug}.html'
TIMEZONE = 'America/Los_Angeles'
DEFAULT_DATE_FORMAT ='%... | gouthambs/karuth-source | pelicanconf.py | Python | artistic-2.0 | 1,730 |
'''
Created on 10. 10. 2016
@author: neneko
'''
from Trzba import *
from lxml import etree
from signing import Signing
import wsse
import requests
from eet_ns import NS_EET_URL
import utils
import eet_exceptions
class EET:
def __init__(self, cert_file, password, provozovna=1, pokladna='lidicka', testing=True, e... | v154c1/pyEET | eet/EET.py | Python | bsd-2-clause | 3,063 |
import os, StringIO, traceback
from hashlib import md5
import createaccount, config, avatar, player, models
from google.appengine.ext import db
from google.appengine.api import images
from google.appengine.ext import webapp
from google.appengine.ext.webapp import template
class UpdateAccount(createaccount.CreateAcco... | spiffcode/hostile-takeover | stats/updateaccount.py | Python | bsd-2-clause | 1,858 |
#!/usr/bin/env python
import processvideo
import os
import ntpath
import util
import numpy as np
import matplotlib.pyplot as plt
if __name__ == "__main__":
videolist = ["..\\SampleVideos\\more\\armando1\\armando1.mp4", "..\\SampleVideos\\more\\armando2\\armando2.mp4",
"..\\SampleVideos\\mor... | adobe-research/video-lecture-summaries | Scripts/fgpixelgrad.py | Python | bsd-2-clause | 2,686 |
import json
import keyword
import sys
import re
import os
first_cap_re = re.compile('(.)([A-Z][a-z]+)')
all_cap_re = re.compile('([a-z0-9])([A-Z])')
def convert_camel_to_snake(name):
s1 = first_cap_re.sub(r'\1_\2', name)
return all_cap_re.sub(r'\1_\2', s1).lower()
def map_property_name(name):
if keyword.... | getwarped/powershift | src/powershift/resources/base.py | Python | bsd-2-clause | 5,891 |
import unittest
from djcopybook.fixedwidth import fields
class IntegerFieldTests(unittest.TestCase):
def test_to_record_returns_string_of_value_padded_to_length(self):
field = fields.IntegerField(length=5)
self.assertEqual("00012", field.to_record(12))
def test_to_record_returns_padded_zero... | imtapps/django-copybook | djcopybook/fixedwidth/tests/fields/test_integer_field.py | Python | bsd-2-clause | 1,248 |
import cv2
import os
import ctypes
import pyzbar.pyzbar as pyzbar
import numpy as np
from img_edge_detection import order_points, crop_from_points, find_countour_export_pts, scale_image
from read_from_image import read_production_number_from_image,number_from_zbar, is_label_in_image
from pyueye_example_camera import Ca... | patrick310/sc-vision | production_code_reader/edge_detection.py | Python | bsd-2-clause | 2,804 |
payouts_probabilities_file = open('select_bonus.csv', 'r')
line = payouts_probabilities_file.readline()
expected_value = 0.0
while line:
tokens = line.split(',')
if len(tokens) != 2 or len(tokens[0]) < 1:
break
payout = float(tokens[0])
probability = float(tokens[1])
expected_value += payout... | jhurt/slotmath | selectbonusmath.py | Python | bsd-2-clause | 471 |
""" PyXLL extension loader.
Loads all the extensions contributing to the pyxll.modules namespace. This
module is supposed to be added to you pyxll.cfg file to automatically load all
the installed packages that contributes to PyXLL through setuptools.
"""
import errno
import logging
import os
from stevedore import ex... | pyxll/pyxll-utils | pyxll_utils/extension_loader.py | Python | bsd-2-clause | 1,923 |
# Version: 6.2
# Architecture: i386
from past.builtins import xrange
import vstruct
from vstruct.primitives import *
KPROCESS_STATE = v_enum()
KPROCESS_STATE.ProcessInMemory = 0
KPROCESS_STATE.ProcessOutOfMemory = 1
KPROCESS_STATE.ProcessInTransition = 2
KPROCESS_STATE.ProcessOutTransition = 3
KPROCESS_STATE.ProcessI... | atlas0fd00m/CanCat | cancat/vstruct/defs/windows/win_6_2_i386/ntoskrnl.py | Python | bsd-2-clause | 455,621 |
#!/usr/bin/python
#
# Filename: twitcontrol.py
# Version 1.0
# This is the C&C agent for twitbot.py
""" This is the C&C agent for twitbot.py """
__author__ = 'arkem'
__version__ = '1.0'
from Crypto.Cipher import ARC4 # apt-get install python-crypto
import md5
import time
import base64
import twitter # easy_install t... | arkem/twitbot | twitcontrol.py | Python | bsd-2-clause | 1,979 |
'''
test minimum program size with all MCUs
'''
from entrypoint2 import entrypoint
from pyavrutils.avrgcc import AvrGcc, AvrGccCompileError
def test(cc, mcu):
print 'MCU =', mcu.ljust(20),
cc.mcu = mcu
try:
cc.build(cc.minprog)
print ' program/data size =', cc.size().program_bytes, ','... | ponty/pyavrutils | pyavrutils/examples/minsize.py | Python | bsd-2-clause | 751 |
from . import InternalTLSRelocation, ThreadManager, TLSObject
from ...address_translator import AT
class PEThreadManager(ThreadManager):
def register_object(self, obj):
if not super().register_object(obj):
return False
# The PE TLS header says to write its index into a given address
... | angr/cle | cle/backends/tls/pe_tls.py | Python | bsd-2-clause | 4,786 |
from . import generic
from . import Relocation
# http://refspecs.linuxfoundation.org/ELF/ppc64/PPC-elf64abi-1.9.pdf
arch = 'PPC64'
class R_PPC64_JMP_SLOT(Relocation):
def relocate(self, solist):
if not self.resolve_symbol(solist):
return False
if self.owner_obj.is_ppc64_abiv1:
... | pewpewsecure/cle | cle/relocations/ppc64.py | Python | bsd-2-clause | 1,388 |
import sqlite3
from blaze.desc.byteprovider import ByteProvider
from blaze.byteproto import CONTIGUOUS, CHUNKED, STREAM, ACCESS_READ
#from blaze.datadescriptor import SqlDataDescriptor
from blaze.layouts.categorical import Simple
class SqliteSource(ByteProvider):
read_capabilities = STREAM
write_capabiliti... | seibert/blaze-core | blaze/sources/sql.py | Python | bsd-2-clause | 1,150 |
import operator
from .transform import BlockPass
from .. import ir
def cast(value, ty):
""" Cast a value to the given type """
if isinstance(ty, ir.PointerTyp):
return int(value)
elif ty.is_integer:
return correct(int(value), ty)
else:
assert isinstance(ty, ir.FloatingPointTyp)... | windelbouwman/ppci-mirror | ppci/opt/constantfolding.py | Python | bsd-2-clause | 5,169 |
import logging
import urllib2
import json
import song
logger = logging.getLogger("playlist")
playlist_url_temp = "http://www.xiami.com/song/playlist/id/%s/type/%s/cat/json"
playlist_player_url_temp = "http://www.xiami.com/play?ids=/song/playlist/id/%s/type/%s"
player_path = "http://ima.xiami.com/static/swf/seiya/1.4/... | HenryHu/xmradio | playlist.py | Python | bsd-2-clause | 1,980 |
import json
from django.test.utils import override_settings
from restlib2.http import codes
from avocado.models import DataConcept, DataConceptField, DataField, \
DataCategory
from avocado.events.models import Log
from .base import BaseTestCase
class ConceptResourceTestCase(BaseTestCase):
def setUp(self):
... | rv816/serrano_night | tests/cases/resources/tests/concept.py | Python | bsd-2-clause | 9,658 |
import unittest
from elixir import elixir
class ElixirTests(unittest.TestCase):
def testloadXML(self):
pass
| scieloorg/elixir | tests/test_elixir.py | Python | bsd-2-clause | 125 |
from flask import Flask, Markup, flash, request, render_template, make_response, send_from_directory
from flask_restful import Resource, Api
from socket import *
sock=socket()
sock.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1)
import os
import sys
import time
import json
import imghdr
from datetime import datetime
from ar... | svebk/DeepSentiBank_memex | cu_image_search/www/api.py | Python | bsd-2-clause | 23,400 |
import numpy
from palm.base.parameter_set import ParameterSet
class SingleDarkParameterSet(ParameterSet):
"""
Parameters for a blink model with one dark state. The parameters are
`log_ka`, `log_kr`, `log_kd`, `log_kb`, `N`, `fermi_T`, and `fermi_tf`.
Attributes
----------
parameter_dict : dict... | milapour/palm | palm/blink_parameter_set.py | Python | bsd-2-clause | 13,488 |
class TestCheckpointScope:
providers = {
'Root': '/<int:value>'
}
def test_accept_1(self, app):
with app.test_client() as client:
vtt = client.get('/0')
assert vtt.status == 200
def test_reject_0(self, app):
with app.test_client() as client:
... | project-hypr/hypr | tests/security/checkpoint/test_cp_scope_always.py | Python | bsd-2-clause | 383 |
import operator
from django.contrib.auth.models import User
from accounts.utils import get_robot_user, is_robot_user, get_alleviate_user
from annotations.models import Annotation
from images.model_utils import PointGen
from images.models import Image, Point, Robot
from images.tasks import get_alleviate_meta
def image... | DevangS/CoralNet | annotations/utils.py | Python | bsd-2-clause | 5,119 |
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
with open('README.rst') as f:
readme = f.read()
with open('LICENSE') as f:
license = f.read()
setup(
name='parser',
version='0.1.0',
description='Table parser of Excel to several language',
long_description=r... | chuenlungwang/tableParser | setup.py | Python | bsd-2-clause | 530 |
import pytest
import os
import numpy as np
from hyperion.util.constants import pc, kpc, au
from hyperion.model import ModelOutput
from ..interface import Interface2FITS
from ..database.compact_pipeline import PACS1
class TestInterface2FITS(object):
def setup_method(self, method):
path = os.path.join(os.p... | koepferl/FluxCompensator | fluxcompensator/tests/test_master.py | Python | bsd-2-clause | 907 |
import logging
from typing import Union, Optional, List, Dict, Type
from collections import defaultdict
import claripy
import archinfo
from archinfo import RegisterName
from .sim_type import SimType, SimTypeChar, SimTypePointer, SimTypeFixedSizeArray, SimTypeArray, SimTypeString, \
SimTypeFunction, SimTypeFloat, ... | angr/angr | angr/calling_conventions.py | Python | bsd-2-clause | 72,611 |
# -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import
import ctypes
import unittest
from flypy import jit, typeof #, addressof
from flypy.types import Type, int32, float64
## Test helpers
@jit
class C(object):
layout = [('ran', 'bool')]
@jit
def method(self):
... | flypy/flypy | flypy/runtime/tests/test_special.py | Python | bsd-2-clause | 1,337 |
import numpy as np
from astropy import log as logger
from astropy.io import fits
import matplotlib.pyplot as plt
from hyperion.util.constants import c
from hyperion.util.integrate import integrate_subset
#val = integrate_subset(x, y, xmin, xmax)
from .utils.tools import properties, get_slices
class Filter(object):
... | koepferl/FluxCompensator | fluxcompensator/filter.py | Python | bsd-2-clause | 8,384 |
'''
You have a number of envelopes with widths and heights given as a pair of integers (w, h). One envelope can fit into another if and only if both the width and height of one envelope is greater than the width and height of the other envelope.
What is the maximum number of envelopes can you Russian doll? (put one in... | shub0/algorithm-data-structure | python/russian_dolls_envelopes.py | Python | bsd-3-clause | 2,989 |
# -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import os
from os.path import abspath, dirname, join
import sys
import six
from asv import config
from asv.commands.co... | mdboom/asv | test/test_compare.py | Python | bsd-3-clause | 3,458 |
#! /usr/bin/env python
#
# This file is part of khmer, https://github.com/dib-lab/khmer/, and is
# Copyright (C) Michigan State University, 2009-2015. It is licensed under
# the three-clause BSD license; see LICENSE.
# Contact: khmer-project@idyll.org
#
"""
Accept or discard sequences XXX, based on the given counting
h... | F1000Research/khmer | sandbox/filter-median.py | Python | bsd-3-clause | 1,821 |
"""
sentry.web.forms.projects
~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
from django import forms
from django.conf import settings
from django.utils.translation import uge... | camilonova/sentry | src/sentry/web/forms/projects.py | Python | bsd-3-clause | 4,247 |
#!/usr/bin/env python
from __future__ import unicode_literals
from __future__ import print_function
import os
import re
import sys
import traceback
import logging
import threading
import shutil
import functools
import humanize
from time import time
from codecs import open
import click
try:
import setproctitle
ex... | darikg/pgcli | pgcli/main.py | Python | bsd-3-clause | 32,021 |
import math
import os
import subprocess
udt = os.path.join('.', 'test_udivmod64.run')
def testcase(dividend, divisor):
print 'divmod64(%d, %d)' % (dividend, divisor)
procargs = ('%s %s %s' % (udt, dividend, divisor)).split()
result = subprocess.check_output(procargs)
gotQ, gotR = map(int, result.split... | llvmpy/llvmpy | llrtc/lib/test_udivmod64.py | Python | bsd-3-clause | 1,408 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
from cms.api import get_page_draft
from cms.toolbar.items import Break
from cms.toolbar_base import CMSToolbar
from cms.toolbar_pool import toolbar_pool
from cms.utils import get_cms_setting
from cms.utils.i18n import get_... | Formlabs/djangocms-page-meta | djangocms_page_meta/cms_toolbar.py | Python | bsd-3-clause | 3,983 |
def makebold(fn):
def wrapped():
return "<b>" + fn() + "</b>"
return wrapped
def makeitalic(fn):
def wrapped():
return "<i>" + fn() + "</i>"
return wrapped
@makebold
def hello1():
return "hello world"
assert hello1()=="<b>hello world</b>"
@makebold
@makeitalic
def hello2():
re... | Hasimir/brython | www/tests/test_decorators.py | Python | bsd-3-clause | 1,865 |
import traceback
from django.http import HttpRequest
from django.shortcuts import redirect
from frontpage.models import ArticleGroup, Article
def update_group_metadata(requestdict, grpid: int):
grp: ArticleGroup = None
if grpid != -1:
grp = ArticleGroup.objects.get(id=grpid)
else:
grp = ... | Technikradio/C3FOCSite | c3shop/frontpage/management/grouptools/groupmetaupdate.py | Python | bsd-3-clause | 1,712 |
##########################################################################
#
# Copyright (c) 2015, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistrib... | chippey/gaffer | python/GafferImageTest/ImageAlgoTest.py | Python | bsd-3-clause | 4,620 |
# proxy module
from __future__ import absolute_import
from etsdevtools.developer.tools.class_browser import *
| enthought/etsproxy | enthought/developer/tools/class_browser.py | Python | bsd-3-clause | 110 |
import re
import feedparser
import urllib2
import json as simplejson
import datetime
from goscale import models as goscale_models
from goscale import utils
from django.db import models
from django.db.models import signals
from django.utils.translation import ugettext as _
class VideosBase(goscale_models.GoscaleCMSPlu... | sternoru/goscalecms | goscale/plugins/videos/models.py | Python | bsd-3-clause | 10,950 |
from collections import defaultdict
import networkx as nx
from autonetkit.load.common import add_loopback
from autonetkit.design.utils.graph_utils import normalise_node_locations
from autonetkit.load.model import StructuredNode, StructuredPort, StructuredTopology, StructuredLink
from autonetkit.load.preprocess import... | sk2/autonetkit | autonetkit/load/load_graphml.py | Python | bsd-3-clause | 3,043 |
#
# Collective Knowledge (individual environment - setup)
#
# See CK LICENSE.txt for licensing details
# See CK COPYRIGHT.txt for copyright details
#
# Developer: Grigori Fursin, Grigori.Fursin@cTuning.org, http://fursin.net
#
import os
##############################################################################
# ... | ctuning/ck-env | soft/dataset.imagenet.val.lmdb/customize.py | Python | bsd-3-clause | 3,500 |
import numpy as np
from scipy import interpolate
from skimage.restoration import unwrap_phase
import warnings
def interpolate_field(field, newsize, info=None, verbose=False):
"""Interpolate two-dimensional complex field
Parameters
----------
field: 2d ndarray of shape (M,M)
The field image
... | RI-imaging/FDTD_sinogram | meep_tomo/meep_tomo/postproc.py | Python | bsd-3-clause | 2,817 |
#!/bin/env/python
# File: eeprom_setup.py
#
# Setup test data on the I2C EEPROM
#
# Date: 6/28/18
# Platform: Raspberry Pi 3 Model B
#
# Python Version: 2.7.9
from smbus import SMBus # For I2C operations
vals = [0, 0, 5, 0, 1, 0, 245, 0, 2, 1, 245, 0, 3, 2, 244, 0, 4, 4, 244, 0, 5, 3, 243]
bus = SMBus(1) # De... | UCHIC/WaterMonitor | Previous_Designs/Hybrid_Prototype/Software/RPi_PythonScripts/eeprom_setup.py | Python | bsd-3-clause | 419 |
import datetime
import inspect
import logging
import time
from dateutil.parser import parse
from django.db.models import Count
from django.shortcuts import get_object_or_404
from django.utils.decorators import method_decorator
from django.utils.functional import wraps
from tournamentcontrol.competition.models import C... | goodtune/vitriolic | tournamentcontrol/competition/decorators.py | Python | bsd-3-clause | 12,977 |
from __future__ import absolute_import
from django.core.urlresolvers import reverse
from sentry.testutils import APITestCase
class ProjectAgnosticRuleConditionsTest(APITestCase):
def test_simple(self):
self.login_as(user=self.user)
org = self.create_organization(owner=self.user, name="baz")
... | beeftornado/sentry | tests/sentry/api/endpoints/test_project_agnostic_rule_conditions.py | Python | bsd-3-clause | 560 |
# -*- coding: utf-8 -*-
from .maps import Map
from .geometry import (
clean,
get_intersection,
kind_mapping,
)
from .projection import project
from logging.handlers import QueueHandler, QueueListener
from shapely.geometry import shape
from shapely.geos import TopologicalError
import datetime
import logging
... | cmutel/pandarus | pandarus/intersections.py | Python | bsd-3-clause | 5,474 |
"""
2nd-order accurate finite-volume implementation of linear advection with
piecewise linear slope reconstruction.
We are solving a_t + u a_x = 0
This script defines two classes:
-- the Grid1d class that manages a cell-centered grid and holds the
data that lives on that grid
-- the Simulation class that is... | JeffDestroyerOfWorlds/hydro_examples | advection/advection.py | Python | bsd-3-clause | 11,152 |
from hashmoji import hashmoji, IncompatibleDigest, InvalidByteLength
import hashlib, unittest
class MockBadDigest(object):
digest_size = -1
def digest(self):
pass
class HashmojiTestCase(unittest.TestCase):
def test_basic(self):
result = hashmoji(hashlib.sha1(b"This is my test string."))
self.assertEqual(res... | mcroydon/hashmoji | tests.py | Python | bsd-3-clause | 1,134 |
import tests.periodicities.period_test as per
per.buildModel((5 , 'T' , 400));
| antoinecarme/pyaf | tests/periodicities/Minute/Cycle_Minute_400_T_5.py | Python | bsd-3-clause | 81 |
import operator
import time
from celery.tests.functional import tasks
from celery.tests.functional.case import WorkerCase
from celery.task.control import broadcast
class test_basic(WorkerCase):
def test_started(self):
self.assertWorkerAlive()
def test_roundtrip_simple_task(self):
publisher... | frac/celery | funtests/test_basic.py | Python | bsd-3-clause | 2,179 |