max_stars_repo_path string | max_stars_repo_name string | max_stars_count int64 | id string | content string | add_param_types int64 | add_return_types int64 | add_class_field_types int64 | add_instance_field_types int64 | add_total int64 | add_error int64 |
|---|---|---|---|---|---|---|---|---|---|---|
sorts/exchange_sort.py | NavpreetDevpuri/Python | 145,614 | 1617330 | def exchange_sort(numbers: list[int]) -> list[int]:
"""
Uses exchange sort to sort a list of numbers.
Source: https://en.wikipedia.org/wiki/Sorting_algorithm#Exchange_sort
>>> exchange_sort([5, 4, 3, 2, 1])
[1, 2, 3, 4, 5]
>>> exchange_sort([-1, -2, -3])
[-3, -2, -1]
>>> exchange_sort([1... | 1 | 1 | 0 | 0 | 2 | 0 |
moses/baselines/ngram.py | jiahuei/moses | 585 | 1617335 | from __future__ import annotations
import pickle
import numpy as np
from tqdm.auto import tqdm
import moses
from moses import CharVocab
class NGram:
def __init__(self, max_context_len: int=10, verbose: bool=False):
self.max_context_len = max_context_len
self._dict: dict[object,object] = dict()
... | 16 | 5 | 0 | 4 | 25 | 0 |
cmsplugin_cascade/bootstrap4/container.py | teklager/djangocms-cascade | 139 | 1617336 | from __future__ import annotations
from django.core.exceptions import ValidationError
from django.db.models import Q
from django.forms import widgets
from django.forms.fields import BooleanField, ChoiceField, MultipleChoiceField
from django.utils.safestring import mark_safe
from django.utils.text import format_lazy
fro... | 1 | 12 | 16 | 0 | 29 | 0 |
pyannote/metrics/errors/segmentation.py | hadware/pyannote-metrics | 137 | 1617357 | <gh_stars>100-1000
#!/usr/bin/env python
# encoding: utf-8
# The MIT License (MIT)
# Copyright (c) 2012-2017 CNRS
# 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, inclu... | 0 | 0 | 0 | 0 | 0 | 0 |
koku/api/organizations/aws/provider_map.py | rubik-ai/koku | 157 | 1617369 | #
# Copyright 2021 Red Hat Inc.
# SPDX-License-Identifier: Apache-2.0
#
"""AWS Org Unit Provider Map."""
from api.models import Provider
from api.report.provider_map import ProviderMap
from reporting.provider.aws.models import AWSOrganizationalUnit
class AWSOrgProviderMap(ProviderMap):
"""AWS Provider Map."""
... | 0 | 0 | 0 | 2 | 2 | 0 |
examples/blueprints/blueprints/core/views.py | admiralobvious/flask-simpleldap | 149 | 1617381 | <gh_stars>100-1000
from flask import Blueprint, g, request, session, redirect, url_for
from ..extensions import ldap
core = Blueprint("core", __name__)
@core.route("/")
@ldap.login_required
def index():
return "Successfully logged in!"
@core.route("/login", methods=["GET", "POST"])
def login():
if g.user:
... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/python/interpreter/interpreter.py | willsalz/example-bazel-monorepo | 212 | 1617384 | import code
# https://docs.python.org/3/library/code.html
code.interact(local=locals())
| 0 | 0 | 0 | 0 | 0 | 0 |
pogo/custom_exceptions.py | josenavarro-famoco/flask-pg | 183 | 1617391 | class GeneralPogoException(Exception):
"""Throw an exception that moves up to the start, and reboots"""
| 0 | 0 | 0 | 0 | 0 | 0 |
vespene/models/project.py | Conan-Kudo/vespene | 680 | 1617432 | # Copyright 2018, <NAME> LLC
# License: Apache License Version 2.0
#---------------------------------------------------------------------------
# project.py - model & behavior for projects, which involve a build
# script and sometimes a source code repo. Instances of projects
# building are ... builds. See build.py... | 1 | 7 | 2 | 0 | 10 | 0 |
api/client/src/pcluster_client/models/__init__.py | Chen188/aws-parallelcluster | 415 | 1617463 | <filename>api/client/src/pcluster_client/models/__init__.py
# flake8: noqa
# import all models into this package
# if you have many models here with many references from one model to another this may
# raise a RecursionError
# to avoid this, import only the models that you directly need like:
# from from pcluster_clie... | 0 | 0 | 0 | 0 | 0 | 0 |
armi/nuclearDataIO/ripl.py | keckler/armi | 162 | 1617475 | # Copyright 2019 TerraPower, 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 writi... | 2 | 2 | 0 | 0 | 4 | 0 |
models/nets/cpm_hand.py | Aniket1998Agrawal/robotic-palm | 828 | 1617494 | import tensorflow as tf
import pickle
from models.nets.CPM import CPM
class CPM_Model(CPM):
def __init__(self, input_size, heatmap_size, stages, joints, img_type: str='RGB', is_training: bool=True):
self.stages = stages
self.stage_heatmap: list[object] = []
self.stage_loss = [0 for _ in ra... | 4 | 0 | 0 | 9 | 13 | 0 |
cornac/models/global_avg/recom_global_avg.py | carmanzhang/cornac | 597 | 1617498 | <filename>cornac/models/global_avg/recom_global_avg.py
# Copyright 2018 The Cornac 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/... | 0 | 0 | 0 | 0 | 0 | 0 |
rlgraph/tests/agent_learning/long_tasks/test_impala_agent_long_task_learning.py | RLGraph/RLGraph | 290 | 1617530 | # Copyright 2018/2019 The RLgraph 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... | 0 | 1 | 0 | 0 | 1 | 0 |
demo/2D/lid_driven_cavity_2.py | bgraille/pylbm | 106 | 1617557 | # Authors:
# <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
#
# License: BSD 3 clause
from __future__ import annotations
"""
Simulate the lid driven cavity
dt rho + dx qx + dy qy = 0
dt qx + dx (qx^2/rho + c^2 rho) + dy (qx*qy/rho) = 0
dt qy + dx (qx*qy/rho) + dy (qy^2/rho + c^2 rho) = 0
"""
import numpy as np
import s... | 4 | 4 | 0 | 0 | 8 | 0 |
gerapy/server/core/response.py | hantmac/Gerapy | 2,888 | 1617603 | from __future__ import annotations
import json
from django.http import HttpResponse
from gerapy.server.core.encoder import JSONEncoder
class JsonResponse(HttpResponse):
"""
An HTTP response class that consumes data to be serialized to JSON.
:param data: Data to be dumped into json. By default only ``di... | 2 | 0 | 0 | 0 | 2 | 0 |
app/modules/ocr_utils/__init__.py | jasalt/kuittiskanneri | 131 | 1617610 | # This file is used to tell Python to use this folder as a module.
| 0 | 0 | 0 | 0 | 0 | 0 |
qt__pyqt__pyside__pyqode/pyqt5__QWebEnginePage__Client_async__multiprocessing__process.py | DazEB2/SimplePyScripts | 117 | 1617623 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
from PyQt5.QtWidgets import QApplication
from PyQt5.QtCore import QUrl
from PyQt5.QtWebEngineWidgets import QWebEnginePage
class Client(QWebEnginePage):
def __init__(self, urls):
self.app = QApplication([])
super().__init__... | 0 | 1 | 0 | 1 | 2 | 0 |
lfs/criteria/settings.py | michael-hahn/django-lfs | 345 | 1617648 | from django.utils.translation import ugettext_lazy as _
EQUAL = 0
LESS_THAN = 1
LESS_THAN_EQUAL = 2
GREATER_THAN = 3
GREATER_THAN_EQUAL = 4
CONTAIN = 5
IS = 10
IS_NOT = 11
IS_VALID = 12
IS_NOT_VALID = 13
NUMBER_OPERATORS = (
(EQUAL, _(u"Equal to")),
(LESS_THAN, _(u"Less than")),
(LESS_THAN_EQUAL, _(u"Les... | 0 | 0 | 0 | 0 | 0 | 0 |
external/anomaly/ote_anomalib/data/mvtec.py | opencv/openvino_training_extensions | 775 | 1617672 | """OTE MVTec Dataset facilitate OTE Anomaly Training.
License:
MVTec AD dataset is released under the Creative Commons
Attribution-NonCommercial-ShareAlike 4.0 International License
(CC BY-NC-SA 4.0)(https://creativecommons.org/licenses/by-nc-sa/4.0/).
Reference:
- <NAME>, <NAME>, <NAME>, <NAME>, <NAM... | 5 | 2 | 1 | 1 | 9 | 0 |
pybrain/rl/environments/classic/xor.py | sveilleux1/pybrain | 2,208 | 1617683 | __author__ = '<NAME>, <EMAIL>'
from pybrain.rl.environments.episodic import EpisodicTask
from scipy import array
from random import randint, random
class XORTask(EpisodicTask):
""" Continuous task, producing binary observations, taking a single, binary action
rewarding the agent whenever action = xor(obs).
... | 0 | 4 | 6 | 4 | 14 | 0 |
LastFM_util_functions.py | cyrilli/BanditLib | 280 | 1617684 | import pickle # Save model
#import matplotlib.pyplot as plt
import re # regular expression library
from random import random, choice # for random strategy
from operator import itemgetter
import numpy as np
from scipy.sparse import csgraph
from scipy.spatial import distance
from sklearn.cluster import KMeans
from s... | 0 | 0 | 0 | 0 | 0 | 0 |
akshare/bond/bond_summary.py | NovelResearchInvestment/akshare | 721 | 1617698 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
"""
Date: 2022/3/5 12:55
Desc: 上登债券信息网-债券成交概览
http://bond.sse.com.cn/data/statistics/overview/turnover/
"""
from io import BytesIO
import pandas as pd
import requests
def bond_cash_summary_sse(date: str = '20210111') -> pd.DataFrame:
"""
上登债券信息网-市场数据-市场统计-市场概览-债券现... | 2 | 2 | 0 | 0 | 4 | 0 |
tools/accuracy_checker/openvino/tools/accuracy_checker/representation/style_transfer.py | TolyaTalamanov/open_model_zoo | 2,201 | 1617716 | """
Copyright (c) 2018-2022 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 agreed to in wri... | 0 | 2 | 3 | 1 | 6 | 0 |
autoPyTorch/components/networks/image/resnet.py | mens-artis/Auto-PyTorch | 1,657 | 1617718 | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import ConfigSpace
from autoPyTorch.components.networks.base_net import BaseImageNet
from autoPyTorch.utils.config_space_hyperparameter import add_hyperparameter, get_hyperparameter
from autoPyTorch.comp... | 6 | 6 | 0 | 4 | 16 | 0 |
GateOne/terminal.py | Wramberg/SublimeTextTerminalView | 948 | 1617741 | # -*- coding: utf-8 -*-
#
# Copyright 2011 Liftoff Software Corporation
#
# Meta
__version__ = '1.1'
__version_info__ = (1, 1)
__license__ = "AGPLv3 or Proprietary (see LICENSE.txt)"
__author__ = '<NAME> <<EMAIL>>'
__doc__ = """\
About This Module
=================
This crux of this module is the Terminal class... | 0 | 0 | 0 | 0 | 0 | 0 |
python/paddle/fluid/tests/unittests/mkldnn/test_sum_bf16_mkldnn_op.py | zmxdream/Paddle | 17,085 | 1617743 | <gh_stars>1000+
# Copyright (c) 2020 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 r... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/unit/resources/settings/test_scopes.py | doziya/hpeOneView | 107 | 1617746 | <filename>tests/unit/resources/settings/test_scopes.py<gh_stars>100-1000
# -*- coding: utf-8 -*-
###
# (C) Copyright (2012-2017) Hewlett Packard Enterprise Development LP
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the 'Software... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/webots/controllers/scenic_intersection_supervisor/scenic_intersection_supervisor.py | BehaviorPredictionTestingPlatform/VerifAI | 109 | 1617768 | from verifai.simulators.webots.webots_task import webots_task
from verifai.simulators.webots.client_webots import ClientWebots
from math import sin
from math import cos
import numpy as np
from math import atan2
from collections import namedtuple
import os
from dotmap import DotMap
import pickle
from shapely.geometry im... | 0 | 4 | 0 | 0 | 4 | 0 |
medusa/storage/google_cloud_storage/gsutil.py | emerkle826/cassandra-medusa | 187 | 1617784 | <reponame>emerkle826/cassandra-medusa<filename>medusa/storage/google_cloud_storage/gsutil.py
# -*- coding: utf-8 -*-
# Copyright 2018 Spotify AB
#
# 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 a... | 0 | 0 | 0 | 0 | 0 | 0 |
glazier/lib/config/runner.py | ItsMattL/glazier | 1,233 | 1617802 | <filename>glazier/lib/config/runner.py
# Copyright 2016 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
#
# ... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/grit/grit/tool/xmb_unittest.py | zealoussnow/chromium | 14,668 | 1617807 | <gh_stars>1000+
#!/usr/bin/env python3
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
'''Unit tests for 'grit xmb' tool.'''
from __future__ import print_function
import io
import os
import sys
if __... | 0 | 0 | 0 | 0 | 0 | 0 |
var/spack/repos/builtin/packages/tree-sitter/package.py | BenWibking/spack | 2,360 | 1617814 | <reponame>BenWibking/spack
# 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 TreeSitter(MakefilePackage):
"""Tree-sitter is a parser genera... | 0 | 0 | 0 | 0 | 0 | 0 |
venv/Lib/site-packages/seaborn/widgets.py | EkremBayar/bayar | 8,852 | 1617818 | import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import LinearSegmentedColormap
# Lots of different places that widgets could come from...
try:
from ipywidgets import interact, FloatSlider, IntSlider
except ImportError:
import warnings
# ignore ShimWarning raised by IPython, see GH... | 37 | 6 | 0 | 0 | 43 | 0 |
www/tests/test_browser_html.py | ranjian0/brython | 5,926 | 1617850 | <filename>www/tests/test_browser_html.py
import browser.html as html
assert html.H2 is html.tags['H2']
class MyH1:
pass
html.tags['H1'] = MyH1
assert html.tags['H1'] == html.H1
assert html.tags == html.tags
nb = len(html.tags)
html.tags['GGHHJJ'] = 77
assert len(html.tags) == nb + 1
assert(len(html.tags.items... | 0 | 0 | 0 | 0 | 0 | 0 |
dense_coattn/modules/dense_coattn.py | cvlab-tohoku/Dense-Co-Attention-Network-for-Visual-Question-Answering | 110 | 1617856 |
from __future__ import annotations
import torch
import torch.nn as nn
import torch.nn.functional as F
from .attention_fn import qkv_attention
class DenseCoAttn(nn.Module):
def __init__(self, dim1, dim2, num_attn, num_none, dropout, is_multi_head: bool=False):
super(DenseCoAttn, self).__init__()
dim = min(dim1... | 3 | 1 | 0 | 1 | 5 | 0 |
cli/adaptdl_cli/pvc.py | jessezbj/adaptdl | 294 | 1617857 | # Copyright 2020 Petuum, 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... | 5 | 3 | 0 | 0 | 8 | 0 |
Lib/idlelib/idle_test/test_searchengine.py | inging44/python3 | 1,872 | 1617861 | '''Test functions and SearchEngine class in SearchEngine.py.'''
# With mock replacements, the module does not use any gui widgets.
# The use of tk.Text is avoided (for now, until mock Text is improved)
# by patching instances with an index function returning what is needed.
# This works because mock Text.get does not ... | 1 | 8 | 0 | 0 | 9 | 0 |
test-framework/test-suites/integration/tests/ansible/test_stacki_box.py | sammeidinger/stack | 123 | 1617874 | <filename>test-framework/test-suites/integration/tests/ansible/test_stacki_box.py<gh_stars>100-1000
import json
class TestStackiBox:
def test_add_box(self, host, host_os, run_ansible_module):
# Add the box
result = run_ansible_module("stacki_box", name="test")
assert result.status == "CHANGED"
assert result... | 0 | 0 | 0 | 0 | 0 | 0 |
models/mli/model_decision_tree_linear_combo.py | pragnesh-ai/driverlessai-recipes | 194 | 1617881 | <filename>models/mli/model_decision_tree_linear_combo.py
"""Decision tree plus linear model"""
import uuid
import os
import datatable as dt
import numpy as np
from h2oaicore.models import CustomModel
from sklearn.preprocessing import LabelEncoder
from h2oaicore.systemutils import physical_cores_count
from h2oaicore.sy... | 0 | 0 | 0 | 0 | 0 | 0 |
paperwhisperer/retrieval/arxivretriever.py | rishabkoul/paperwhisperer | 120 | 1617899 | <reponame>rishabkoul/paperwhisperer
from arxiv import Search, SortCriterion
from paperwhisperer.retrieval.article import Article
from paperwhisperer.retrieval.searchresults import SearchResults
class ArxivRetriever:
"""ArxivRetriever is responsible to place a call to the arxiv API and
retrieve articles' meta... | 0 | 0 | 0 | 0 | 0 | 0 |
ants/registration/reflect_image.py | xemio/ANTsPy | 338 | 1617903 | <filename>ants/registration/reflect_image.py
__all__ = ['reflect_image']
from tempfile import mktemp
from .. import utils
from .interface import registration
from .apply_transforms import apply_transforms
def reflect_image(image, axis=None, tx=None, metric='mattes'):
"""
Reflect an image along an axis
... | 0 | 0 | 0 | 0 | 0 | 0 |
infinite_nature/geometry.py | DionysisChristopoulos/google-research | 23,901 | 1617911 | <gh_stars>1000+
# coding=utf-8
# Copyright 2021 The Google Research 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 requ... | 0 | 0 | 0 | 0 | 0 | 0 |
control_and_ai/DDPG/train_third_model_unnormalized.py | julianxu/Rockets | 275 | 1617931 | <gh_stars>100-1000
"""
Author: <NAME>
Date: 10/05/2017
Description: Train DDPG network in a different way.
"""
import sys
import os
import shutil
import argparse
sys.path.append('C://Users//REUBS_LEN//PycharmProjects//RocketLanding')
from environments.rocketlander import get_state_sample
from constants import *
from... | 0 | 0 | 0 | 0 | 0 | 0 |
nuitka/plugins/standard/PkgResourcesPlugin.py | mikehaben69/Nuitka | 5,421 | 1617935 | # Copyright 2021, <NAME>, mailto:<EMAIL>
#
# Part of "Nuitka", an optimizing Python compiler that is compatible and
# integrates with CPython, but also works on its own.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Lice... | 0 | 2 | 2 | 2 | 6 | 0 |
reviews/layout/components.py | adam-tokarski/reviews | 134 | 1617937 | <reponame>adam-tokarski/reviews
from datetime import datetime
from rich.panel import Panel
from rich.table import Table
class Header:
"""Display header with clock."""
def __rich__(self) -> Panel:
grid = Table.grid(expand=True)
grid.add_column(justify="center", ratio=1)
grid.add_colum... | 0 | 0 | 0 | 0 | 0 | 0 |
src/gonsl/api/gonslapi_pb2_grpc.py | RudSmith/beluganos | 119 | 1617943 | <filename>src/gonsl/api/gonslapi_pb2_grpc.py
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc
import gonslapi_pb2 as gonslapi__pb2
class GoNSLApiStub(object):
"""
Service
"""
def __init__(self, channel):
"""Constructor.
Args:
channel: A grpc.Channel.
"""
... | 0 | 0 | 0 | 0 | 0 | 0 |
libreco/algorithms/fm.py | massquantity/LibRecommender | 142 | 1617950 | from __future__ import annotations
"""
References:
[1] <NAME> "Factorization Machines"
(https://www.csie.ntu.edu.tw/~b97053/paper/Rendle2010FM.pdf)
[2] <NAME> et al. "Neural Factorization Machines for Sparse Predictive Analytics"
(https://arxiv.org/pdf/1708.05027.pdf)
author: massquantity
"""... | 29 | 3 | 4 | 0 | 36 | 0 |
tests/test_level4/test_future.py | kianmeng/soupsieve | 130 | 1617967 | """Test future selectors."""
from .. import util
class TestFuture(util.TestCase):
"""Test future selectors."""
MARKUP: str = """
<body>
<div id="div">
<p id="0">Some text <span id="1" class="foo:bar:foobar"> in a paragraph</span>.
<a id="2" class="bar" href="http://google.com">Link</a>
<a... | 0 | 0 | 1 | 0 | 1 | 0 |
applications/FluidDynamicsApplication/tests/embedded_couette_flow_test.py | lkusch/Kratos | 778 | 1617996 | # Import kratos core and applications
import KratosMultiphysics
import KratosMultiphysics.KratosUnittest as KratosUnittest
import KratosMultiphysics.kratos_utilities as KratosUtilities
from KratosMultiphysics.FluidDynamicsApplication.fluid_dynamics_analysis import FluidDynamicsAnalysis
class EmbeddedCouetteTestFluidDy... | 0 | 0 | 0 | 0 | 0 | 0 |
run_event.py | ItGirls/event_extraction | 203 | 1618027 | <gh_stars>100-1000
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' # ERROR
# os.environ["CUDA_VISIBLE_DEVICES"] = "0"
import tensorflow as tf
from argparse import ArgumentParser
from train_helper import run_event_role_mrc, run_event_classification
from train_helper import run_event_binclassification, run_event_ver... | 0 | 0 | 0 | 0 | 0 | 0 |
semisupervised_TU/pre-training/image_dataset.py | baobunuo/GraphCL | 275 | 1618032 | <filename>semisupervised_TU/pre-training/image_dataset.py
import math
import numpy as np
import torch
import torchvision
from torchvision import datasets, transforms
from torch_geometric.data import InMemoryDataset, Data
class ImageDataset(InMemoryDataset):
def __init__(self,
root,
... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/data_download/school_census/create_all_files.py | joelvisroman/dataviva-site | 126 | 1618043 | <gh_stars>100-1000
import os
import commands
import time
import logging
import sys
year_begin = 2007
year_end = 2015
if (len(sys.argv) != 3 and len(sys.argv) != 5) or (sys.argv[1:][0] not in ['pt', 'en']):
print "ERROR! Use:\n python scripts/data_download/school_census/create_files.py en/pt output_path\n"
pri... | 0 | 0 | 0 | 0 | 0 | 0 |
dbaas/api/environment.py | amintasvrp/database-as-a-service | 303 | 1618070 | <filename>dbaas/api/environment.py
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from rest_framework import viewsets, serializers
from physical.models import Environment
class EnvironmentSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Environment... | 0 | 0 | 0 | 0 | 0 | 0 |
第10章/program/homework_boss.py | kingname/SourceCodeOfBook | 274 | 1618092 | from uiautomator import Device
device = Device()
resource_id_dict = {
'salary': 'com.hpbr.bosszhipin:id/tv_position_salary',
'company': 'com.hpbr.bosszhipin:id/tv_company_name',
'address': 'com.hpbr.bosszhipin:id/tv_location',
'experence': 'com.hpbr.bosszhipin:id/tv_work_exp',
'degree': 'com.hpbr.b... | 0 | 1 | 0 | 0 | 1 | 0 |
Configuration/migrations/0013_serviceslog_method_serviceslog_status_and_more.py | b0bac/ApolloScanner | 289 | 1618095 | <reponame>b0bac/ApolloScanner<filename>Configuration/migrations/0013_serviceslog_method_serviceslog_status_and_more.py
# Generated by Django 4.0.1 on 2022-03-10 12:03
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('Configuration', '0012_alter_serviceslo... | 0 | 0 | 0 | 0 | 0 | 0 |
testcontainers-youtube-series/docs/testing_architecture.py | hartraft/blog-tutorials | 505 | 1618097 | from diagrams import Diagram
from diagrams.onprem.client import Users
from diagrams.onprem.container import Docker
from diagrams.programming.framework import Spring
graph_attr = {
"fontsize": "20",
"bgcolor": "white" # transparent
}
with Diagram("", direction="LR", graph_attr=graph_attr, outformat="png", filenam... | 0 | 0 | 0 | 0 | 0 | 0 |
dns/rdtypes/dsbase.py | Chia-Network/dnspython | 1,666 | 1618107 | <reponame>Chia-Network/dnspython<gh_stars>1000+
# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license
# Copyright (C) 2010, 2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose with or without fee is hereby granted,
# provide... | 0 | 0 | 0 | 0 | 0 | 0 |
homeassistant/components/yamaha_musiccast/config_flow.py | MrDelik/core | 22,481 | 1618123 | """Config flow for MusicCast."""
from __future__ import annotations
import logging
from typing import Any
from urllib.parse import urlparse
from aiohttp import ClientConnectorError
from aiomusiccast import MusicCastConnectionException, MusicCastDevice
import voluptuous as vol
from homeassistant import data_entry_flo... | 5 | 5 | 4 | 0 | 14 | 0 |
sdk/customproviders/azure-mgmt-customproviders/azure/mgmt/customproviders/models/_models.py | rsdoherty/azure-sdk-for-python | 2,728 | 1618151 | <reponame>rsdoherty/azure-sdk-for-python<gh_stars>1000+
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated ... | 0 | 0 | 0 | 0 | 0 | 0 |
wsltools/utils/faker/providers/address/en_PH/__init__.py | Symbo1/wsltools | 412 | 1618160 | # -*- coding: UTF-8 -*-
from __future__ import unicode_literals
from collections import OrderedDict
from string import ascii_uppercase
from .. import Provider as AddressProvider
class Provider(AddressProvider):
"""
Provider for addresses for en_PH locale
Like many things in the Philippines, even addres... | 0 | 34 | 19 | 0 | 53 | 0 |
tests/auto/ModelGenericTypes.py | plandes/amrlib | 103 | 1618170 | #!/usr/bin/python3
import sys
sys.path.insert(0, '../..') # make '..' first in the lib search path
import logging
import unittest
import spacy
import amrlib
graph01 = '''
# ::id DF-199-194215-653_0484.1 ::date 2013-08-30T09:02:09 ::annotator SDL-AMR-09 ::preferred
# ::snt I am 24 and a mother of a 2 and a half yea... | 0 | 0 | 0 | 0 | 0 | 0 |
16-coroutine/taxi_sim0.py | matteoshen/example-code | 5,651 | 1618174 | <reponame>matteoshen/example-code<filename>16-coroutine/taxi_sim0.py
"""
Taxi simulator
Sample run with two cars, random seed 10. This is a valid doctest.
>>> main(num_taxis=2, seed=10)
taxi: 0 Event(time=0, proc=0, action='leave garage')
taxi: 0 Event(time=4, proc=0, action='pick up passenger')
ta... | 0 | 0 | 0 | 0 | 0 | 0 |
configs/COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_1x.py | mmabrouk/detectron2 | 21,274 | 1618188 | from ..common.optim import SGD as optimizer
from ..common.coco_schedule import lr_multiplier_1x as lr_multiplier
from ..common.data.coco import dataloader
from ..common.models.mask_rcnn_fpn import model
from ..common.train import train
model.backbone.bottom_up.freeze_at = 2
train.init_checkpoint = "detectron2://ImageN... | 0 | 0 | 0 | 0 | 0 | 0 |
example/middleware.py | Supratix/django-ses | 522 | 1618202 | from django.contrib.auth.models import AnonymousUser
class FakeSuperuserMiddleware(object):
def process_request(self, request):
request.user = AnonymousUser()
request.user.is_superuser = True
| 0 | 0 | 0 | 0 | 0 | 0 |
openbb_terminal/cryptocurrency/overview/loanscan_model.py | tehcoderer/GamestonkTerminal | 255 | 1618206 | """LoanScan Model"""
import argparse
import logging
from typing import Any, Dict
import pandas as pd
import requests
from openbb_terminal.decorators import log_start_end
from openbb_terminal.helper_funcs import get_user_agent, log_and_raise
logger = logging.getLogger(__name__)
api_url = "https://api.loanscan.io"
P... | 1 | 3 | 1 | 0 | 5 | 0 |
certbot-dns-nsone/certbot_dns_nsone/_internal/__init__.py | silverbacknet/certbot | 16,789 | 1618226 | <gh_stars>1000+
"""Internal implementation of `~certbot_dns_nsone.dns_nsone` plugin."""
| 0 | 0 | 0 | 0 | 0 | 0 |
python/ELMo/infer.py | windstamp/Paddle-Inference-Demo | 115 | 1618241 | <gh_stars>100-1000
#coding: utf-8
from __future__ import print_function
import numpy as np
import paddle
import argparse
import reader
import sys
import os
from paddle.inference import Config
from paddle.inference import create_predictor
def parse_args():
"""
Parsing the input parameters.
"""
parser ... | 0 | 0 | 0 | 0 | 0 | 0 |
textworld/generator/tests/test_init.py | JohnnySun8/TextWorld | 307 | 1618243 | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.
import numpy.testing as npt
from textworld.generator import make_world, make_small_map, make_world_with
from textworld.logic import Variable, Proposition
def test_make_world_no_rng():
world = make_world(1)
assert... | 0 | 0 | 0 | 0 | 0 | 0 |
sample_human.py | CGriffoin/holistic_scene_parsing | 209 | 1618247 | """
Created on Nov 4, 2017
@author: <NAME>
Sample Human from the Scene
"""
import config
import os
import pickle
from scipy.io import loadmat
import numpy as np
import matplotlib.pyplot as plt
import visualize
import copy
from camera import rotation_matrix_3d_z, center_to_corners
import random
import sys
from PIL im... | 0 | 0 | 0 | 0 | 0 | 0 |
mocodo/tests/font_metrics_tests.py | JeanHenri79/mocodo | 158 | 1618288 | #!/usr/bin/env python
# encoding: utf-8
from __future__ import division
import sys
sys.path[0:0] = ["."]
import unittest
from mocodo.font_metrics import *
import tkFont
params = {}
params["tkinter"] = True
FontMetrics = font_metrics_factory(params)
helv36 = FontMetrics({"family": "Helvetica", "size": 36})
helv36b ... | 0 | 0 | 0 | 0 | 0 | 0 |
pypykatz/commons/winapi/local/ntdll.py | wisdark/pypykatz | 1,861 | 1618303 | <reponame>wisdark/pypykatz<filename>pypykatz/commons/winapi/local/ntdll.py<gh_stars>1000+
from pypykatz.commons.winapi.local.function_defs.ntdll import RtlAdjustPrivilege
class NTDLL:
def __init__(self):
pass
@staticmethod
def RtlAdjustPrivilege(privilige_id, enable = True, thread_or_process = False):
retur... | 0 | 0 | 0 | 0 | 0 | 0 |
BuildPackages/example/sublime/Packages/PowershellUtils/tests/sublimeplugin.py | cohero/boxstarter | 583 | 1618343 | class Plugin(object):
def onNew(self, view):
pass
def onClone(self, view):
pass
def onLoad(self, view):
pass
def onClose(self, view):
pass
def onPreSave(self, view):
pass
def onPostSave(self, view):
pass
def onModified(self, view):... | 0 | 0 | 0 | 0 | 0 | 0 |
synapse/tests/test_tools_pullfile.py | ackroute/synapse | 216 | 1618381 | import os
import asyncio
import hashlib
import pathlib
import synapse.tests.utils as s_t_utils
import synapse.tools.pullfile as s_pullfile
class TestPullFile(s_t_utils.SynTest):
async def test_pullfile(self):
async with self.getTestAxon() as axon:
axonurl = axon.getLocalUrl()
t... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/external_libs/scapy-2.4.5/scapy/contrib/automotive/enumerator.py | dariusgrassi/trex-core | 250 | 1618389 | # This file is part of Scapy
# See http://www.secdev.org/projects/scapy for more information
# Copyright (C) <NAME> <<EMAIL>>
# This program is published under a GPLv2 license
# scapy.contrib.description = Enumerator and Automotive Scanner Baseclasses
# scapy.contrib.status = loads
from __future__ import annotations
... | 11 | 11 | 3 | 6 | 31 | 0 |
mythril/disassembler/asm.py | kalloc/mythril | 1,887 | 1618391 | from __future__ import annotations
"""This module contains various helper classes and functions to deal with EVM
code disassembly."""
import re
from collections import Generator
from mythril.support.opcodes import opcodes
regex_PUSH = re.compile(r"^PUSH(\d*)$")
# Additional mnemonic to catch failed assertions
opcod... | 9 | 6 | 0 | 0 | 15 | 0 |
changes/lib/coverage.py | vault-the/changes | 443 | 1618400 | <filename>changes/lib/coverage.py
from changes.config import db
from changes.constants import Status
from changes.models.build import Build
from changes.models.filecoverage import FileCoverage
from changes.models.job import Job
from changes.models.project import Project
from changes.models.source import Source
from ty... | 0 | 0 | 0 | 0 | 0 | 0 |
docopt_c.py | ntc490/docopt.c | 204 | 1618411 | <reponame>ntc490/docopt.c
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# Copyright (c) 2012 <NAME>, <<EMAIL>>
# (see LICENSE-MIT file for copying)
"""Usage: docopt_c.py [options] [<docopt>]
Processes a docopt formatted string, from either stdin or a file, and
outputs the equivalent C code to parse a CLI, to either ... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/artifacts/usagestats_pb/rect_pb2.py | deagler4n6/ALEAPP | 187 | 1618442 | <filename>scripts/artifacts/usagestats_pb/rect_pb2.py<gh_stars>100-1000
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: rect.proto
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as... | 0 | 0 | 0 | 0 | 0 | 0 |
goosepaper/weather.py | AdrianForsythe/goosepaper | 178 | 1618447 | import requests
from typing import List
from .util import PlacementPreference
from .storyprovider import StoryProvider
from .story import Story
class WeatherStoryProvider(StoryProvider):
def __init__(self, woe: str = "2358820", F: bool = True):
self.woe = woe
self.F = F
def CtoF(self, temp: ... | 4 | 2 | 0 | 0 | 6 | 0 |
tfjs_graph_converter/util.py | httpsgithu/tfjs-to-tf | 114 | 1618462 | # SPDX-License-Identifier: MIT
# Copyright © 2020 <NAME>
"""Utility functions for working with TensorFlow Graphs"""
from __future__ import absolute_import
from collections import defaultdict, namedtuple
from typing import List, Optional, Union
import numpy as np
import tensorflow as tf
from tensorflow.core.... | 20 | 17 | 2 | 0 | 39 | 0 |
problems/examples/web-exploitation/sql-injection-1/challenge.py | minhnq1618/picoCTF | 280 | 1618470 | import sqlite3
from hacksport.problem import files_from_directory, PHPApp, ProtectedFile
class Problem(PHPApp):
files = files_from_directory("webroot/") + [ProtectedFile("users.db")]
php_root: str = "webroot/"
num_workers: int = 5
def setup(self):
conn = sqlite3.connect("users.db")
c... | 0 | 0 | 2 | 0 | 2 | 0 |
samples/core/resource_spec/resource_spec.py | nostro-im/pipelines | 2,860 | 1618484 | # Copyright 2020-2021 The Kubeflow Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... | 2 | 1 | 0 | 0 | 3 | 0 |
office__excel__openpyxl__xlwt/xlsx__set_row_column_size.py | DazEB2/SimplePyScripts | 117 | 1618508 | <gh_stars>100-1000
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
import openpyxl
def set_row_column_size(ws):
# SOURCE: excel__openpyxl__xlwt\excel\xl\worksheets\sheet1.xml
# <sheetFormatPr defaultColWidth="1.77734375" defaultRowHeight="6.6" customHeight="1" x14ac:dyDescent="0.3"/>... | 0 | 0 | 0 | 0 | 0 | 0 |
pyinstagram/tests/unit/test_entities.py | OlegYurchik/pyInstagram | 152 | 1618531 | from pyinstagram.entities import Account, Comment, Location, Media, Story, Tag
import pytest
from random import randint, choice
from string import ascii_uppercase, ascii_lowercase, digits
def setup_function():
Account.clear_cache()
Comment.clear_cache()
Location.clear_cache()
Media.clear_cache()
S... | 0 | 1 | 0 | 0 | 1 | 0 |
tensorflow/python/eager/lift_to_graph_test.py | abhaikollara/tensorflow | 848 | 1618538 | # Copyright 2019 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... | 0 | 4 | 0 | 0 | 4 | 0 |
deutschland/interpol/models/__init__.py | kiranmusze/deutschland | 445 | 1618562 | # flake8: noqa
# import all models into this package
# if you have many models here with many references from one model to another this may
# raise a RecursionError
# to avoid this, import only the models that you directly need like:
# from from deutschland.interpol.model.pet import Pet
# or import this package, but b... | 0 | 0 | 0 | 0 | 0 | 0 |
demos/common/python/models/yolo.py | AnnaZll/open_model_zoo | 1,031 | 1618579 | from __future__ import annotations
"""
Copyright (C) 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.apache.org/licenses/LICENSE-2.0
Unless required by... | 12 | 12 | 0 | 5 | 29 | 0 |
alipay/aop/api/response/AlipayDataBillAccountbookereceiptQueryResponse.py | antopen/alipay-sdk-python-all | 213 | 1618605 | <filename>alipay/aop/api/response/AlipayDataBillAccountbookereceiptQueryResponse.py<gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
class AlipayDataBillAccountbookereceiptQueryResponse(AlipayResponse):
def __init__(sel... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/client/ssl_connections.py | mnxzyw/vibora | 6,238 | 1618613 | import ssl
import logging
from vibora.tests import TestSuite
from vibora import client
class TestSSLErrors(TestSuite):
def setUp(self):
# Python always warns about SSL errors but since where are forcing them to occur
# there is no reason to fill the testing console with these messages.
lo... | 0 | 0 | 0 | 0 | 0 | 0 |
mpld3/test_plots/test_date_ticks.py | odidev/mpld3 | 1,101 | 1618618 | """
Plot to test custom date axis tick locations and labels
NOTE (@vladh): We may see different behaviour in mpl vs d3 for the y axis, because we never
specified exactly how we want the y axis formatted. This is ok.
"""
from datetime import datetime
import matplotlib.pyplot as plt
import mpld3
def create_plot() -> o... | 0 | 1 | 0 | 0 | 1 | 0 |
Python/PDF_Generator/pdf_generator.py | iamakkkhil/Rotten-Scripts | 1,127 | 1618642 | <filename>Python/PDF_Generator/pdf_generator.py
import os
import img2pdf
from pdf2image import convert_from_path
# *.jpg to output_filename.pdf convertor
with open("output_filename.pdf", "wb") as f:
f.write(img2pdf.convert([i for i in os.listdir(".") if i.endswith(".jpg")]))
# file.pdf to output_images_folder_nam... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_models_masked_multistream.py | kevinmtian/pytorchvideo | 2,391 | 1618645 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import copy
import unittest
import torch
import torch.nn
from pytorchvideo.layers import PositionalEncoding, make_multilayer_perceptron
from pytorchvideo.models.masked_multistream import (
LSTM,
LearnMaskedDefault,
MaskedSequential,
... | 2 | 1 | 0 | 0 | 3 | 0 |
sleekxmpp/plugins/xep_0092/__init__.py | E-Tahta/sleekxmpp | 499 | 1618669 | <gh_stars>100-1000
"""
SleekXMPP: The Sleek XMPP Library
Copyright (C) 2010 <NAME>, <NAME>
This file is part of SleekXMPP.
See the file LICENSE for copying permission.
"""
from sleekxmpp.plugins.base import register_plugin
from sleekxmpp.plugins.xep_0092 import stanza
from sleekxmpp.plugins.xep_0092.... | 0 | 0 | 0 | 0 | 0 | 0 |
utils/bleu.py | luckylsk34/FocusSeq2Seq | 112 | 1618672 | <gh_stars>100-1000
from multiprocessing import Pool
from itertools import chain
from nltk.translate.bleu_score import corpus_bleu, sentence_bleu, SmoothingFunction
import numpy as np
from tqdm import tqdm
cm = SmoothingFunction()
def flatten(list_of_lists):
return list(chain(*list_of_lists))
def get_sent_ble... | 0 | 0 | 0 | 0 | 0 | 0 |
workshop_material/038_sum_cache_simd_examples.py | nrupatunga/pyimageconf2018 | 106 | 1618678 | <filename>workshop_material/038_sum_cache_simd_examples.py
import numpy as np
import sys
sys.path = ['./superfast/build'] + sys.path
import superfast
# To see what this code does you should open ipython and just run these
# commands and time time using %time. Also go into the superfast code and
# uncomment the loop ... | 0 | 0 | 0 | 0 | 0 | 0 |
test/issues/test-issue31.py | edisga/scalene | 3,952 | 1618690 | <filename>test/issues/test-issue31.py
import numpy as np
def main1():
# Before optimization
x = np.array(range(10**7))
y = np.array(np.random.uniform(0, 100, size=10**8))
def main2():
# After optimization, spurious `np.array` removed.
x = np.array(range(10**7))
y = np.random.uniform(0, 100, si... | 0 | 0 | 0 | 0 | 0 | 0 |
src/model/common.py | zzangjinsun/NLSPN_ECCV20 | 181 | 1618709 | """
Non-Local Spatial Propagation Network for Depth Completion
<NAME>, <NAME>, <NAME>, <NAME> and <NAME>
European Conference on Computer Vision (ECCV), Aug 2020
Project Page : https://github.com/zzangjinsun/NLSPN_ECCV20
Author : <NAME> (<EMAIL>)
===============================================... | 11 | 4 | 0 | 0 | 15 | 0 |
tests/providers/amazon/aws/hooks/test_glue_catalog.py | takuti/airflow | 8,092 | 1618724 | <filename>tests/providers/amazon/aws/hooks/test_glue_catalog.py<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 fil... | 0 | 0 | 0 | 0 | 0 | 0 |
threatbus/logger.py | GTrunSec/threatbus | 212 | 1618758 | import coloredlogs
from dynaconf.utils.boxing import DynaBox
import logging
import sys
def setup(config: DynaBox, name: str) -> object:
fmt = "%(asctime)s %(levelname)-8s [%(name)s] %(message)s"
colored_formatter = coloredlogs.ColoredFormatter(fmt)
plain_formatter = logging.Formatter(fmt)
logger = log... | 2 | 1 | 0 | 0 | 3 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.