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
docker/build/face_detection/detection/celeryconfig.py
mykiscool/DeepCamera
914
3263405
import os imports = ('od',) broker_url = 'redis://guest@redis/0' if os.environ is not None and 'WORKER_BROKER' in os.environ.keys(): broker_url = os.environ['WORKER_BROKER'] result_backend = 'redis://guest@redis/0' worker_pool_restarts = True task_routes = { 'od.detect': {'queue': 'od'} }
0
0
0
0
0
0
solutions/problem_363.py
ksvr444/daily-coding-problem
1,921
3263438
<filename>solutions/problem_363.py def add(x, y=1): return lambda z: add(x+(y*z), (-1*y)) if z else x # Tests assert add(7)(None) == 7 assert add(1)(2)(3)(None) == 0 assert add(-5)(10)(3)(9)(None) == 11
0
0
0
0
0
0
rest/sip-in/get-credential-lists-credentials/get-credential-lists-credentials.6.x.py
Tshisuaka/api-snippets
234
3263441
# Download the Python helper library from twilio.com/docs/python/install import os from twilio.rest import Client # Your Account Sid and Auth Token from twilio.com/user/account # To set up environmental variables, see http://twil.io/secure account_sid = os.environ['TWILIO_ACCOUNT_SID'] auth_token = os.environ['TWILIO_...
0
0
0
0
0
0
pyblazing/pyblazing/apiv2/algebra/__init__.py
Ethyling/blazingsql
1,059
3263449
<gh_stars>1000+ from .json_plan import get_json_plan, format_json_plan
0
0
0
0
0
0
samples/loop_users_items.py
kevinsigwart/ArcREST
208
3263453
<filename>samples/loop_users_items.py """ This sample shows how to loop through all users and their items Python 2/3 ArcREST version 3.5.x """ from __future__ import print_function import arcrest from arcrest.security import AGOLTokenSecurityHandler from datetime import datetime as dt import numpy as np d...
0
0
0
0
0
0
sdk/apps/byte_swapper/__init__.py
JimMadge/aws-fpga
1,275
3263458
# Copyright 2015-2017 Amazon.com, Inc. or its affiliates. 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. A copy of the # License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" fil...
0
0
0
0
0
0
quantifiedcode/plugins/git/backend/tasks/auto_tag.py
marcinguy/scanmycode-ce
138
3263469
<gh_stars>100-1000 # -*- coding: utf-8 -*- """ Contains hooks used in the analysis of Git projects. """ import logging from quantifiedcode.settings import backend from quantifiedcode.backend.models import Tag from .project import extract_tags_from_requirements_txt logger = logging.getLogger(__name__) d...
0
0
0
0
0
0
bionlp/evaluate/postprocess.py
abhyudaynj/LSTM-CRF-models
191
3263478
import pickle, sys, random,logging,os,json from operator import itemgetter logger=logging.getLogger(__name__) IGNORE_TAG='None' def prepare_document_report(o,l,p,encoded_documents,output_dir): logger.info('Preparing the documents reports with the IGNORE_TAG = \'{0}\' ( This is case sensitive)'.format(IGNORE_TAG)) ...
0
0
0
0
0
0
gobbli/test/experiment/test_classification_experiment.py
RTIInternational/gobbli
276
3263506
import tempfile import warnings from pathlib import Path import pandas as pd import pytest from gobbli.dataset.cmu_movie_summary import MovieSummaryDataset from gobbli.dataset.newsgroups import NewsgroupsDataset from gobbli.experiment.classification import ( ClassificationExperiment, ClassificationExperimentR...
0
0
0
0
0
0
tests/test_unescape.py
foliant-docs/foliant
105
3263522
'''Test the builtin ``_unescape`` preprocessor that turns escaped tags (``<<tag></tag>``) into unescaped ones (``<tag></tag>``) in output without processing them. ''' from logging import Logger from pathlib import Path from foliant.preprocessors import _unescape class TestUnescape(object): preprocessor = _unesc...
0
0
0
0
0
0
cumulusci/core/dependencies/utils.py
davisagli/CumulusCI
163
3263548
from collections import namedtuple # data structure mimicking a task for use with the metadata API classes TaskContext = namedtuple("TaskContext", ["org_config", "project_config", "logger"])
0
0
0
0
0
0
pdf_pages_remover/main.py
sonalimahajan12/Automation-scripts
496
3263552
from PyPDF2 import PdfFileWriter, PdfFileReader print("What is the file that you would like to modify?\n[Provide file address]") file = str(input()) inputFile = PdfFileReader(file) pagesToDelete = [] print("How many pages do you need to delete?") n = int(input()) print("Enter the page numbers of the files ...
0
0
0
0
0
0
test/core/test_fastHan.py
ishine/fastHan
635
3263557
import unittest from fastHan import FastHan class TestFastHan(unittest.TestCase): # 继承了unittest.TestCase这样可以直接利用unittest的一些function def test_init(self): # 测试是否可以正确initialize model = FastHan() model = FastHan('large') def test_call(self): sentence=['一行人下得山来,走不多时,忽听前...
0
0
0
0
0
0
synapse/cmds/cron.py
ackroute/synapse
216
3263582
<reponame>ackroute/synapse<filename>synapse/cmds/cron.py import time import types import calendar import datetime import functools import synapse.exc as s_exc import synapse.common as s_common import synapse.lib.cli as s_cli import synapse.lib.cmd as s_cmd import synapse.lib.time as s_time import synapse.lib.parser a...
0
0
0
0
0
0
python/helpers/pydev/_pydevd_bundle/pydevd_trace_dispatch_regular.py
teddywest32/intellij-community
105
3263583
from __future__ import annotations import traceback from _pydev_bundle.pydev_is_thread_alive import is_thread_alive from _pydev_imps._pydev_saved_modules import threading from _pydevd_bundle.pydevd_constants import get_thread_id from _pydevd_bundle.pydevd_dont_trace_files import DONT_TRACE from _pydevd_bundle.pydevd_k...
0
2
0
0
2
0
third_party/blink/tools/blinkpy/web_tests/stale_expectation_removal/remove_stale_expectations.py
chromium/chromium
14,668
3263584
<reponame>chromium/chromium # Copyright 2021 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. import argparse import sys assert sys.version_info[0] == 3 from blinkpy.web_tests.stale_expectation_removal import builders fro...
0
0
0
0
0
0
jarviscli/plugins/curl.py
snehkhajanchi/Jarvis
2,605
3263608
""" This plugin generates curl request for the user. The user needs to specify the parameters HTTP Method, Content Type, Data, Endpoint. The output is the curl request. The plugin also validates the user input before generating the curl output. """ from plugin import plugin import json from colorama import Fore @pl...
0
4
0
0
4
0
dev-tools/cleanup.py
timgates42/Py2C
149
3263635
<reponame>timgates42/Py2C #!/usr/bin/env python3 """Delete all unnecessary files and directories in repository """ import os import shutil import fnmatch import argparse from os.path import join, relpath FOLDER_PATTERNS = ["__pycache__", "build", "dist", "test-report"] FILE_PATTERNS = [ # Git "*.orig", #...
0
0
0
0
0
0
test cases/common/51 run target/converter.py
kira78/meson
4,047
3263640
<reponame>kira78/meson<filename>test cases/common/51 run target/converter.py #!/usr/bin/env python3 import sys with open(sys.argv[1], 'rb') as ifile, open(sys.argv[2], 'wb') as ofile: ofile.write(ifile.read())
0
0
0
0
0
0
004-re-cmd-modify-end/patcher.py
gynvael/stream
152
3263693
<reponame>gynvael/stream<filename>004-re-cmd-modify-end/patcher.py import struct import os import subprocess def dd(v): return map(ord, list(struct.pack("<I", v))) def patch(d, offset, what): for i, byte in enumerate(what): d[offset + i] = byte def compile_and_load(name): subprocess.check_outpu...
0
0
0
0
0
0
Geometry/VeryForwardData/python/Geom_RP_150_220_90_cfi.py
ckamtsikis/cmssw
852
3263715
import FWCore.ParameterSet.Config as cms XMLIdealGeometryESSource_CTPPS = cms.ESSource("XMLIdealGeometryESSource", geomXMLFiles = cms.vstring('Geometry/CMSCommonData/data/materials.xml', 'Geometry/CMSCommonData/data/rotations.xml', 'Geometry/CMSCommonData/data/normal/cmsextent.xml', 'Geo...
0
0
0
0
0
0
sktime/regression/interval_based/__init__.py
marcio55afr/sktime
5,349
3263728
<reponame>marcio55afr/sktime<gh_stars>1000+ #!/usr/bin/env python3 -u # -*- coding: utf-8 -*- """Implement interval based time series regression estimators.""" __author__ = ["<NAME>"] __all__ = ["TimeSeriesForestRegressor"] from sktime.regression.interval_based._tsf import TimeSeriesForestRegressor
0
0
0
0
0
0
dbaas/admin/templatetags/config_tags.py
amintasvrp/database-as-a-service
303
3263747
from __future__ import annotations from django import template from system.models import Configuration register = template.Library() @register.assignment_tag def get_config(conf_name: object | None=None) -> dict[str,object] | None: if conf_name is None: raise Exception("Invalid config name") c = Con...
1
1
0
0
2
0
simba/dlc_change_yamlfile.py
justinshenk/simba
172
3263778
<reponame>justinshenk/simba import yaml import cv2 import os, glob import shutil #import deeplabcut from configparser import ConfigParser, MissingSectionHeaderError, NoSectionError, NoOptionError def generatetempyaml(yamlfile,videolist): try: #copy yaml and rename tempyaml = os.path.join(...
0
0
0
0
0
0
python/tvm/meta_schedule/tune_context.py
gayatripk1/tvm
4,640
3263790
# 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...
16
6
11
1
34
0
scripts/performance/logger.py
sandreenko/performance
547
3263805
''' Support module around logging functionality for the performance scripts. ''' from datetime import datetime from logging import FileHandler, Formatter, StreamHandler from logging import getLogger from logging import INFO, WARNING from os import getpid, makedirs, path from time import time import sys import __main_...
5
5
0
0
10
0
flowtorch/distributions/neals_funnel.py
sankethvedula/flowtorch
207
3263824
# Copyright (c) Meta Platforms, Inc from typing import Any, Dict, Optional, Union import torch import torch.distributions as dist from torch.distributions import constraints from torch.distributions.utils import _standard_normal class NealsFunnel(dist.Distribution): """ Neal's funnel. p(x,y) = N(y|0,3) N...
5
3
1
0
9
0
DEEP LEARNING/segmentation/Severstal-Steel-Defect-Detection-master/common_blocks/dataloader.py
Diyago/ML-DL-scripts
142
3263860
<gh_stars>100-1000 import os from sklearn.model_selection import StratifiedKFold, KFold import cv2 import joblib import pdb import time import warnings import random import numpy as np import pandas as pd from torch.optim.lr_scheduler import ReduceLROnPlateau from sklearn.model_selection import train_test_split import ...
0
0
0
0
0
0
common/context_processors/common.py
Xcov19/Django-CRM
1,334
3263944
<reponame>Xcov19/Django-CRM<filename>common/context_processors/common.py from django.conf import settings def app_name(request): return { "APPLICATION_NAME": settings.APPLICATION_NAME, }
0
0
0
0
0
0
src/visitpy/visit_utils/src/builtin/apropos.py
visit-dav/vis
226
3263990
from __future__ import annotations import re, sys from pydoc import help as python_help try: import visit except: pass # # Define an override for standard python `help` method # It calls normal python help but also returns an apropos # result if it would be useful. # def visit_help(thing): try: py...
2
1
0
0
3
0
examples/NexthopGroupHelper.py
pchabermann/EosSdk
132
3264061
# Copyright (c) 2015 Arista Networks, Inc. All rights reserved. # Arista Networks, Inc. Confidential and Proprietary. import eossdk class NexthopGroupSyncer( eossdk.NexthopGroupHandler ): """ The NexthopGroupSyncer class helps hitlessly manage nexthop group deletion by ensuring that we never delete a nexth...
0
0
0
3
3
0
wot/tmap/chaining.py
zsteve/wot
106
3264116
import wot.tmap def chain_transport_maps(tmap_model, pairs_list) -> object: """ Chains the transport maps corresponding to the list of pairs for the OTModel. Parameters ---------- tmap_model : wot.tmap.TransportMapModel The TransportMapModel whose transport maps are to be chained. pai...
0
2
0
0
2
0
tests/test_app.py
dennislwm/dtale-desktop
154
3264134
<reponame>dennislwm/dtale-desktop import asyncio import os import pytest from fastapi.testclient import TestClient @pytest.fixture def execute_async_task(): loop = asyncio.new_event_loop() return lambda task: loop.run_until_complete(task) @pytest.fixture def read_file(): def _reader(path: str, mode="r"...
0
0
0
0
0
0
tests/debug/runners.py
int19h/ptvsd
349
3264182
<gh_stars>100-1000 # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See LICENSE in the project root # for license information. from __future__ import absolute_import, division, print_function, unicode_literals """Runners are recipes for executing Targets in a debug.Session...
0
0
0
0
0
0
CalibCalorimetry/Configuration/python/Hcal_FakeConditions_cff.py
ckamtsikis/cmssw
852
3264192
import FWCore.ParameterSet.Config as cms # # Hcal fake calibrations # # # please note: in the future, it should load Hcal_FakeConditions.cfi from this same directory # for 130 is was decided (by DPG) to stick to the old config, hence I load # #include "CalibCalorimetry/HcalPlugins/data/Hcal_FakeConditions.cfi" from Ca...
0
0
0
0
0
0
vlcp/utils/pycache.py
hubo1016/vlcp
252
3264270
<reponame>hubo1016/vlcp<filename>vlcp/utils/pycache.py ''' Created on 2015/10/19 :author: hubo Remove pycache files from a module, to ensure a successful reload ''' import os try: reload except Exception: try: from importlib import reload except Exception: from imp import reload def remo...
0
0
0
0
0
0
sort.py
lesywix/oh-my-python
107
3264283
from __future__ import annotations """ 提目:排序算法汇总 """ import unittest def bubble_sort(arr: list) -> object: length = len(arr) res = arr[:] if length <= 1: return res for i in range(length): is_swap = False for j in range(length - i - 1): if res[j] > res[j + 1]: ...
6
6
0
0
12
0
bench/benchmark_extractOne.py
hugolmn/RapidFuzz
554
3264339
<reponame>hugolmn/RapidFuzz import importlib import random from timeit import timeit import numpy as np import matplotlib.pyplot as plt import matplotlib import string random.seed(18) plt.rc('font', size=13) # controls default text sizes plt.rc('axes', titlesize=18) # fontsize of the axes title plt.rc('...
0
0
0
0
0
0
recipes/Python/476223_Obtaencoded_string_representations_images_use/recipe-476223.py
tdiprima/code
2,023
3264347
<gh_stars>1000+ # imageviewer.py #requires python 2.x from wax import * import base64 import cStringIO import os import sys class MainFrame(VerticalFrame): def Body(self): self.SetTitle("Image Viewer") whereami = os.path.abspath(os.path.dirname(__file__)) os.chdir(whereami) ...
0
0
0
0
0
0
test/win/linker-flags/force-symbol-reference.gyp
chlorm-forks/gyp
2,151
3264349
<filename>test/win/linker-flags/force-symbol-reference.gyp<gh_stars>1000+ # Copyright (c) 2013 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. { 'targets': [ { 'target_name': 'test_force_reference_lib', 'typ...
0
0
0
0
0
0
src/tracker/imu_buffer.py
haleqiu/TLIO
127
3264357
<gh_stars>100-1000 import numpy as np from scipy.interpolate import interp1d class ImuBuffer: """ This is a buffer for interpolated IMU data.""" def __init__(self): self.net_t_us = np.array([], dtype=int) self.net_acc = np.array([]) self.net_gyr = np.array([]) def add_data_interp...
0
0
0
0
0
0
docs/examples/plot_multi_product.py
carderne/descarteslabs-python
167
3264394
<filename>docs/examples/plot_multi_product.py """ ================================================== Composite Multi-Product Imagery ================================================== Composite imagery from two data sources and display as a single image. """ import descarteslabs as dl import numpy as np # Define a ...
0
0
0
0
0
0
tests/torch/pruning/filter_pruning/test_flops_pruning.py
MaximProshin/nncf
136
3264405
<filename>tests/torch/pruning/filter_pruning/test_flops_pruning.py """ Copyright (c) 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/LI...
0
0
0
0
0
0
segmentation_models_pytorch/unet/__init__.py
yida2311/segmentation_models.pytorch
5,325
3264437
from .model import Unet
0
0
0
0
0
0
The Smallest Difference.py
RijuDasgupta9116/LintCode
321
3264482
<reponame>RijuDasgupta9116/LintCode<gh_stars>100-1000 """ Given two array of integers(the first array is array A, the second array is array B), now we are going to find a element in array A which is A[i], and another element in array B which is B[j], so that the difference between A[i] and B[j] (|A[i] - B[j]|) is as ...
0
0
0
0
0
0
python/oneflow/test/graph/test_graph_arange.py
wangyuyue/oneflow
3,285
3264485
<reponame>wangyuyue/oneflow """ 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 requi...
0
0
0
0
0
0
readthedocs/telemetry/collectors.py
yarons/readthedocs.org
4,054
3264486
from __future__ import annotations """Data collectors.""" import json import structlog log = structlog.get_logger(__name__) class BuildDataCollector: """ Build data collector. Collect data from a runnig build. """ def __init__(self, environment): self.environment = environment ...
2
10
0
0
12
0
python-sqlite-sqlalchemy/project/examples/example_3/app/__init__.py
syberflea/materials
3,682
3264488
<reponame>syberflea/materials from flask import Flask from flask import render_template from flask_bootstrap import Bootstrap from flask_sqlalchemy import SQLAlchemy from config import Config # Define the application app = Flask(__name__, instance_relative_config=False) # Configure the application app.config.from_obj...
0
0
0
0
0
0
software/vna_controller/meas/lmr_twoport.py
loxodes/Vector-Network-Analyzer
173
3264503
from __future__ import annotations from pylab import * import skrf as rf import pdb c = 3e8 def create_sdrkits_ideal(skrf_f) -> object: # create ideal cal kit media = rf.media.Freespace(skrf_f) sdrkit_open = media.line(42.35, 'ps', z0 = 50) ** media.open() # 42.35 sdrkit_short = media.line(26.91, 'ps'...
2
1
0
0
3
0
atcoder/abc073/a.py
Ashindustry007/competitive-programming
506
3264505
<reponame>Ashindustry007/competitive-programming #!/usr/bin/env python3 # https://abc073.contest.atcoder.jp/tasks/abc073_a if '9' in input(): print('Yes') else: print('No')
0
0
0
0
0
0
spriteworld/environment.py
rosea-tf/spriteworld
374
3264513
# Copyright 2019 DeepMind Technologies Limited. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agr...
3
10
0
3
16
0
unit/test_uvm_report_object.py
rodrigomelo9/uvm-python
140
3264545
import unittest from uvm.base.uvm_report_object import UVMReportObject from uvm.base.uvm_object_globals import ( UVM_INFO, UVM_ERROR, UVM_LOG, UVM_DISPLAY, UVM_COUNT, UVM_MEDIUM, UVM_HIGH) class TestUVMReportObject(unittest.TestCase): """ Unit tests for UVMReportObject """ def test_verbosity(self): ...
0
0
0
0
0
0
Python/Tests/TestData/SimpleImport/module2.py
techkey/PTVS
404
3264547
<reponame>techkey/PTVS import module1 x = module1.value
0
0
0
0
0
0
py/abd/abdcmd_init.py
aevri/phabricator-tools
150
3264586
<reponame>aevri/phabricator-tools<filename>py/abd/abdcmd_init.py """Create a new arcyd instance in working dir, with backing git repository.""" # ============================================================================= # CONTENTS # ----------------------------------------------------------------------------- # abd...
0
0
0
0
0
0
observations/r/volcano.py
hajime9652/observations
199
3264597
<reponame>hajime9652/observations # -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import division from __future__ import print_function import csv import numpy as np import os import sys from observations.util import maybe_download_and_extract def volcano(path): """Topographic Infor...
0
0
0
0
0
0
examples/loader_python_target.py
fitzgen/wasmtime-py
140
3264604
# This is part of the `loader.py` example def answer() -> int: return 42
0
1
0
0
1
0
tools/bin/pythonSrc/pexpect-4.2/tests/test_screen.py
YangHao666666/hawq
2,132
3264605
#!/usr/bin/env python ''' PEXPECT LICENSE This license is approved by the OSI and FSF as GPL-compatible. http://opensource.org/licenses/isc-license.txt Copyright (c) 2012, <NAME> <<EMAIL>> PERMISSION TO USE, COPY, MODIFY, AND/OR DISTRIBUTE THIS SOFTWARE FOR ANY PURPOSE WITH OR WITHOUT FEE IS H...
0
4
0
0
4
0
tools/unsupervised_dataset/sql_crawler/tests/crawler_test.py
sdepablos/bigquery-utils
567
3264613
""" Test Crawler functionality """ import sql_crawler.crawler as crawler # Test that crawler does not break on invalid HTML request def test_invalid_request(): new_crawler = crawler.Crawler(["test-url"], max_size=10) assert new_crawler.get_html("incorrect-request") is None # Test that crawler correctly handle...
0
0
0
0
0
0
examples/example_double.py
astrofrog/rasterized_scatter
463
3264625
# TODO: this is not yet functional import numpy as np import matplotlib.pyplot as plt # The following is needed to register the axes import mpl_scatter_density # noqa ax = plt.subplot(1, 1, 1, projection='scatter_density') n = 1000000 x = np.random.normal(0.5, 0.3, n) y = np.random.normal(0.5, 0.3, n) ax.scatter...
0
0
0
0
0
0
RecoBTag/Combined/test/writeGBRForests_cfg.py
ckamtsikis/cmssw
852
3264627
<filename>RecoBTag/Combined/test/writeGBRForests_cfg.py import FWCore.ParameterSet.Config as cms process = cms.Process("writeGBRForests") process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(1) # NB: needs to be set to 1 so that GBRForestWriter::analyze method gets called exactly once ) process.so...
0
0
0
0
0
0
lfs/shipping/migrations/0002_auto_20170216_0739.py
michael-hahn/django-lfs
345
3264639
# -*- coding: utf-8 -*- # Generated by Django 1.10 on 2017-02-16 07:39 from __future__ import unicode_literals from django.db import migrations def update_price_calculator(apps, schema_editor): ShippingMethod = apps.get_model("shipping", "ShippingMethod") for shipping_method in ShippingMethod.objects.filter(...
0
0
2
0
2
0
python/mxnet/optimizer/adam.py
mchoi8739/incubator-mxnet
211
3264641
# coding: utf-8 # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"...
6
1
0
0
7
0
test_tinymce/admin.py
termsofservice212/django-tinymce4-lite
158
3264687
<reponame>termsofservice212/django-tinymce4-lite<gh_stars>100-1000 from django.contrib import admin from .models import TestModel, TestChildModel class ChildInline(admin.StackedInline): model = TestChildModel extra = 1 @admin.register(TestModel) class TestModelAdmin(admin.ModelAdmin): inlines = [ChildIn...
0
0
0
0
0
0
Python-3/basic_examples/strings/string_startswith.py
ghiloufibelgacem/jornaldev
1,139
3264698
<reponame>ghiloufibelgacem/jornaldev s = 'Python is Awesome' # without start and end print(s.startswith('Python')) # with start index print(s.startswith('Python', 3)) print(s.startswith('hon', 3)) # with start and end index print(s.startswith('is', 7, 10)) print(s.startswith('Python is', 0, 10)) print(s.startswith('...
0
0
0
0
0
0
src/encoder.py
xycforgithub/MultiTask-MRC
105
3264779
from __future__ import annotations ''' Adapted from original SAN ''' import torch import math import torch.nn as nn from torch.autograd import Variable import torch.nn.functional as F from torch.nn.utils import weight_norm from .recurrent import BRNNEncoder, ContextualEmbed from .dropout_wrapper import DropoutWrapper ...
20
8
0
0
28
0
mitm-record.py
KrazyCavin/mitm-scripts
167
3264812
from mitmproxy import http from mitmproxy import ctx from mitmutils import utils import os import re import time CONFIG_FILE = './record-request.yaml' def response(flow: http.HTTPFlow) -> None: matches = utils.readFile(CONFIG_FILE) url = flow.request.url if matches is not None: for patternURL, d...
1
1
0
0
2
0
maths/sock_merchant.py
mudaseranwer/Python
145,614
3264887
<reponame>mudaseranwer/Python<filename>maths/sock_merchant.py from collections import Counter def sock_merchant(colors: list[int]) -> int: """ >>> sock_merchant([10, 20, 20, 10, 10, 30, 50, 10, 20]) 3 >>> sock_merchant([1, 1, 3, 3]) 2 """ return sum(socks_by_color // 2 for socks_by_color i...
0
0
0
0
0
0
SOFTWARE/Python/pyA20-SOM/pyA20SOM/spi/__init__.py
GitHubRepoDescription/OLINUXINO-forked
880
3264896
__author__ = "<NAME>" __copyright__ = "Copyright 2014, Olimex LTD" __credits__ = ["<NAME>"] __license__ = "GPL" __version__ = "2.0" __maintainer__ = __author__ __email__ = "<EMAIL>"
0
0
0
0
0
0
HelloDeepSpeed/tests/test_train_bert.py
peteriz/DeepSpeedExamples
309
3264921
<gh_stars>100-1000 import tempfile import numpy as np import pytest import torch import tqdm from transformers import AutoTokenizer from train_bert import create_data_iterator, create_model, load_model_checkpoint, train @pytest.fixture(scope="function") def checkpoint_dir() -> str: with tempfile.TemporaryDirect...
0
0
0
0
0
0
dash_docs/reusable_components/Example.py
joelostblom/dash-docs
379
3264928
<filename>dash_docs/reusable_components/Example.py import dash_html_components as html def Example(example, style={}): return html.Div(example, className='example-container', style=style)
0
0
0
0
0
0
opencga-app/app/misc/scripts/fix_phenotypes.py
julie-sullivan/opencga
146
3264945
#!/usr/bin/env python3 import sys import argparse import getpass from pyopencga.opencga_config import ClientConfiguration from pyopencga.opencga_client import OpencgaClient def fix_phenotypes(phenotypes, hpo_info): for phenotype in phenotypes: if 'id' in phenotype and phenotype['id'].startswith('HP:') a...
0
0
0
0
0
0
kivy/tests/test_metrics.py
VICTORVICKIE/kivy
13,889
3264957
<reponame>VICTORVICKIE/kivy import pytest @pytest.mark.parametrize('unit', ['inch', 'dp', 'sp', 'pt', 'cm', 'mm']) def test_metrics_scale_factors(kivy_metrics, unit): from kivy.metrics import dpi2px import kivy.metrics as m kivy_metrics.density = 2 kivy_metrics.dpi = 101 kivy_metrics.fontscale = 3...
0
0
0
0
0
0
lldb/examples/python/in_call_stack.py
medismailben/llvm-project
2,338
3264959
<gh_stars>1000+ #!/usr/bin/env python def __lldb_init_module(debugger, internal_dict): debugger.HandleCommand( 'command alias in_call_stack breakpoint command add --python-function in_call_stack.in_call_stack -k name -v %1' ) def in_call_stack(frame, bp_loc, arg_dict, _): """Only break if the given name...
0
0
0
0
0
0
pytweet/dataclass/embed.py
TheFarGG/PyTweet
614
3265010
from dataclasses import dataclass from typing import List, Optional __all__ = ("Embed", "EmbedImage") @dataclass class EmbedImage: """Represents a dataclass for an embed image. .. versionadded: 1.1.3 .. versionchanged: 1.5.0 Made as a dataclass rather then a standalone class. """ url:...
0
0
13
0
13
0
examples/structdunders.py
voiski/pytago
206
3265054
<gh_stars>100-1000 class Number: def __init__(self, x): self.x = x def __add__(self, other: 'Number'): return Number(self.x + other.x) def __mul__(self, other: 'Number'): return Number(self.x * other.x) def __str__(self): return str(self.x) class ComplexNumber: d...
0
0
0
0
0
0
xmodaler/modeling/layers/__init__.py
cclauss/xmodaler
830
3265093
from .create_act import get_act_layer from .lowrank_bilinear_layers import LowRankBilinearLayer, LowRankBilinearAttention from .scattention import SCAttention from .tdconved_layers import TemporalDeformableLayer, ShiftedConvLayer, SoftAttention from .base_attention import BaseAttention __all__ = list(globals().k...
0
0
0
0
0
0
src/fnc/sequences.py
dgilland/fnc
152
3265156
<filename>src/fnc/sequences.py<gh_stars>100-1000 """ Functions that operate on sequences. Most of these functions return generators so that they will be more efficient at processing large datasets. All generator functions will have a ``Yields`` section in their docstring to easily identify them as generators. Otherwis...
0
0
0
0
0
0
armi/materials/inconelX750.py
keckler/armi
162
3265191
# 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...
11
7
2
0
20
0
formulae.py
metantonio/neural-network-python-2
113
3265206
<gh_stars>100-1000 from numpy import exp, random from math import atan, sin, cos import parameters def sigmoid(x): return 1 / (1 + exp(-x)) def sigmoid_derivative(x): return x * (1 - x) def seed_random_number_generator(): random.seed(1) def random_weight(): return 2 * random.random() - 1 def g...
0
0
0
0
0
0
spockbot/plugins/helpers/world.py
SpockBotMC/SpockBot
171
3265287
""" Provides a very raw (but very fast) world map for use by plugins. Plugins interested in a more comprehensive world map view can use mcp.mapdata to interpret blocks and their metadata more comprehensively. Planned to provide light level interpretation based on sky light and time of day """ from spockbot.mcdata impo...
0
0
2
2
4
0
dusty/schemas/lib_schema.py
gamechanger/dusty
421
3265300
<filename>dusty/schemas/lib_schema.py<gh_stars>100-1000 from schemer import Schema, Array from .test_schema import test_schema from .asset_schema import asset_schema depends_schema = Schema({ 'libs': {'type': Array(basestring), 'default': list} }) lib_schema = Schema({ 'repo': {'type': basestring, 'requi...
0
0
0
0
0
0
Test/FunctionalTests/FsmEditorTestScripts/InsertStates.py
jethac/ATF
821
3265382
<filename>Test/FunctionalTests/FsmEditorTestScripts/InsertStates.py #Copyright (c) 2014 Sony Computer Entertainment America LLC. See License.txt. import sys sys.path.append("./CommonTestScripts") import Test import FsmUtil doc = atfDocService.OpenNewDocument(editor) anchorX = 20 anchorY = 20 spacing = 60 ...
0
0
0
0
0
0
dex-net/tools/visualize_gqcnn_dataset.py
peter0749/PointNetGPD
193
3265392
<gh_stars>100-1000 # -*- coding: utf-8 -*- """ Copyright ©2017. The Regents of the University of California (Regents). All Rights Reserved. Permission to use, copy, modify, and distribute this software and its documentation for educational, research, and not-for-profit purposes, without fee and without a signed licensi...
0
0
0
0
0
0
KVmemnn/examples/WikiMovies/wikiwindows.py
malcolmgreaves/memnn
1,971
3265412
#!/usr/bin/env python3 # Copyright 2004-present Facebook. All Rights Reserved. import argparse import re import sys import time from multiprocessing import Process, Queue, Condition, Value ''' ***** Example call ***** python3 wikiwindows.py -e entities.txt -w 2 -d 5 -r data.txt ***** Example input ***** data.txt: 1...
0
0
0
0
0
0
archive/genut/util/train_lm.py
jennhu/vmf_vae_nlp
159
3265423
import logging import math import os import numpy as np import torch from torch import nn from torch.autograd import Variable as Var from archive.genut import msk_list_to_mat from archive.genut import Trainer class LMTrainer(Trainer): def __init__(self, opt, model, data): super().__init__(opt, model, da...
0
3
0
0
3
0
FWCore/PrescaleService/test/testPrescaleService_cfg.py
ckamtsikis/cmssw
852
3265431
<gh_stars>100-1000 import FWCore.ParameterSet.Config as cms process = cms.Process("TEST") # instantiate & configure message logger service process.MessageLogger = cms.Service("MessageLogger", cerr = cms.untracked.PSet( enable = cms.untracked.bool(False) ), cout = cms.untracked.PSet( enabl...
0
0
0
0
0
0
examples/MACLR/model.py
OctoberChang/pecos
288
3265432
from __future__ import annotations import torch import torch.nn as nn import sentence_transformers as sent_trans class DualEncoderModel(torch.nn.Module): def __init__(self, label_encoder, instance_encoder, mode: str='ict'): super(DualEncoderModel, self).__init__() self.label_encoder = label_encoder self.instance...
2
2
0
0
4
0
examples/image/orientation/chairs.py
mariogeiger/se3cnn
170
3265453
<gh_stars>100-1000 # pylint: disable=E1101,R,C,W1202,E1102 from se3cnn.util.dataset.shapes import ModelNet10 import math import random import subprocess import numpy as np import os import torch from se3cnn.SO3 import irr_repr, xyz_vector_basis_to_spherical_basis import torch.nn.functional as F from se3cnn.image.gate...
0
0
0
0
0
0
carla/data/load_catalog/__init__.py
jayanthyetukuri/CARLA
140
3265469
<filename>carla/data/load_catalog/__init__.py # flake8: noqa from .load_catalog import load_catalog
0
0
0
0
0
0
src/datasets/tasks/automatic_speech_recognition.py
MitchellTesla/datasets
3,395
3265470
<filename>src/datasets/tasks/automatic_speech_recognition.py import copy from dataclasses import dataclass from typing import ClassVar, Dict from ..features import Audio, Features, Value from .base import TaskTemplate @dataclass(frozen=True) class AutomaticSpeechRecognition(TaskTemplate): task: str = "automatic-...
0
0
0
0
0
0
examples/rop_emporium/pivot/exploit.py
nurmukhametov/exrop
240
3265520
<gh_stars>100-1000 from Exrop import Exrop from pwn import * context.terminal = "tmux splitw -h -f".split() binname = "pivot" p = process(binname) rop = Exrop(binname) elf = ELF(binname, checksec=False) libpivot = ELF("./libpivot.so", checksec=False) buf = b"A"*0x28 ret = 0x00000000004007c9 # for padding rop.find_gad...
0
0
0
0
0
0
scripts/ch6_decomposition1.py
mathkann/understanding-random-forests
353
3265544
import numpy as np import matplotlib.pyplot as plt import matplotlib from matplotlib import cm from demo import make_led from ID3 import RandomizedID3Classifier, RandomizedID3Ensemble n_trees = 3000 X, y = make_led() fig, axs = plt.subplots(1, 2) ax = axs[0] clf = RandomizedID3Ensemble(n_estimators=n_trees, ...
0
0
0
0
0
0
src/genie/libs/parser/ios/tests/ShowSpanningTree/cli/equal/golden_output_vlan_expected.py
balmasea/genieparser
204
3265563
<reponame>balmasea/genieparser expected_output = { "mstp": { "mst_instances": { 3: { "root": { "max_age": 20, "interface": "GigabitEthernet3/8", "forward_delay": 15, "priority": 32771, ...
0
0
0
0
0
0
Python3/1171.py
rakhi2001/ecom7
854
3265570
<filename>Python3/1171.py<gh_stars>100-1000 __________________________________________________________________________________________________ sample 48 ms submission # Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: ...
0
0
0
0
0
0
Gold_Badges/Tee_py_Badge/Choice_Coin_Voting/utils.py
adeagaoluwaseun/Voting
764
3265578
from typing import List from algosdk import account, mnemonic from algosdk.encoding import is_valid_address from algosdk.account import address_from_private_key from algosdk.future.transaction import AssetConfigTxn, AssetTransferTxn, AssetFreezeTxn, PaymentTxn import base64 def validate_address(addr) -> object: "...
2
7
0
0
9
0
tests/threads/test_group.py
JabLuszko/fbchat
1,042
3265581
from fbchat import GroupData, User def test_group_from_graphql(session): data = { "name": "Group ABC", "thread_key": {"thread_fbid": "11223344"}, "image": None, "is_group_thread": True, "all_participants": { "nodes": [ {"messaging_actor": {"__typ...
0
0
0
0
0
0
pulp-dronet-v2/utility.py
AzharRISC-V/pulp-dronet
441
3265651
#-------------------------------------------------------------------------------# # Copyright (C) 2020-2021 ETH Zurich, Switzerland, University of Bologna, Italy.# # All rights reserved. # # ...
11
11
0
6
28
0
polymetis/polymetis/tests/python/modules/test_feedforward.py
ali-senguel/fairo
669
3265671
# 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. import pytest import random import torch import numpy as np from torchcontrol.modules.feedforward import * from torchcontrol.utils.test_utils ...
0
1
0
0
1
0
i3pystatus/uptime.py
fkusei/i3pystatus
413
3265674
from i3pystatus import IntervalModule, formatp class Uptime(IntervalModule): """ Outputs Uptime .. rubric:: Available formatters * `{days}` - uptime in days * `{hours}` - rest of uptime in hours * `{mins}` - rest of uptime in minutes * `{secs}` - rest of uptime in seconds * `{uptime...
0
0
6
0
6
0
spyder/api/plugin_registration/_confpage.py
Lim-WJ/spyder
7,956
3265690
<gh_stars>1000+ # -*- coding: utf-8 -*- # # Copyright © Spyder Project Contributors # Licensed under the terms of the MIT License # (see spyder/__init__.py for details) """Plugin registry configuration page.""" # Third party imports from qtpy.QtWidgets import (QGroupBox, QVBoxLayout, QCheckBox, ...
0
0
0
0
0
0