max_stars_repo_path stringlengths 4 245 | max_stars_repo_name stringlengths 7 115 | max_stars_count int64 101 368k | id stringlengths 2 8 | content stringlengths 6 1.03M |
|---|---|---|---|---|
code/cifar_eval.py | mlaai/mentornet | 306 | 11195896 | <gh_stars>100-1000
# Copyright 2018 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... |
preprocess.py | Shengqi-Pan/deepke | 173 | 11195910 | import os
import logging
from collections import OrderedDict
from typing import List, Dict
from transformers import BertTokenizer
from serializer import Serializer
from vocab import Vocab
from utils import save_pkl, load_csv
logger = logging.getLogger(__name__)
def _handle_pos_limit(pos: List[int], limit: int) -> Li... |
xero/basemanager.py | Ian2020/pyxero | 246 | 11195923 | from __future__ import unicode_literals
import json
import requests
import six
from datetime import datetime
from six.moves.urllib.parse import parse_qs
from xml.etree.ElementTree import Element, SubElement, tostring
from xml.parsers.expat import ExpatError
from .auth import OAuth2Credentials
from .exceptions import ... |
exercises/zh/exc_02_05_03.py | Jette16/spacy-course | 2,085 | 11195934 | <reponame>Jette16/spacy-course
from spacy.lang.en import English
nlp = English()
# 导入Doc类
from ____ import ____
# 目标文本:"Oh, really?!"
words = [____, ____, ____, ____, ____]
spaces = [____, ____, ____, ____, ____]
# 用words和spaces创建一个Doc
doc = ____(____, ____=____, ____=____)
print(doc.text)
|
Chapter07/face_detection.py | lebull/Neural-Network-Projects-with-Python | 269 | 11195936 | import cv2
import os
face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
def detect_faces(img, draw_box=True):
# convert image to grayscale
grayscale_img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
# detect faces
faces = face_cascade.detectMultiScale(grayscale_img, scaleFactor=1.1,
minNeig... |
bookwyrm/connectors/connector_manager.py | mouse-reeve/fedireads | 270 | 11195937 | """ interface with whatever connectors the app has """
import asyncio
import importlib
import ipaddress
import logging
from urllib.parse import urlparse
import aiohttp
from django.dispatch import receiver
from django.db.models import signals
from requests import HTTPError
from bookwyrm import book_search, models
fro... |
Trakttv.bundle/Contents/Libraries/Shared/trakt/core/errors.py | disrupted/Trakttv.bundle | 1,346 | 11195940 | from six.moves.urllib.parse import urlparse
ERRORS = {
400: ("Bad Request", "Request couldn't be parsed"),
401: ("Unauthorized", "OAuth must be provided"),
403: ("Forbidden", "Invalid API key or unapproved app"),
404: ("Not Found", "Method exists, but no ... |
platformio/commands/remote/projectsync.py | Maniekkk/platformio-core | 4,744 | 11195941 | # Copyright (c) 2014-present PlatformIO <<EMAIL>>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... |
Face Reconstruction/Fast Few-shot Face alignment by Reconstruction/datasets/w300.py | swapnilgarg7/Face-X | 175 | 11195944 | import os
import numpy as np
import torch.utils.data as td
import pandas as pd
import config
from csl_common.utils.nn import Batch
from csl_common.utils import geometry
from datasets import facedataset
def read_300W_detection(lmFilepath):
lms = []
with open(lmFilepath) as f:
for line in f:
... |
Bl/Search.py | eugene2candy/moviecatcher | 893 | 11195951 | <filename>Bl/Search.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import threading
import webbrowser
from Da import ResZmz
from Da import ResVhao
from View import ResultView
import urllib.request, urllib.parse, urllib.error
class Search :
def __init__ (self, master) :
self.master = master
self.ResWindow = Res... |
release/stubs.min/System/IO/__init___parts/FileAttributes.py | htlcnn/ironpython-stubs | 182 | 11195971 | class FileAttributes(Enum,IComparable,IFormattable,IConvertible):
"""
Provides attributes for files and directories.
enum (flags) FileAttributes,values: Archive (32),Compressed (2048),Device (64),Directory (16),Encrypted (16384),Hidden (2),IntegrityStream (32768),Normal (128),NoScrubData (131072),NotConten... |
tests/test_providers_base.py | xkortex/ulid | 303 | 11195999 | <gh_stars>100-1000
"""
test_providers_base
~~~~~~~~~~~~~~~~~~~
Tests for the :mod:`~ulid.providers.base` module.
"""
import inspect
from ulid.providers import base
def test_provider_is_abstract():
"""
Assert that :class:`~ulid.providers.base.Provider` is an abstract class.
"""
assert ins... |
runtime/python/Lib/ctypes/test/test_bytes.py | hwaipy/InteractionFreeNode | 207 | 11196005 | """Test where byte objects are accepted"""
import unittest
import sys
from ctypes import *
class BytesTest(unittest.TestCase):
def test_c_char(self):
x = c_char(b"x")
self.assertRaises(TypeError, c_char, "x")
x.value = b"y"
with self.assertRaises(TypeError):
x... |
tests/tools.py | proteanblank/building_tool | 559 | 11196015 | import os
import sys
import traceback
import types
class LoadModule:
"""Adapted from Script Watcher Addon
https://github.com/wisaac407/blender-script-watcher
"""
def __init__(self, filepath):
self.filepath = filepath
self.remove_cached_mods()
try:
f = open(filepath... |
workers/baseurl/beta/xhr-worker.py | meyerweb/wpt | 14,668 | 11196023 | <reponame>meyerweb/wpt
def main(request, response):
return (302, b"Moved"), [(b"Location", b"../gamma/xhr-worker.js")], u"postMessage('executed redirecting script');"
|
labs/02_backprop/solutions/neural_net.py | soufiomario/labs-Deep-learning | 1,398 | 11196031 | <reponame>soufiomario/labs-Deep-learning
class NeuralNet():
"""MLP with 1 hidden layer with a sigmoid activation"""
def __init__(self, input_size, hidden_size, output_size):
self.W_h = np.random.uniform(
size=(input_size, hidden_size), high=0.01, low=-0.01)
self.b_h = np.zeros(hidde... |
public-engines/image-classification-engine/marvin_image_classification_engine/data_handler/acquisitor_and_cleaner.py | tallandroid/incubator-marvin | 101 | 11196049 | <filename>public-engines/image-classification-engine/marvin_image_classification_engine/data_handler/acquisitor_and_cleaner.py<gh_stars>100-1000
#!/usr/bin/env python
# coding=utf-8
"""AcquisitorAndCleaner engine action.
Use this module to add the project main code.
"""
import os
import random
from random import shuf... |
setup.py | oscargus/numba-scipy | 161 | 11196063 | from setuptools import setup, find_packages
import versioneer
_install_requires = ['scipy>=0.16,<=1.7.1', 'numba>=0.45']
metadata = dict(
name='numba-scipy',
description="numba-scipy extends Numba to make it aware of SciPy",
version=versioneer.get_version(),
cmdclass=versioneer.get_cmdclass(),
... |
Lib/lib2to3/fixes/fix_itertools.py | arvindm95/unladen-swallow | 2,293 | 11196068 | """ Fixer for itertools.(imap|ifilter|izip) --> (map|filter|zip) and
itertools.ifilterfalse --> itertools.filterfalse (bugs 2360-2363)
imports from itertools are fixed in fix_itertools_import.py
If itertools is imported as something else (ie: import itertools as it;
it.izip(spam, eggs)) method calls w... |
plugins/modules/panos_virtual_router_facts.py | EverOps/pan-os-ansible | 130 | 11196095 | <gh_stars>100-1000
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2019 Palo Alto Networks, 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/licen... |
Lib/idlelib/idle_test/mock_tk.py | inging44/python3 | 1,872 | 11196121 | <gh_stars>1000+
"""Classes that replace tkinter gui objects used by an object being tested.
A gui object is anything with a master or parent parameter, which is
typically required in spite of what the doc strings say.
"""
class Event:
'''Minimal mock with attributes for testing event handlers.
This is not a ... |
coinrun/policies.py | jakegrigsby/coinrun | 332 | 11196123 | <filename>coinrun/policies.py
import numpy as np
import tensorflow as tf
from baselines.a2c.utils import conv, fc, conv_to_fc, batch_to_seq, seq_to_batch, lstm
from baselines.common.distributions import make_pdtype
from baselines.common.input import observation_input
from coinrun.config import Config
def impala_cnn(i... |
tests/test_io_records.py | daoran/kapture | 264 | 11196141 | #!/usr/bin/env python3
# Copyright 2020-present NAVER Corp. Under BSD 3-clause license
import unittest
import os
import os.path as path
import sys
import tempfile
# kapture
import path_to_kapture # enables import kapture # noqa: F401
import kapture
import kapture.io.records
from kapture.io.binary import transfer_fil... |
keras_frcnn/MyLayer.py | salman-h-khan/ZSD_Release | 132 | 11196146 | from keras import backend as K
from keras.engine.topology import Layer
class MyLayer(Layer):
def __init__(self, output_dim, **kwargs):
self.output_dim = output_dim
# self.word = word
super(MyLayer, self).__init__(**kwargs)
def build(self, input_shape):
# Create a trainable weig... |
Python3/194.py | rakhi2001/ecom7 | 854 | 11196153 | <reponame>rakhi2001/ecom7
__________________________________________________________________________________________________
awk '{
for (i = 1; i <= NF; ++i) {
if (NR == 1) s[i] = $i;
else s[i] = s[i] " " $i;
}
} END {
for (i = 1; s[i] != ""; ++i) {
print s[i];
}
}' file.txt... |
tests/test_lib.py | someguyiknow/artifacts | 702 | 11196166 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
"""Shared functions and classes for testing."""
from __future__ import unicode_literals
import os
import shutil
import tempfile
import unittest
class BaseTestCase(unittest.TestCase):
"""The base test case."""
_DATA_PATH = os.path.join(os.getcwd(), 'data')
_TEST_DATA... |
di_baseline/my_submission/config/gobigger_no_spatial_config.py | ABCDa102030/GoBigger-Challenge-2021 | 121 | 11196174 | from easydict import EasyDict
gobigger_dqn_config = dict(
exp_name='gobigger_no_spatial_baseline_dqn',
env=dict(
collector_env_num=8,
evaluator_env_num=3,
n_evaluator_episode=3,
stop_value=1e10,
player_num_per_team=3,
team_num=4,
match_time=200,
m... |
tests/openid/connect/core/grant_types/test_refresh_token.py | achraf-mer/oauthlib | 954 | 11196178 | <gh_stars>100-1000
import json
from unittest import mock
from oauthlib.common import Request
from oauthlib.oauth2.rfc6749.tokens import BearerToken
from oauthlib.openid.connect.core.grant_types import RefreshTokenGrant
from tests.oauth2.rfc6749.grant_types.test_refresh_token import (
RefreshTokenGrantTest,
)
from... |
kats/tests/detectors/test_cusum_detection.py | iamxiaodong/Kats | 3,580 | 11196201 | # Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# pyre-unsafe
import re
from operator import attrgetter
from unittest import TestCase
import numpy as np
import pandas as pd
import statsmodel... |
data structures/linked list/python/Stack_with_Singly_Linked_List.py | gggrafff/Algorithms | 715 | 11196206 | <reponame>gggrafff/Algorithms<gh_stars>100-1000
class Node:
def __init__(self,data=None,next_node=None):
self.data = data
self.next_node = next_node
def get_data(self):
return self.data
def get_next(self):
return self.next_node
def set_next(self,new_node):
... |
setup.py | EasonC13/iota.py | 347 | 11196210 | #!/usr/bin/env python
from codecs import StreamReader, open
from distutils.version import LooseVersion
import setuptools
##
# Because of the way PyOTA declares its dependencies, it requires a
# more recent version of setuptools.
# https://packaging.python.org/guides/distributing-packages-using-setuptools/#python-req... |
tests/unit/recommenders/tuning/test_nni_utils.py | enowy/Recommenders | 10,147 | 11196221 | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import json
import os
import sys
from tempfile import TemporaryDirectory
from unittest.mock import patch
import pytest
from recommenders.tuning.nni.nni_utils import (
get_experiment_status,
check_experiment_status,
... |
anno_json_image_urls.py | CasiaFan/Dataset_to_VOC_converter | 194 | 11196234 | <filename>anno_json_image_urls.py
import json
import cytoolz
import argparse, os, re
def extract_urls(args):
if not os.path.exists(args.output_dir):
os.makedirs(args.output_dir)
content = json.load(open(args.anno_file, 'r'))
merge_info_list = list(map(cytoolz.merge, cytoolz.join('id', content['ima... |
tests/test_container_view.py | zhgcao/pyvmomi | 1,894 | 11196235 | # VMware vSphere Python SDK
# Copyright (c) 2008-2015 VMware, 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
#
# Unle... |
tests/functional/kvpy/pdel.py | efeslab/hse | 558 | 11196249 | #!/usr/bin/env python3
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (C) 2021 Micron Technology, Inc. All rights reserved.
from contextlib import ExitStack
from hse2 import hse
from utility import lifecycle, cli
def add_keys(kvs: hse.Kvs, pfx: str, start: int, end: int):
for k_id in range(start, end):
... |
recipes/Python/115421_Date_difference/recipe-115421.py | tdiprima/code | 2,023 | 11196285 | <reponame>tdiprima/code
# cal.py
#
# This code has been released to the Public Domain.
#
# finds the number of days between two particular dates
#
from string import *
FALSE,TRUE = range(2)
# Standard number of days for each month.
months = (31,28,31,30,31,30,31,31,30,31,30,31)
JAN,FEB,MAR,APR,MAY,JUN,JUL,AUG,SEP,OC... |
train.py | Finspire13/CMCS-Temporal-Action-Localization | 136 | 11196297 | <filename>train.py
import matlab.engine # Must import matlab.engine first
import os
import torch
import numpy as np
import argparse
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import matplotlib.pyplot as plt
from logger import Logger
from model import BackboneNet
from dataset im... |
adb/systrace/catapult/common/py_vulcanize/third_party/rcssmin/setup.py | mohanedmoh/TBS | 2,151 | 11196307 | <reponame>mohanedmoh/TBS
#!/usr/bin/env python
# -*- coding: ascii -*-
#
# Copyright 2006 - 2013
# <NAME> or his licensors, as applicable
#
# 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
#
# ... |
mistral/utils/__init__.py | shubhamdang/mistral | 205 | 11196309 | <reponame>shubhamdang/mistral
# Copyright 2013 - Mirantis, Inc.
# Copyright 2015 - Huawei Technologies Co. Ltd
# Copyright 2016 - Brocade Communications 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... |
cartoonify/app/object_detection/builders/box_coder_builder_test.py | theendsofinvention/cartoonify | 1,991 | 11196315 | <reponame>theendsofinvention/cartoonify
# 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/LI... |
scripts/mask.py | aminya/despacer | 110 | 11196345 | <filename>scripts/mask.py
print("(1<<16) * 16 = ", (1<<16)*16)
for i in range(1<<15):
solution = []
lastbit = 0
for bit in range(16):
if ((i & (1<<bit)) == 0):
solution.append(bit)
lastbit = bit
while(len(solution) < 16): solution.append(lastbit),
s = ""
for j in ... |
test/win/gyptest-cl-warning-as-error.py | chlorm-forks/gyp | 2,151 | 11196363 | #!/usr/bin/env python
# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Make sure warning-as-error is extracted properly.
"""
import TestGyp
import sys
if sys.platform == 'win32':
test = TestGyp.TestGyp(... |
python/tvm/relay/op/strategy/hexagon.py | shengxinhu/tvm | 4,640 | 11196380 | <gh_stars>1000+
# 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"... |
AutoDL_sample_code_submission/at_speech/policy_space/decision_making.py | dianjixz/AutoDL | 1,044 | 11196384 | <filename>AutoDL_sample_code_submission/at_speech/policy_space/decision_making.py
from at_speech.policy_space.meta_learning import ModelSelectLearner
from at_speech.policy_space.ensemble_learning import EnsembleLearner
from at_toolkit import AdlSpeechDMetadata
from at_speech.at_speech_cons import CLS_LR_LIBLINEAER, CLS... |
braintree/payment_method_nonce_gateway.py | futureironman/braintree_python | 182 | 11196400 | import braintree
from braintree.payment_method_nonce import PaymentMethodNonce
from braintree.error_result import ErrorResult
from braintree.exceptions.not_found_error import NotFoundError
from braintree.resource import Resource
from braintree.resource_collection import ResourceCollection
from braintree.successful_res... |
tests/test_config.py | hawkeone/PlexTraktSync | 631 | 11196413 | <reponame>hawkeone/PlexTraktSync
#!/usr/bin/env python3 -m pytest
from os import environ
from plex_trakt_sync.factory import factory
def test_config():
config = factory.config()
config.save()
config.initialized = False
assert config["PLEX_TOKEN"] is None
config.save()
assert config["PLEX_TO... |
admin/management/views.py | gaybro8777/osf.io | 628 | 11196491 | from django.views.generic import TemplateView, View
from django.contrib import messages
from django.http import HttpResponse
from django.contrib.auth.mixins import PermissionRequiredMixin
from osf.management.commands.manage_switch_flags import manage_waffle
from osf.management.commands.update_registration_schemas impo... |
eliot/tests/test_output.py | pombredanne/eliot-1 | 598 | 11196495 | """
Tests for L{eliot._output}.
"""
from sys import stdout
from unittest import TestCase, skipUnless
# Make sure to use StringIO that only accepts unicode:
from io import BytesIO, StringIO
import json as pyjson
from tempfile import mktemp
from time import time
from uuid import UUID
from threading import Thread
try:
... |
Chapter 11/demo_corr.py | tanS30/Building-Machine-Learning-Systems-With-Python-Second-Edition | 1,490 | 11196541 | # This code is supporting material for the book
# Building Machine Learning Systems with Python
# by <NAME> and <NAME>
# published by PACKT Publishing
#
# It is made available under the MIT License
import os
from matplotlib import pylab
import numpy as np
import scipy
from scipy.stats import norm, pearsonr
from util... |
recipes/mpark-variant/all/conanfile.py | rockandsalt/conan-center-index | 562 | 11196544 | <gh_stars>100-1000
from conans import ConanFile, tools
import os
class VariantConan(ConanFile):
name = "mpark-variant"
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://github.com/mpark/variant"
description = "C++17 std::variant for C++11/14/17"
license = "BSL-1.0"
top... |
lib/codereview/codereview.py | hongwozai/go-src-1.4.3 | 152 | 11196573 | <gh_stars>100-1000
# coding=utf-8
# (The line above is necessary so that I can use 世界 in the
# *comment* below without Python getting all bent out of shape.)
# Copyright 2007-2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the L... |
moto/organizations/urls.py | gtourkas/moto | 5,460 | 11196575 | from .responses import OrganizationsResponse
url_bases = [r"https?://organizations\.(.+)\.amazonaws\.com"]
url_paths = {"{0}/$": OrganizationsResponse.dispatch}
|
unit6/spiders/p5_downloader_middleware_handson/p5_downloader_middleware_handson/middlewares.py | nulearn3296/scrapy-training | 182 | 11196580 | <gh_stars>100-1000
from scrapy import signals
from scrapy.http import HtmlResponse
from scrapy.exceptions import NotConfigured
from selenium import webdriver
class SeleniumDownloaderMiddleware(object):
def __init__(self):
self.driver = webdriver.PhantomJS()
@classmethod
def from_crawler(cls, cra... |
fawkes/utils.py | rohankumardubey/fawkes | 4,667 | 11196583 | <gh_stars>1000+
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Date : 2020-05-17
# @Author : <NAME> (<EMAIL>)
# @Link : https://www.shawnshan.com/
import errno
import glob
import gzip
import hashlib
import json
import os
import pickle
import random
import shutil
import sys
import tarfile
import zipfile
impo... |
src/tests/helpers/test_i18n.py | fabm3n/pretix | 1,248 | 11196586 | #
# This file is part of pretix (Community Edition).
#
# Copyright (C) 2014-2020 <NAME> and contributors
# Copyright (C) 2020-2021 rami.io GmbH and contributors
#
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General
# Public License as published by the Free... |
tests/integration/by_text_test.py | pupsikpic/selene | 572 | 11196608 | # MIT License
#
# Copyright (c) 2015-2021 <NAME>
#
# 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 without limitation the rights
# to use, copy, modify, merge, ... |
modules/dbnd/src/dbnd/_core/tracking/python_tracking.py | busunkim96/dbnd | 224 | 11196610 | import logging
import sys
from types import FunctionType, ModuleType
from dbnd import task
from dbnd._core.tracking.no_tracking import should_not_track
logger = logging.getLogger(__name__)
def _is_function(obj):
return isinstance(obj, FunctionType)
def _is_task(obj):
"""
checks if obj is decorated f... |
lib/__init__.py | hadisfr/ExportHTML | 118 | 11196616 | """ExportHtml Lib."""
|
qiskit/chemistry/core/chemistry_operator.py | stefan-woerner/aqua | 504 | 11196622 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2018, 2020
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivati... |
test/test_date.py | timgates42/uliweb | 202 | 11196667 | from uliweb.utils import date
from datetime import datetime
def test():
"""
>>> date.get_timezones().keys()
['GMT -12', 'GMT -11', 'GMT -10', 'GMT -9', 'GMT -8', 'GMT -7', 'GMT -6', 'GMT -5', 'GMT -4', 'GMT -3', 'GMT -2', 'GMT -1', 'GMT +1', 'GMT +2', 'GMT +3', 'GMT +4', 'GMT +5', 'GMT +6', 'GMT +7', 'GMT ... |
Clients/ParaView/Testing/Python/TestPythonMPI.py | xj361685640/ParaView | 815 | 11196677 | #/usr/bin/env python
# Global python import
import exceptions, logging, random, sys, threading, time, os
# Update python path to have ParaView libs
build_path='/Volumes/SebKitSSD/Kitware/code/ParaView/build-ninja'
sys.path.append('%s/lib'%build_path)
sys.path.append('%s/lib/site-packages'%build_path)
# iPython impor... |
src/networkx/classes/graphviews.py | MarletteFunding/aws-kube-codesuite | 184 | 11196695 | <gh_stars>100-1000
# Copyright (C) 2004-2017 by
# <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# All rights reserved.
# BSD license.
#
# Author: <NAME> (<EMAIL>),
# <NAME> (<EMAIL>),
# <NAME>(<EMAIL>)
"""View of Graphs as SubGraph, Reverse, Directed, Undirected.
In some a... |
tests/sites_framework/models.py | JBKahn/django | 5,079 | 11196709 | from django.contrib.sites.managers import CurrentSiteManager
from django.contrib.sites.models import Site
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
@python_2_unicode_compatible
class AbstractArticle(models.Model):
title = models.CharField(max_length=50)
object... |
tests/test_vector/test_polygon.py | rbavery/solaris | 367 | 11196716 | <reponame>rbavery/solaris
import os
import pandas as pd
from affine import Affine
from shapely.geometry import Polygon
from shapely.wkt import loads, dumps
import geopandas as gpd
import rasterio
from solaris.data import data_dir
from solaris.vector.polygon import convert_poly_coords, \
affine_transform_gdf, georeg... |
tests/test_credentials.py | al3pht/cloud-custodian | 2,415 | 11196767 | <filename>tests/test_credentials.py
# Copyright The Cloud Custodian Authors.
# SPDX-License-Identifier: Apache-2.0
import os
from botocore.exceptions import ClientError
import placebo
from c7n import credentials
from c7n.credentials import SessionFactory, assumed_session, get_sts_client
from c7n.version import version... |
douban_movie/douban_movie/middlewares.py | FrozenmChen/yyy | 551 | 11196768 | <reponame>FrozenmChen/yyy
# -*- coding: utf-8 -*-
# Define here the models for your spider middleware
#
# See documentation in:
# http://doc.scrapy.org/en/latest/topics/spider-middleware.html
from scrapy import signals
from selenium import webdriver
from scrapy.http import HtmlResponse
from lxml import etree
import ... |
packages/pyright-internal/src/tests/samples/match9.py | Jasha10/pyright | 3,934 | 11196784 | <reponame>Jasha10/pyright<gh_stars>1000+
# This sample tests class-based pattern matching when the class is
# marked final and can be discriminated based on the argument patterns.
from typing import final
class A:
title: str
class B:
name: str
class C:
name: str
def func1(r: A | B | C):
match r:
... |
docx/oxml/coreprops.py | revvsales/python-docx-1 | 3,031 | 11196786 | <filename>docx/oxml/coreprops.py
# encoding: utf-8
"""Custom element classes for core properties-related XML elements"""
from __future__ import (
absolute_import, division, print_function, unicode_literals
)
import re
from datetime import datetime, timedelta
from docx.compat import is_string
from docx.oxml imp... |
vunit/vhdl/logging/run.py | eataesierp/vunit | 507 | 11196797 | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Copyright (c) 2014-2021, <NAME> <EMAIL>
from os import getenv
import glob
from pathlib import Path
from vunit import... |
examples/pipeline_tune.py | rozlana-g/FEDOT | 358 | 11196836 | import numpy as np
from sklearn.metrics import roc_auc_score as roc_auc
from cases.data.data_utils import get_scoring_case_data_paths
from fedot.core.data.data import InputData
from fedot.core.pipelines.node import PrimaryNode, SecondaryNode
from fedot.core.pipelines.pipeline import Pipeline
from fedot.core.pipelines.... |
kashgari/callbacks/__init__.py | SharpKoi/Kashgari | 2,422 | 11196841 | <reponame>SharpKoi/Kashgari
# encoding: utf-8
# author: BrikerMan
# contact: <EMAIL>
# blog: https://eliyar.biz
# file: __init__.py
# time: 8:08 下午
from kashgari.callbacks.eval_callBack import EvalCallBack
if __name__ == "__main__":
pass
|
examples/sort_by_distance.py | codingApprentice/daftlistings | 126 | 11196872 | <filename>examples/sort_by_distance.py
# Search properties according to criteria then sort by nearness to Dublin Castle
from daftlistings import Daft, SearchType
daft = Daft()
daft.set_location("Dublin City")
daft.set_search_type(SearchType.RESIDENTIAL_RENT)
daft.set_min_price(1000)
daft.set_max_price(1500)
listings... |
static/scripts/setLogLevel.py | imShakil/community-edition-setup | 178 | 11196887 | #!/usr/bin/python
import getopt, sys, os, string, json, base64, sys, os.path
from ldif import LDIFParser
from getpass import getpass
ldapsearch_cmd = "/opt/opendj/bin/ldapsearch"
ldapmodify_cmd = "/opt/opendj/bin/ldapmodify"
fn_search = "config-search.ldif"
fn_mod = "config-mod.ldif"
network_args = "-h localhost -p... |
thirdparty/pymdownx/keys.py | goodboyl/- | 182 | 11196893 | <reponame>goodboyl/-
"""
Keys.
pymdownx.keys
Markdown extension for keystroke (user keyboard input) formatting.
It wraps the syntax `++key+key+key++` (for individual keystrokes with modifiers)
or `++"string"++` (for continuous keyboard input) into HTML `<kbd>` elements.
If a key is found in the extension's database,... |
qutip/tests/test_brmesolve.py | camponogaraviera/qutip | 1,205 | 11196910 | <reponame>camponogaraviera/qutip<filename>qutip/tests/test_brmesolve.py
import numpy as np
import pytest
import qutip
def pauli_spin_operators():
return [qutip.sigmax(), qutip.sigmay(), qutip.sigmaz()]
_simple_qubit_gamma = 0.25
_m_c_op = np.sqrt(_simple_qubit_gamma) * qutip.sigmam()
_z_c_op = np.sqrt(_simple_q... |
labs/02_backprop/solutions/worst_predictions.py | soufiomario/labs-Deep-learning | 1,398 | 11196922 | <gh_stars>1000+
test_losses = -np.sum(np.log(EPSILON + model.forward(X_test))
* one_hot(10, y_test), axis=1)
# Sort by ascending loss: best predictions first, worst
# at the end
ranked_by_loss = test_losses.argsort()
# Extract and display the top 5 worst predictions at
# the end:
worst_idx = ran... |
bin/ssa-end-to-end-testing/modules/ssa_utils.py | pageinsec/security_content | 348 | 11196936 | import os
import json
import hashlib
#import urllib.request
from requests import get
import re
import logging
from modules.testing_utils import log
SSML_CWD = ".humvee"
HUMVEE_ARTIFACT_SEARCH = "https://repo.splunk.com/artifactory/api/search/artifact?name=humvee&repos=maven-splunk-local"
def get_latest_humvee_object... |
src/samples/wx/hello_wx.py | risa2000/pyopenvr | 204 | 11196938 | #!/bin/env python
# file hello_wx.py
from openvr.gl_renderer import OpenVrGlRenderer
from openvr.color_cube_actor import ColorCubeActor
from openvr.glframework.wx_app import WxApp
"""
Minimal wxPython programming example which colored OpenGL cube scene that can be closed by pressing ESCAPE.
"""
if __name__ == "__... |
tapas/utils/table_pruning.py | apurvak/tapas | 816 | 11196950 | <filename>tapas/utils/table_pruning.py<gh_stars>100-1000
# coding=utf-8
# Copyright 2019 The Google AI Language Team 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://ww... |
ufora/distributed/S3/ActualS3Interface.py | ufora/ufora | 571 | 11196970 | <filename>ufora/distributed/S3/ActualS3Interface.py<gh_stars>100-1000
# Copyright 2015 Ufora 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/licen... |
var/spack/repos/builtin/packages/xtrans/package.py | LiamBindle/spack | 2,360 | 11196980 | <gh_stars>1000+
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Xtrans(AutotoolsPackage, XorgPackage):
"""xtrans is a library of code that... |
examples/oneshot.py | wcastello/splunk-sdk-python | 495 | 11196983 | #!/usr/bin/env python
#
# Copyright 2011-2015 Splunk, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"): you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... |
sparklingpandas/utils.py | michalmonselise/sparklingpandas | 245 | 11197002 | """
Simple common utils shared between the sparklingpandas modules
"""
import sys
import os
import logging
from glob import glob
def add_pyspark_path():
"""Add PySpark to the library path based on the value of SPARK_HOME. """
try:
spark_home = os.environ['SPARK_HOME']
sys.path.append(os.pat... |
tutorials/W1D3_MultiLayerPerceptrons/solutions/W1D3_Tutorial1_Solution_51988471.py | amita-kapoor/course-content-dl | 473 | 11197024 | <filename>tutorials/W1D3_MultiLayerPerceptrons/solutions/W1D3_Tutorial1_Solution_51988471.py
"""
Nope, since we did not use any layers that have different behaviours during test and train.
But these layers are very common so it's a good practice to always do it!
"""; |
envs/video_wrapper.py | tomasruizt/dads | 141 | 11197039 | # 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, ... |
tests/framework/cli/hooks/test_manager.py | daniel-falk/kedro | 2,047 | 11197067 | import pytest
from kedro.framework.cli.hooks.manager import CLIHooksManager
from kedro.framework.cli.hooks.specs import CLICommandSpecs
@pytest.mark.parametrize(
"hook_specs,hook_name,hook_params",
[(CLICommandSpecs, "before_command_run", ("project_metadata", "command_args"))],
)
def test_hook_manager_can_ca... |
tests/template_tests/filter_tests/test_addslashes.py | Fak3/django | 5,079 | 11197081 | <gh_stars>1000+
from django.template.defaultfilters import addslashes
from django.test import SimpleTestCase
from django.utils.safestring import mark_safe
from ..utils import setup
class AddslashesTests(SimpleTestCase):
@setup({'addslashes01': '{% autoescape off %}{{ a|addslashes }} {{ b|addslashes }}{% endauto... |
llvm/bindings/python/llvm/common.py | medismailben/llvm-project | 2,338 | 11197084 | <gh_stars>1000+
#===- common.py - Python LLVM Bindings -----------------------*- python -*--===#
#
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
#===-----------------... |
libraries/botframework-connector/botframework/connector/auth/channel_provider.py | Fl4v/botbuilder-python | 388 | 11197101 | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
from abc import ABC, abstractmethod
class ChannelProvider(ABC):
"""
ChannelProvider interface. This interface allows Bots to provide their own
implementation for the configuration parameters to connect to a Bot.... |
traces/belgium/plot_log_bandwidth.py | matvaibhav/pensieve | 462 | 11197117 | import numpy as np
import matplotlib.pyplot as plt
PACKET_SIZE = 1500.0 # bytes
TIME_INTERVAL = 5.0
BITS_IN_BYTE = 8.0
MBITS_IN_BITS = 1000000.0
MILLISECONDS_IN_SECONDS = 1000.0
N = 100
LINK_FILE = './logs/report_bus_0010.log'
time_ms = []
bytes_recv = []
recv_time = []
with open(LINK_FILE, 'rb') as f:
for line i... |
facedancer/backends/greatdancer.py | hugmyndakassi/Facedancer | 345 | 11197119 | <reponame>hugmyndakassi/Facedancer<filename>facedancer/backends/greatdancer.py
# GreatDancerApp.py
import sys
import time
import codecs
import logging
import traceback
from ..core import *
from ..USB import *
from ..USBEndpoint import USBEndpoint
# FIXME: abstract this to the logging library
LOGLEVEL_TRACE = 5
clas... |
src/examples/pin/count_inst.py | patacca/Triton | 2,337 | 11197123 | #!/usr/bin/env python2
## -*- coding: utf-8 -*-
from pintool import *
from triton import ARCH
count = 0
def mycb(inst):
global count
count += 1
def fini():
print("Instruction count : ", count)
if __name__ == '__main__':
ctx = getTritonContext()
ctx.enableSymbolicEngine(False)
ctx.enableTai... |
tests/test_remote_metadata.py | pmav99/OWSLib | 218 | 11197135 | <reponame>pmav99/OWSLib
import pytest
import owslib
from owslib.etree import etree
from owslib.wfs import WebFeatureService
from owslib.wms import WebMapService
from tests.utils import service_ok
WMS_SERVICE_URL = 'https://www.dov.vlaanderen.be/geoserver/gw_meetnetten/' \
'wms?request=GetCapabiliti... |
torchreid/components/dropout.py | Danish-VSL/deep-person-reid | 244 | 11197151 | import os
from torch.nn import functional as F
from torch import nn
class SimpleDropoutOptimizer(nn.Module):
def __init__(self, p):
super().__init__()
if p is not None:
self.dropout = nn.Dropout(p=p)
else:
self.dropout = None
def forward(self, x):
if... |
chapter11/dags/02_dag_factory.py | add54/Data_PipeLine_Apache_Airflow | 303 | 11197153 | import os
import airflow.utils.dates
from airflow import DAG
from airflow.operators.bash import BashOperator
def generate_dag(dataset_name, raw_dir, processed_dir, preprocess_script):
with DAG(
dag_id=f"02_dag_factory_{dataset_name}",
start_date=airflow.utils.dates.days_ago(5),
schedule_... |
apps/dash-vtk-explorer/explorer.py | JeroenvdSande/dash-sample-apps | 2,332 | 11197158 | <reponame>JeroenvdSande/dash-sample-apps
from importlib import import_module
from inspect import getsource
from copy import deepcopy
import json
import os
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output, State
import dash_bootstrap_componen... |
python/ray/autoscaler/_private/docker.py | jamesliu/ray | 21,382 | 11197162 | from pathlib import Path
from typing import Any, Dict
try: # py3
from shlex import quote
except ImportError: # py2
from pipes import quote
from ray.autoscaler._private.cli_logger import cli_logger
def _check_docker_file_mounts(file_mounts: Dict[str, str]) -> None:
"""Checks if files are passed as file_... |
plugins/lookup/php_packages.py | manala/ansible-roles | 138 | 11197178 | <reponame>manala/ansible-roles
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
DOCUMENTATION = '''
name: php_packages
author: Manala (@manala)
short_description: returns a curated packages list
description:
- Takes an packages list and returns it curated.
'... |
api/src/opentrons/protocol_engine/state/configs.py | mrod0101/opentrons | 235 | 11197212 | <gh_stars>100-1000
"""Configurations for the Engine."""
from dataclasses import dataclass
@dataclass(frozen=True)
class EngineConfigs:
"""Configurations for Protocol Engine."""
ignore_pause: bool = False
|
python-modules/twisted/twisted/conch/test/test_checkers.py | stormtheh4ck3r/python-for-android | 267 | 11197214 | <reponame>stormtheh4ck3r/python-for-android<filename>python-modules/twisted/twisted/conch/test/test_checkers.py
# Copyright (c) 2001-2010 Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Tests for L{twisted.conch.checkers}.
"""
try:
import pwd
except ImportError:
pwd = None
import os, base64
from... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.