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 |
|---|---|---|---|---|---|---|---|---|---|---|
Chapter15/ABQ_Data_Entry/abq_data_entry/test/support.py | JTamarit/Tkinter_libro | 173 | 189267 | import tkinter as tk
from unittest import TestCase
class TkTestCase(TestCase):
"""A test case designed for Tkinter widgets and views"""
keysyms: dict[str,str] = {
'-': 'minus',
' ': 'space',
':': 'colon',
# For more see http://www.tcl.tk/man/tcl8.4/TkCmd/keysyms.htm
}
... | 1 | 0 | 1 | 0 | 2 | 0 |
lib/deep.py | AnonymouzAuthorz/RevisitingTabularDL | 298 | 189270 | <gh_stars>100-1000
from __future__ import absolute_import, division, print_function
import math
import os
import typing as ty
from copy import deepcopy
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import zero
from torch import Tensor
class IndexLoader:
def __ini... | 0 | 0 | 0 | 0 | 0 | 0 |
attributes/unit_test/discoverer/python.py | Lufedi/reaper | 106 | 189303 | <filename>attributes/unit_test/discoverer/python.py
from attributes.unit_test.discoverer import TestDiscoverer
class PythonTestDiscoverer(TestDiscoverer):
def __init__(self):
self.language = 'Python'
self.languages = ['Python']
self.extensions = ['*.py']
self.frameworks = [
... | 0 | 0 | 0 | 0 | 0 | 0 |
Python3/1268.py | rakhi2001/ecom7 | 854 | 189313 | <reponame>rakhi2001/ecom7<filename>Python3/1268.py
__________________________________________________________________________________________________
sample 56 ms submission
class Solution:
def suggestedProducts(self, products: List[str], searchWord: str) -> List[List[str]]:
ans, res = [], []
... | 0 | 0 | 0 | 0 | 0 | 0 |
language/orqa/datasets/ict_dataset.py | Xtuden-com/language | 1,199 | 189329 | # coding=utf-8
# Copyright 2018 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://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | 0 | 5 | 0 | 0 | 5 | 0 |
terrascript/provider/rancher2.py | mjuenema/python-terrascript | 507 | 189364 | # terrascript/provider/rancher2.py
# Automatically generated by tools/makecode.py (24-Sep-2021 15:25:37 UTC)
#
# For imports without namespace, e.g.
#
# >>> import terrascript.provider.rancher2
#
# instead of
#
# >>> import terrascript.provider.rancher.rancher2
#
# This is only available for 'official' and 'partner... | 0 | 0 | 0 | 0 | 0 | 0 |
ch04_linear/code/linear_reg.py | wellszhao/intro_ds_wy_course | 146 | 189391 | # -*- coding: UTF-8 -*-
"""
此脚本用于展示使用惩罚项解决模型幻觉的问题
"""
import os
import numpy as np
import statsmodels.api as sm
from sklearn import linear_model
import matplotlib.pyplot as plt
import pandas as pd
def read_data(path) -> object:
"""
使用pandas读取数据
"""
data = pd.read_csv(path)
return data
def gen... | 0 | 3 | 0 | 0 | 3 | 0 |
src/main/java/com/google/security/zynamics/binnavi/scripts/sample_plugin.py | myArea51/binnavi | 3,083 | 189423 | """
Copyright 2014 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 applicable law or agr... | 0 | 0 | 0 | 0 | 0 | 0 |
ros_ws/src/crazyswarm/scripts/test_yamlString.py | marios-stam/crazyswarm | 219 | 189430 | #!/usr/bin/env python
import numpy as np
from pycrazyswarm import *
def test_yaml_string_load():
crazyflies_yaml = """
crazyflies:
- channel: 100
id: 1
initialPosition: [1.0, 0.0, 0.0]
- channel: 100
id: 10
initialPosition: [0.0, -1.0, 0.0]
"""
swarm = Crazyswarm(craz... | 0 | 0 | 0 | 0 | 0 | 0 |
opendatatools/datayes/__init__.py | solider245/OpenData | 1,179 | 189449 | # encoding: utf-8
from .datayes_interface import * | 0 | 0 | 0 | 0 | 0 | 0 |
examples/example_1.py | dillonhuff/Chips-2.0 | 221 | 189452 | #!/usr/bin/env python2
import subprocess
import atexit
import sys
from math import pi
from chips.api.api import Chip, Stimulus, Response, Wire, Component
#try:
from matplotlib import pyplot
#except ImportError:
#print "You need matplotlib to run this script!"
#exit(0)
def test():
chip = Chip("square_roo... | 0 | 1 | 0 | 0 | 1 | 0 |
release/stubs.min/Tekla/Structures/ModelInternal_parts/dotUndoOperation_t.py | htlcnn/ironpython-stubs | 182 | 189455 | class dotUndoOperation_t(object):
# no doc
Operation: None = None
| 0 | 0 | 1 | 0 | 1 | 0 |
autosar/bsw/generator.py | SHolzmann/autosar | 199 | 189468 | import cfile as C
import os
import io
import autosar
innerIndentDefault=3 #default indendation (number of spaces)
def _genCommentHeader(comment) -> object:
code = C.sequence()
code.append(C.line('/**********************************************************************************************************... | 4 | 3 | 0 | 3 | 10 | 0 |
Defenses/DefenseMethods/PD.py | jiannanWang/DEEPSEC | 178 | 189500 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Reference: <NAME>, et al. "Pixeldefend: Leveraging generative models to understand and defend against adversarial examples," in ICLR, 2018.
# Reference Implementation from Authors (TensorFlow): https://github.com/yang-song/pixeldefend
# ***********************************... | 12 | 2 | 0 | 0 | 14 | 0 |
contrib/华为云垃圾分类大赛心得与案例-GitLD/src_Xception_all_aug+TTA/data_gen.py | huaweicloud/ModelArts-Lab | 1,045 | 189532 | # -*- coding: utf-8 -*-
from __future__ import annotations
import os
import math
import codecs
import random
import numpy as np
from glob import glob
from PIL import Image
from keras.utils import np_utils, Sequence
from sklearn.model_selection import train_test_split
class BaseSequence(Sequence):
"""
基础的数据流生... | 2 | 5 | 0 | 0 | 7 | 0 |
node_launcher/node_set/lib/configuration_file.py | saxobroko/node-launcher | 249 | 189538 | import os
from os.path import isfile, isdir, pardir
from pathlib import Path
from typing import List, Tuple
from node_launcher.constants import NODE_LAUNCHER_RELEASE
from node_launcher.logging import log
from PySide2.QtCore import QFileSystemWatcher, Signal, QObject
from node_launcher.node_set.lib.configuration_prope... | 4 | 3 | 1 | 0 | 8 | 0 |
tests/test_timing.py | bsmith76s/irrigation_unlimited | 114 | 189545 | """Test irrigation_unlimited timing operations."""
import pytest
import glob
import homeassistant.core as ha
from homeassistant.config import (
load_yaml_config_file,
async_process_ha_core_config,
)
from tests.iu_test_support import (
begin_test,
finish_test,
quiet_mode,
test_config_dir,
che... | 1 | 0 | 0 | 0 | 1 | 0 |
uplink/compat.py | lust4life/uplink | 918 | 189561 | # Third-party imports
import six
__all__ = ["reraise"]
reraise = six.reraise
| 0 | 0 | 0 | 0 | 0 | 0 |
flax/util/db_synchronous.py | ReadyNeutron/shitcoin-blockchain | 11,902 | 189562 | from pathlib import Path
def db_synchronous_on(setting: str, db_path: Path) -> str:
if setting == "on":
return "NORMAL"
if setting == "off":
return "OFF"
if setting == "full":
return "FULL"
# for now, default to synchronous=FULL mode. This can be made more
# sophisticated ... | 2 | 1 | 0 | 0 | 3 | 0 |
emotion-cause-extraction/RoBERTa Baseline/train_classification.py | NouamaneTazi/conv-emotion | 488 | 189591 | <reponame>NouamaneTazi/conv-emotion<gh_stars>100-1000
import numpy as np, pandas as pd
import json, os, logging, pickle, argparse
from sklearn.metrics import classification_report
from simpletransformers.classification import ClassificationModel
if __name__ == '__main__':
global args
parser = argparse.Argumen... | 0 | 0 | 0 | 0 | 0 | 0 |
scattertext/test/test_termDocMatrixFromScikit.py | shettyprithvi/scattertext | 1,823 | 189614 | <filename>scattertext/test/test_termDocMatrixFromScikit.py
from unittest import TestCase
import numpy as np
from scattertext import TermDocMatrixFromScikit
from scattertext.indexstore import IndexStore
from scattertext.test.test_semioticSquare import get_docs_categories_semiotic
class TestTermDocMatrixFromScikit(Te... | 0 | 0 | 0 | 0 | 0 | 0 |
newm/panel_endpoint.py | sadrach-cl/newm | 265 | 189626 | <reponame>sadrach-cl/newm
from __future__ import annotations
from typing import Any, TYPE_CHECKING, Optional
from asyncio.events import AbstractEventLoop
import os
import json
import asyncio
from websockets import serve, connect # type: ignore
import logging
from threading import Thread
if TYPE_CHECKING:
from .... | 0 | 0 | 0 | 0 | 0 | 0 |
Packs/CommonScripts/Scripts/Cut/Cut_test.py | diCagri/content | 799 | 189662 | from Cut import cut
import pytest
@pytest.mark.parametrize('value,delimiter,fields,expected', [
('A-B-C-D-E', '-', '1,5', 'A-E'),
('a,ב,c', ',', '2,3', 'ב,c'),
])
def test_cut(value, delimiter, fields, expected):
"""
Given:
Case 1: A-B-C-D-E to split by - from char 1 to 5
Case 2: a,ב,... | 0 | 0 | 0 | 0 | 0 | 0 |
main-bg.py | kierandelaney/sand-spline | 301 | 189675 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
from numpy import pi
from numpy import array
from numpy import linspace
from numpy.random import random
from numpy.random import randint
from numpy import zeros
from numpy import arange
from numpy import column_stack
from numpy import cos
from numpy import sin
from modules.h... | 0 | 1 | 0 | 0 | 1 | 0 |
applications/PfemApplication/python_scripts/MainPfem.py | lkusch/Kratos | 778 | 189691 | from __future__ import annotations
from __future__ import print_function, absolute_import, division #makes KratosMultiphysics backward compatible with python 2.6 and 2.7
# Import kratos core and applications
import KratosMultiphysics
import KratosMultiphysics.SolidMechanicsApplication
import KratosMultiphysics.PfemApp... | 2 | 8 | 0 | 0 | 10 | 0 |
opytimizer/optimizers/population/gco.py | anukaal/opytimizer | 528 | 189693 | from __future__ import annotations
"""Germinal Center Optimization.
"""
import copy
import numpy as np
import opytimizer.math.distribution as d
import opytimizer.math.random as r
import opytimizer.utils.constant as c
import opytimizer.utils.exception as e
import opytimizer.utils.logging as l
from opytimizer.core imp... | 1 | 5 | 0 | 2 | 8 | 0 |
Chapter09/chapter9_pexpect_1.py | stavsta/Mastering-Python-Networking-Second-Edition | 107 | 189718 | import pexpect
def show_version(device, prompt, ip, username, password) -> tuple[object, object]:
device_prompt = prompt
child = pexpect.spawn('telnet ' + ip)
child.expect('Username:')
child.sendline(username)
child.expect('Password:')
child.sendline(password)
child.expect(device_prompt)
... | 0 | 1 | 0 | 0 | 1 | 0 |
monitor/portal/models.py | zbonce/PromAnsible | 210 | 189751 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
# Create your models here.
# system parameters
class mn_DeviceType(models.Model):
type_name = models.CharField(max_length=30)
class mn_ServerGroup(models.Model):
group_name = models.CharField(max_l... | 0 | 0 | 0 | 0 | 0 | 0 |
docs/JSImage.cpp.py | wiltonlazary/Nidium | 1,223 | 189777 | <filename>docs/JSImage.cpp.py
# Copyright 2016 Nidium Inc. All rights reserved.
# Use of this source code is governed by a MIT license
# that can be found in the LICENSE file.
from dokumentor import *
ClassDoc( "Image", "Image handling.",
[SeeDoc( "Canvas.drawImage" ) ],
[ExampleDoc( """var img = new Image();... | 0 | 0 | 0 | 0 | 0 | 0 |
libcity/data/dataset/trajectory_encoder/atstlstm_encoder.py | moghadas76/test_bigcity | 221 | 189826 | import os
import pandas as pd
from datetime import datetime
from geopy import distance
from libcity.data.dataset.trajectory_encoder.abstract_trajectory_encoder import AbstractTrajectoryEncoder
from libcity.utils import parse_time, parse_coordinate
parameter_list = ['dataset', 'min_session_len', 'min_sessions', 'traj_... | 0 | 1 | 0 | 5 | 6 | 0 |
examples/gan/dcgan_tf_keras/dc_gan.py | gh-determined-ai/determined | 1,729 | 189865 | <gh_stars>1000+
"""
Implement DCGan model based on: https://www.tensorflow.org/tutorials/generative/dcgan.
"""
import tensorflow as tf
from tensorflow.keras import layers
def make_generator_model(noise_dim):
model = tf.keras.Sequential()
model.add(layers.Dense(7 * 7 * 256, use_bias=False, input_shape=(noise_... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/security/test_security_multistream.py | g-r-a-n-t/py-libp2p | 315 | 189909 | <reponame>g-r-a-n-t/py-libp2p
import pytest
from libp2p.crypto.rsa import create_new_key_pair
from libp2p.security.insecure.transport import PLAINTEXT_PROTOCOL_ID, InsecureSession
from libp2p.security.noise.transport import PROTOCOL_ID as NOISE_PROTOCOL_ID
from libp2p.security.secio.transport import ID as SECIO_PROTOC... | 0 | 0 | 0 | 0 | 0 | 0 |
test/datasets.py | sarvex/TFace | 764 | 189933 | <gh_stars>100-1000
import os
import cv2
import numpy as np
from skimage import transform as trans
from torch.utils.data import Dataset
def crop_transform(rimg, landmark, image_size):
""" warpAffine face img by landmark
"""
assert landmark.shape[0] == 68 or landmark.shape[0] == 5
assert landmark.shape[... | 0 | 0 | 0 | 0 | 0 | 0 |
genomepy/argparse_support.py | tilschaef/genomepy | 146 | 189961 | from __future__ import annotations
import argparse
import sys
from loguru import logger
from genomepy import Genome, install_genome
def parse_genome(auto_install: bool=False, genomes_dir: object | None=None) -> object:
"""
Argparse action for command-line genome option.
Parameters
----------
... | 3 | 1 | 0 | 0 | 4 | 0 |
software/reachy/utils/__init__.py | pollen-robotics/reachy-2.0 | 167 | 190028 | """Utility toolbox submodules."""
import numpy as np
from scipy.spatial.transform import Rotation as R
def rot(axis, deg) -> object:
"""Compute 3D rotation matrix given euler rotation."""
return R.from_euler(axis, np.deg2rad(deg)).as_matrix()
| 0 | 1 | 0 | 0 | 1 | 0 |
scanpy/external/pp/_harmony_integrate.py | mkmkryu/scanpy2 | 1,171 | 190034 | <filename>scanpy/external/pp/_harmony_integrate.py
"""
Use harmony to integrate cells from different experiments.
"""
from typing import Optional
from anndata import AnnData
def harmony_integrate(
adata: AnnData,
key: str,
basis: str = "X_pca",
adjusted_basis: str = "X_pca_harmony",
**kwargs,
):... | 0 | 0 | 0 | 0 | 0 | 0 |
classes/contrib/mypy/validation/validate_typeclass_def.py | ftaebi/classes | 475 | 190047 | <filename>classes/contrib/mypy/validation/validate_typeclass_def.py
from typing import Union
from mypy.nodes import (
ARG_POS,
EllipsisExpr,
ExpressionStmt,
FuncDef,
PassStmt,
StrExpr,
)
from mypy.plugin import FunctionContext, MethodContext
from mypy.types import CallableType, Instance
from ty... | 0 | 0 | 0 | 0 | 0 | 0 |
lib/python/autogen/h2py.py | leozz37/makani | 1,178 | 190057 | # Copyright 2020 Makani Technologies 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... | 0 | 0 | 0 | 0 | 0 | 0 |
data/prep/prepare_segmented_dataset_ami.py | ishine/pase | 428 | 190073 | <gh_stars>100-1000
import soundfile as sf
import sys
import tqdm
import shutil
import os
import multiprocessing as mp
import numpy as np
import matplotlib.pyplot as plt
import argparse
from timeit import default_timer as timer
def copy_folder(in_folder, out_folder):
if not os.path.isdir(out_folder):
print... | 0 | 0 | 0 | 0 | 0 | 0 |
skyfield/naifcodes.py | facorazza/python-skyfield | 765 | 190084 | from jplephem.names import (
target_name_pairs as code_name_pairs,
target_names as code_names
)
name_codes = dict((name, code) for code, name in code_name_pairs)
def numbered_name_of(code) -> object:
"""Given a code, return a string giving both the code and name.
>>> numbered_name_of(301)
'301 Mo... | 0 | 2 | 0 | 0 | 2 | 0 |
perma_web/perma/settings/deployments/settings_testing.py | rachelaus/perma | 317 | 190097 | import os
from .settings_dev import *
#########
# Setup #
#########
FIXTURE_DIRS = (
PROJECT_ROOT,
)
#############
# Overrides #
#############
RUN_TASKS_ASYNC = False # avoid sending celery tasks to queue -- just run inline
SUBDOMAIN_URLCONFS = {}
DEBUG = False
TESTING = True
ADMINS = (
("<NAME>", '<E... | 0 | 0 | 0 | 0 | 0 | 0 |
notebooks/_solutions/case4_air_quality_analysis22.py | rprops/Python_DS-WS | 183 | 190115 | data.groupby(data.index.hour).mean().plot() | 0 | 0 | 0 | 0 | 0 | 0 |
src/oci/log_analytics/models/log_analytics_source_pattern.py | Manny27nyc/oci-python-sdk | 249 | 190128 | # coding: utf-8
# Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... | 0 | 22 | 0 | 21 | 43 | 0 |
tests/test_ttl.py | PLPeeters/reppy | 137 | 190145 | import unittest
import mock
from reppy import ttl
class TTLPolicyBaseTest(unittest.TestCase):
'''Tests about TTLPolicyBase.'''
def test_does_not_implement_ttl(self):
'''Does not implement the ttl method.'''
with self.assertRaises(NotImplementedError):
ttl.TTLPolicyBase().ttl(obj... | 0 | 0 | 0 | 0 | 0 | 0 |
reference_data/01_Sets.py | IBM/api-samples | 172 | 190173 | <gh_stars>100-1000
#!/usr/bin/env python3
# In this sample you will see how data in reference sets can be manipulated
# using the REST API.
# In this scenario we have already configured two reference sets in the
# product,one to capture ip addresses exhibiting suspect behavior and another
# to hold blocked ip addresse... | 0 | 0 | 0 | 0 | 0 | 0 |
python/sparsemap/layers_pt/tests/test_tree_layer.py | mikejqzhang/sparsemap | 101 | 190209 | from ..tree_layer import TreeSparseMarginalsFast
import torch
from torch.autograd import gradcheck, Variable
def test_fasttree_sparse_decode():
torch.manual_seed(42)
n_nodes = 5
tsm = TreeSparseMarginalsFast(n_nodes, max_iter=1000)
for _ in range(20):
W = torch.randn(n_nodes, n_nodes + 1).vi... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/python/contrib/test_hexagon/test_benchmark_maxpool2d.py | gayatripk1/tvm | 4,640 | 190211 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 3 | 5 | 1 | 0 | 9 | 0 |
virtual/lib/python3.6/site-packages/pylint/test/input/func_i0022.py | drewheathens/The-Moringa-Tribune | 463 | 190232 | <filename>virtual/lib/python3.6/site-packages/pylint/test/input/func_i0022.py
"""Deprecated suppression style."""
__revision__ = None
a = 1 # pylint: disable=invalid-name
b = 1 # pylint: disable-msg=invalid-name
# pylint: disable=invalid-name
c = 1
# pylint: enable=invalid-name
# pylint: disable-msg=invalid-name
... | 0 | 0 | 0 | 0 | 0 | 0 |
mmdnn/conversion/examples/paddle/imagenet_test.py | kmader/MMdnn | 3,442 | 190243 | #----------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#------------------------------------------------------------------... | 1 | 0 | 0 | 0 | 1 | 0 |
nuplan/planning/simulation/observation/idm_agents.py | motional/nuplan-devkit | 128 | 190249 | from collections import defaultdict
from typing import Dict, List, Optional, Type
from nuplan.common.maps.maps_datatypes import TrafficLightStatusData, TrafficLightStatusType
from nuplan.planning.scenario_builder.abstract_scenario import AbstractScenario
from nuplan.planning.simulation.history.simulation_history_buffe... | 12 | 6 | 2 | 2 | 22 | 0 |
keanu-python/keanu/plots/traceplot.py | rs992214/keanu | 153 | 190267 | try:
import matplotlib.pyplot as plt
from matplotlib.ticker import MaxNLocator
except ImportError: # mpl is optional
pass
import numpy as np
from keanu.vartypes import sample_types, numpy_types
from typing import Any, List, Tuple, Union
def traceplot(trace: sample_types, labels: List[Union[str, Tuple[st... | 7 | 3 | 0 | 0 | 10 | 0 |
source/utils/bp4dbg/adios2/bp4dbg/__init__.py | yunai2384/ADIOS2 | 190 | 190306 | from .data import *
from .idxtable import *
from .metadata import *
| 0 | 0 | 0 | 0 | 0 | 0 |
forms-flow-api/tests/unit/api/test_keycloak_groups.py | andrepestana-aot/forms-flow-ai | 132 | 190314 | """Unit test for APIs of Keycloak Group"""
from tests.utilities.base_test import factory_auth_header
def test_group_list(client):
"""Passing case of Group List API"""
token = factory_auth_header()
headers = {"Authorization": f"Bearer {token}", "content-type": "application/json"}
response = client.get... | 0 | 0 | 0 | 0 | 0 | 0 |
env/Lib/site-packages/OpenGL/GL/SGIX/pixel_texture.py | 5gconnectedbike/Navio2 | 210 | 190353 | <filename>env/Lib/site-packages/OpenGL/GL/SGIX/pixel_texture.py
'''OpenGL extension SGIX.pixel_texture
This module customises the behaviour of the
OpenGL.raw.GL.SGIX.pixel_texture to provide a more
Python-friendly API
Overview (from the spec)
This extension allows the color components of pixel groups to be used ... | 0 | 0 | 0 | 0 | 0 | 0 |
bookwyrm/forms/links.py | mouse-reeve/fedireads | 270 | 190366 | <reponame>mouse-reeve/fedireads
""" using django model forms """
from urllib.parse import urlparse
from django.utils.translation import gettext_lazy as _
from bookwyrm import models
from .custom_form import CustomForm
# pylint: disable=missing-class-docstring
class LinkDomainForm(CustomForm):
class Meta:
... | 0 | 0 | 0 | 0 | 0 | 0 |
homeassistant/components/mfi/__init__.py | domwillcode/home-assistant | 30,023 | 190383 | <reponame>domwillcode/home-assistant
"""The mfi component."""
| 0 | 0 | 0 | 0 | 0 | 0 |
StockAnalysisSystem/plugin/Collector/finance_business_tushare_pro.py | SleepySoft/StockAnalysisSystem | 138 | 190389 | import pandas as pd
import tushare as ts
from StockAnalysisSystem.core.config import TS_TOKEN
from StockAnalysisSystem.core.Utility.common import *
from StockAnalysisSystem.core.Utility.time_utility import *
from StockAnalysisSystem.core.Utility.CollectorUtility import *
# -------------------------------------------... | 6 | 8 | 0 | 0 | 14 | 0 |
packages/Python/lldbsuite/test/commands/expression/import-std-module/vector-basic/TestBasicVector.py | xiaobai/swift-lldb | 765 | 190458 | <filename>packages/Python/lldbsuite/test/commands/expression/import-std-module/vector-basic/TestBasicVector.py
"""
Test basic std::vector functionality.
"""
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class TestBasicVector(TestBase):
mydir = T... | 0 | 0 | 0 | 0 | 0 | 0 |
python/oneflow/utils/vision/__init__.py | wangyuyue/oneflow | 3,285 | 190474 | <gh_stars>1000+
"""
Copyright 2020 The OneFlow 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 | 0 | 0 | 0 | 0 | 0 |
playground/detection/coco/detr/detr.res50.c5.coco.multiscale.150e.bs16/config.py | hanqiu-hq/cvpods | 548 | 190493 | <reponame>hanqiu-hq/cvpods
import os.path as osp
from cvpods.configs.base_detection_config import BaseDetectionConfig
_config_dict = dict(
MODEL=dict(
WEIGHTS="detectron2://ImageNetPretrained/MSRA/R-50.pkl",
MASK_ON=False,
RESNETS=dict(
DEPTH=50,
OUT_FEATURES=["res5... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_speed_calculator2.py | xqiu/pytchat | 246 | 190506 | import json
import pytchat
from pytchat.parser.live import Parser
from pytchat.processors.speed.calculator import SpeedCalculator
parser = Parser(is_replay=False)
def test_speed_1():
stream = pytchat.create("Hj-wnLIYKjw", seektime = 6000,processor=SpeedCalculator())
while stream.is_alive():
speed = s... | 0 | 0 | 0 | 0 | 0 | 0 |
python_basic/ex_ndarray.py | futuremax/EveryBodyTensorFlow | 109 | 190557 | import numpy as np
print '# [Numpy example1] ----------'
templist = [1,2,3,4,5,6]
templist = range(1,7)
np_templist = np.array(templist)
print np_templist
print '# Numpy example 2] --------'
np_tepmlist_int = np.array(templist,dtype=np.int8)
print '# Numpy example 3] -------'
| 0 | 0 | 0 | 0 | 0 | 0 |
src/main/resources/templates/python/solution/policy.py | nicolasruscher/Artemis | 213 | 190584 | from .sorting_algorithms import *
class Policy:
context: None = None
def __init__(self, context):
self.context = context
def configure(self):
if len(self.context.numbers) > 10:
print('More than 10 numbers, choosing merge sort!')
self.context.sorting_algorithm = Me... | 0 | 0 | 1 | 0 | 1 | 0 |
Lib/test/badsyntax_async5.py | Hadron/python | 486 | 190644 | <reponame>Hadron/python
def foo():
await something()
| 0 | 0 | 0 | 0 | 0 | 0 |
src/genie/libs/parser/nxos/tests/ShowIpInterfaceBrief/cli/equal/golden_output_1_expected.py | balmasea/genieparser | 204 | 190706 | <filename>src/genie/libs/parser/nxos/tests/ShowIpInterfaceBrief/cli/equal/golden_output_1_expected.py
expected_output = {'interface':
{'Eth5/48.106':
{'interface_status': 'protocol-down/link-down/admin-up',
'ip_address': '1... | 0 | 0 | 0 | 0 | 0 | 0 |
unit_test/test_vx_base_target.py | owl129/vxhunter | 189 | 190709 | <filename>unit_test/test_vx_base_target.py
from common import BaseTestCase, mock
from serial_debuger.vx_base_target import VxSerialBaseTarget
class VxSerialCmdDebugerTests(BaseTestCase):
def setUp(self):
super(VxSerialCmdDebugerTests, self).setUp()
self.target = VxSerialBaseTarget()
self.t... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/plugins/advanced.py | nnop/pluginbase | 803 | 190755 | from pluginbase import get_plugin_source
def get_app() -> object:
rv = get_plugin_source(stacklevel=1)
if rv is not None:
return rv.app
def get_app_name() -> object:
return get_app().name
| 0 | 2 | 0 | 0 | 2 | 0 |
src/main/python/transform.py | darshan-sj/DataflowTemplates | 828 | 190774 | """
Copyright 2020 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 applicable law or agreed to in... | 0 | 2 | 0 | 0 | 2 | 0 |
SimGeneral/MixingModule/python/mix_2018_25ns_ProjectedPileup_PoissonOOTPU_cfi.py | ckamtsikis/cmssw | 852 | 190783 | import FWCore.ParameterSet.Config as cms
from SimGeneral.MixingModule.mix_probFunction_25ns_PoissonOOTPU_cfi import *
mix.input.nbPileupEvents.probFunctionVariable = cms.vint32(
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
27, 28, 29, 30, 31, 32, 33, 34... | 0 | 0 | 0 | 0 | 0 | 0 |
OpenMatch/data/__init__.py | vishalbelsare/OpenMatch | 403 | 190795 | from OpenMatch.data.dataloader import DataLoader
from OpenMatch.data.datasets import *
from OpenMatch.data.tokenizers import *
| 0 | 0 | 0 | 0 | 0 | 0 |
securify/analyses/patterns/source/rtlo_pattern.py | AlexandreH/securify2 | 258 | 190816 | from __future__ import annotations
import bisect
import re
from typing import List, Dict
from securify.analyses.patterns.abstract_pattern import AbstractPattern, PatternMatch, Level, Severity, PatternMatchError, \
MatchComment, MatchSourceLocation
class RightToLeftOverridePattern(AbstractPattern):
regex_patt... | 0 | 8 | 0 | 0 | 8 | 0 |
src/enamlnative/android/android_list_view.py | codelv/enaml-native | 237 | 190825 | <gh_stars>100-1000
"""
Copyright (c) 2017, <NAME>.
Distributed under the terms of the MIT License.
The full license is in the file LICENSE, distributed with this software.
Created on May 20, 2017
@author: jrm
"""
from atom.api import Typed, Instance, Property, Dict, set_default, observe
from enamlnative.widgets.li... | 0 | 0 | 0 | 0 | 0 | 0 |
angr/procedures/win32/critical_section.py | Kyle-Kyle/angr | 6,132 | 190843 | <filename>angr/procedures/win32/critical_section.py
import angr
class InitializeCriticalSectionAndSpinCount(angr.SimProcedure):
def run(self, lpCriticalSection, dwSpinCount):
return 1
class InitializeCriticalSectionEx(angr.SimProcedure):
def run(self, lpCriticalSection, dwSpinCount, Flags):
re... | 0 | 0 | 0 | 0 | 0 | 0 |
seqlearn/tests/test_hmm.py | olimjonibr/seqlearn | 617 | 190891 | <filename>seqlearn/tests/test_hmm.py
from nose.tools import assert_raises
from numpy.testing import assert_array_equal, assert_array_almost_equal
import numpy as np
from seqlearn.hmm import MultinomialHMM
text = [w.split() for w in ["this DT",
"is V",
"a DT",
... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/language-service/snippet_cases/functions.py | jaydeetay/pxt | 977 | 190924 | <reponame>jaydeetay/pxt
# testNamespace.someFunction
testNamespace.some_function("", 0, False)
# testNamespace.someFunctionWithDefl
testNamespace.some_function_with_defl(5, True)
| 0 | 0 | 0 | 0 | 0 | 0 |
alipay/aop/api/domain/PrizeValidPeriod.py | antopen/alipay-sdk-python-all | 213 | 190930 | <filename>alipay/aop/api/domain/PrizeValidPeriod.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class PrizeValidPeriod(object):
def __init__(self):
self._active_min = None
self._active_mins = None
self._active_time = None... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/popgen/poptorch.py | gglin001/poptorch | 128 | 190973 | <gh_stars>100-1000
# Copyright (c) 2020 Graphcore Ltd. All rights reserved
# signatures for manually added operators
signatures = {
'beginIpuBlock': [['clong'], ['clong'], ['clong']],
'cast': ['Args', ['scalar_type']],
'internalCast': ['Args', ['cstr']],
'constantPad': ['Args', ['clong_list'], ['cfloat... | 0 | 0 | 0 | 0 | 0 | 0 |
example/django_example/foo/a_plugin_folder/dynaconf_hooks.py | sephiartlist/dynaconf | 2,293 | 190980 | def post(settings) -> object:
data = {"dynaconf_merge": True}
if settings.get("ADD_BEATLES") is True:
data["BANDS"] = ["Beatles"]
return data
| 0 | 1 | 0 | 0 | 1 | 0 |
resources/jupyterhub-mod/cleanup-service.py | Bpowers4/ml-hub | 220 | 190982 | <reponame>Bpowers4/ml-hub
"""
Web service that is supposed to be started via JupyterHub.
By this, the service has access to some information passed
by JupyterHub. For more information check out https://jupyterhub.readthedocs.io/en/stable/reference/services.html
Note: Logs probably don't appear in stdout, as the servic... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_streaming.py | Hanaasagi/requests-async | 1,057 | 190983 | <reponame>Hanaasagi/requests-async
import asyncio
import pytest
import requests_async
@pytest.mark.asyncio
async def test_content_not_available_on_stream(server):
url = "http://127.0.0.1:8000/hello_world"
response = await requests_async.get(url, stream=True)
assert response.status_code == 200
with p... | 0 | 0 | 0 | 0 | 0 | 0 |
python-leetcode/laozhang/tree/leetcode_100_.py | sweeneycai/cs-summary-reflection | 227 | 191018 | <gh_stars>100-1000
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# coding=utf-8
"""
100. 相同的树
"""
from laozhang import TreeNode
class Solution:
def isSameTree(self, p: TreeNode, q: TreeNode) -> bool:
res = True
def helper(p: TreeNode, q: TreeNode):
nonlocal res
if not p a... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_exceptions.py | isabella232/support | 298 | 191019 | import time
import sys
import traceback
try:
from support import exceptions
except:
sys.path.append('..')
from support import exceptions
def r(n=5, m=1, f=exceptions.current_code_list):
if n:
return r(n - 1, m)
for i in range(m):
return f()
def inline(n=5, m=10000):
if n:
... | 0 | 0 | 0 | 0 | 0 | 0 |
discovery-provider/alembic/versions/f64a484f1496_add_spl_associated_wallet.py | Tenderize/audius-protocol | 429 | 191032 | """add sol associated wallet
Revision ID: f64a484f1496
Revises: <PASSWORD>
Create Date: 2021-07-21 15:58:05.108372
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = "f64a484f1496"
down_revision = "<PASSWORD>"
branch_label... | 0 | 0 | 0 | 0 | 0 | 0 |
index_creation/pq_index.py | lukasstracke/postgres-word2vec | 131 | 191036 | <filename>index_creation/pq_index.py
#!/bin/python3
from scipy.cluster.vq import kmeans
from scipy.spatial.distance import sqeuclidean
from scipy.spatial.distance import cdist
import sys
import numpy as np
import faiss
import time
import psycopg2
import pickle
from config import *
from logger import *
from vector_feed... | 0 | 0 | 0 | 0 | 0 | 0 |
server/forms.py | fortiko/Crypt-Server | 101 | 191055 | from django import forms
from .models import *
class RequestForm(forms.ModelForm):
class Meta:
model = Request
fields: tuple[str] = ("reason_for_request",)
class ApproveForm(forms.ModelForm):
# approved = forms.BooleanField()
approved = forms.TypedChoiceField(
coerce=lambda x: bo... | 0 | 0 | 5 | 0 | 5 | 0 |
dataclasses-0.8/test/dataclass_module_2_str.py | dogfun/clend | 537 | 191061 | <reponame>dogfun/clend<filename>dataclasses-0.8/test/dataclass_module_2_str.py<gh_stars>100-1000
#from __future__ import annotations
USING_STRINGS = True
# dataclass_module_2.py and dataclass_module_2_str.py are identical
# except only the latter uses string annotations.
from dataclasses import dataclass, InitVar
fro... | 0 | 0 | 0 | 0 | 0 | 0 |
test/completion/import_tree/flow_import.py | mrclary/jedi | 4,213 | 191069 | if name:
env = 1
else:
env = 2
| 0 | 0 | 0 | 0 | 0 | 0 |
V3/server/cmdline.py | webpics/style2paints | 15,281 | 191101 | <reponame>webpics/style2paints<filename>V3/server/cmdline.py<gh_stars>1000+
#!/usr/bin/env python3
import os
import sys
for f in ['baby.net', 'head.net', 'neck.net', 'tail.net', 'reader.net', 'girder.net']:
if not os.path.exists(f):
print('Error: neural network models not downloaded!')
print('Down... | 0 | 0 | 0 | 0 | 0 | 0 |
dpwn/evaluator.py | macdaliot/deep-pwning | 557 | 191107 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import sys
import time
import numpy as np
import tensorflow as tf
import utils.utils as utils
class Evaluator:
def __init__(self,
cmd_args, config, optimizer, learning_rate, loss, sav... | 1 | 1 | 0 | 0 | 2 | 0 |
generator/tests/filesys/single_file_library_package_test.py | romulobusatto/google-api-php-client-services | 709 | 191151 | <reponame>romulobusatto/google-api-php-client-services<filename>generator/tests/filesys/single_file_library_package_test.py
#!/usr/bin/python2.7
# -*- coding: utf-8 -*-
#
# Copyright 2012 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file e... | 0 | 0 | 0 | 0 | 0 | 0 |
setup.py | mingt2019/GFL | 123 | 191200 | <gh_stars>100-1000
import setuptools
with open("README.md", "r", encoding="utf-8") as f:
long_description = f.read()
setuptools.setup(
name="gfl",
version="0.2.0",
author="malanore",
author_email="<EMAIL>",
description="A Galaxy Federated Learning Framework",
long_description=long_descript... | 0 | 0 | 0 | 0 | 0 | 0 |
contrib/dhcp_agent/setup.py | DoNnMyTh/ralph | 1,668 | 191231 | <gh_stars>1000+
# -*- encoding: utf-8 -*-
from setuptools import setup
setup(
name='dhcp_agent',
version='0.1.0',
author='<NAME> and Contributors',
author_email='<EMAIL>',
platforms=['any'],
license='Apache Software License v2.0',
py_modules=[
'dhcp_agent',
],
entry_points={... | 0 | 0 | 0 | 0 | 0 | 0 |
modules/dbnd/test_dbnd/scenarios/interrupt_handling/running_dbnd_on_separate_thread.py | ipattarapong/dbnd | 224 | 191238 | import logging
import signal
import sys
import threading
import time
from threading import Thread
from dbnd import Task, parameter
from dbnd._core.current import get_databand_context, try_get_databand_run
from dbnd._core.task_build.task_context import try_get_current_task
logger = logging.getLogger(__name__)
stop_... | 0 | 2 | 0 | 0 | 2 | 0 |
rep/test/__init__.py | HolyBayes/rep | 726 | 191266 | <filename>rep/test/__init__.py<gh_stars>100-1000
from __future__ import division, print_function, absolute_import
__author__ = '<NAME>' | 0 | 0 | 0 | 0 | 0 | 0 |
small_text/integrations/pytorch/utils/misc.py | chschroeder/small-text | 218 | 191273 | <reponame>chschroeder/small-text
import torch
from contextlib import contextmanager
@contextmanager
def default_tensor_type(tensor_type):
default_type = torch.cuda.FloatTensor if torch.cuda.is_available() else torch.FloatTensor
torch.set_default_tensor_type(tensor_type)
yield
torch.set_default_tensor... | 0 | 0 | 0 | 0 | 0 | 0 |
curriculum/utils.py | coco-robotics/rllab-curriculum | 115 | 191306 | <gh_stars>100-1000
import datetime
import multiprocessing
import os
from rllab.sampler import parallel_sampler
class AttrDict(dict):
def __init__(self, *args, **kwargs):
super(AttrDict, self).__init__(*args, **kwargs)
self.__dict__ = self
def initialize_parallel_sampler(n_processes=-1):
if n... | 0 | 0 | 0 | 0 | 0 | 0 |
skdist/distribute/_defaults.py | synapticarbors/sk-dist | 292 | 191317 | """
Default feature encoding functions and pipelines
for automated feature transformation.
"""
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import StandardScaler, OneHotEncoder
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.feature_extraction import DictVectorizer
from skl... | 0 | 1 | 0 | 0 | 1 | 0 |
cisco-ios-xr/ydk/models/cisco_ios_xr/SNMP_TARGET_MIB.py | CiscoDevNet/ydk-py | 177 | 191332 | """ SNMP_TARGET_MIB
"""
import sys
from collections import OrderedDict
from ydk.types import Entity as _Entity_
from ydk.types import EntityPath, Identity, Enum, YType, YLeaf, YLeafList, YList, LeafDataList, Bits, Empty, Decimal64
from ydk.types import Entity, EntityPath, Identity, Enum, YType, YLeaf, YLeafList, YL... | 0 | 7 | 12 | 57 | 76 | 0 |
application/controllers/admin/content/__init__.py | mutalisk999/bibi | 1,037 | 191378 | from . import banner, item
| 0 | 0 | 0 | 0 | 0 | 0 |
lib/pymedphys/_dicom/anonymise/__init__.py | ethanio12345/pymedphys | 207 | 191419 | <filename>lib/pymedphys/_dicom/anonymise/__init__.py
# Copyright (C) 2020 <NAME>, <NAME>
# Copyright (C) 2018 <NAME>, <NAME>
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.ap... | 0 | 0 | 0 | 0 | 0 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.