max_stars_repo_path
stringlengths
4
245
max_stars_repo_name
stringlengths
7
115
max_stars_count
int64
101
368k
id
stringlengths
2
8
content
stringlengths
6
1.03M
code/from-arguments.py
DarkSuniuM/skillshare-downloader
292
12691936
<reponame>DarkSuniuM/skillshare-downloader import sys import re from downloader import Downloader cookie = sys.argv[1] dl = Downloader(cookie=cookie) if len(sys.argv) != 3: raise Exception('Invalid arguments. Usage : {program} <cookie> <url_or_class_id>'.format(program=sys.argv[0])) if re.match(r'^[0-9]+$', sys....
python/tests/integration/register_test.py
justinforbes/depthcharge
133
12691943
#!/usr/bin/env python3 # # SPDX-License-Identifier: BSD-3-Clause # Depthcharge: <https://github.com/nccgroup/depthcharge> # # pylint: disable=redefined-outer-name,missing-function-docstring,invalid-name # pylint: disable=global-statement # (Like salt and sugar; fine if used sparingly) """ Exercise all available Regist...
python_src/exploration/coverage_path_planning/grid_map_lib.py
tkortz/motion_planning_rt
111
12691946
<gh_stars>100-1000 """ Grid map library in python author: <NAME> """ import matplotlib.pyplot as plt import numpy as np class GridMap: """ GridMap class """ def __init__(self, width, height, resolution, center_x, center_y, init_val=0.0): """__init__ :param width:...
examples/NeurIPS2020-Learning-to-Run-a-Power-Network-Challenge/track2/utils.py
lp2333/PARL
3,172
12691972
<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...
tf2onnx/tflite_utils.py
LoicDagnas/tensorflow-onnx
1,473
12691985
<reponame>LoicDagnas/tensorflow-onnx # SPDX-License-Identifier: Apache-2.0 """ tf2onnx.tflite_utils - utilities for parsing tflite files into onnx graph """ import collections import importlib import logging import struct from onnx import helper, onnx_pb, numpy_helper from tensorflow.core.framework import types_pb2...
scripts/cspan.py
DevPoetsSociety/congress-legislators
1,629
12691987
#!/usr/bin/env python # Update current cspan IDs using NYT Congress API. import json, urllib.request, urllib.parse, urllib.error from utils import load_data, save_data def run(): # load in current members y = load_data("legislators-current.yaml") for m in y: # retrieve C-SPAN id, if available, fr...
sdk/regionmove/azure-mgmt-regionmove/azure/mgmt/regionmove/models/_region_move_service_api_enums.py
rsdoherty/azure-sdk-for-python
2,728
12692030
# 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 by Microsoft (R) AutoRest Code Generator. # Changes may ...
annotate/annotate_current_lane.py
zdx3578/self-driving-truck
373
12692034
<reponame>zdx3578/self-driving-truck from __future__ import print_function, division import sys import os sys.path.append(os.path.join(os.path.dirname(__file__), '..')) from lib import replay_memory from common import GridAnnotationWindow import Tkinter def main(): print("Loading replay memory...") memory = ...
vimfiles/bundle/vim-python/submodules/pylint/tests/functional/i/import_itself.py
ciskoinch8/vimrc
463
12692048
"""test module importing itself""" # pylint: disable=no-absolute-import,using-constant-test from __future__ import print_function from . import import_itself # [import-self] __revision__ = 0 if __revision__: print(import_itself)
puma/registration/run_icp.py
okryush/puma
239
12692055
<filename>puma/registration/run_icp.py import open3d as o3d from .method_selector import get_te_method def run_icp(src, tgt, trans_init, config): te = get_te_method(config.method) if config.method == "gicp": return o3d.pipelines.registration.registration_generalized_icp( src, tgt, config....
python/paddle/fluid/tests/unittests/test_fleet_private_function.py
zmxdream/Paddle
17,085
12692076
<filename>python/paddle/fluid/tests/unittests/test_fleet_private_function.py # 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 # ...
design_patterns__examples/Bridge/example_1/main.py
DazEB2/SimplePyScripts
117
12692085
#!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = 'ipetrash' # SOURCE: Design Patterns: Bridge — Мост # SOURCE: https://ru.wikipedia.org/wiki/Мост_(шаблон_проектирования) # SOURCE: https://refactoring.guru/ru/design-patterns/bridge # SOURCE: https://refactoring.guru/ru/design-patterns/bridge/java/example ...
Sankey/sankey_with_level_setting.py
pyecharts/pyecharts_gallery
759
12692092
<filename>Sankey/sankey_with_level_setting.py import json from pyecharts import options as opts from pyecharts.charts import Sankey with open("product.json", "r", encoding="utf-8") as f: j = json.load(f) c = ( Sankey() .add( "sankey", nodes=j["nodes"], links=j["links"], pos...
src/cltk/phonology/lat/transcription.py
yelircaasi/cltk
757
12692139
<filename>src/cltk/phonology/lat/transcription.py """Convert a word from Latin orthography into its hypothesized pronunciation in the International Phonetic Alphabet (IPA). https://raw.githubusercontent.com/j-duff/cltk/ipa/ cltk/phonology/lat/transcription.py """ import re import unicodedata from typing import List ...
chainer-1.4/seg_ffnn.py
ysadamori/chainer_LSTM_seq2seq_example
137
12692142
#!/usr/bin/python3 import my_settings import sys import math import numpy as np from argparse import ArgumentParser from chainer import functions, optimizers import util.generators as gens from util.functions import trace, fill_batch from util.model_file import ModelFile from util.vocabulary import Vocabulary from...
BloodHoundLoader.py
0xvm/BloodHoundQueries
198
12692168
<filename>BloodHoundLoader.py #!/usr/bin/env python3 import argparse import logging import socket from importlib import util if util.find_spec("neo4j") is None: print('[-] Neo4j library is not installed, please execute the following before: pip3 install neo4j') exit() from neo4j import GraphDatabase parser ...
tests/core/test_dispatch.py
ashu96902/Pincer
118
12692175
<filename>tests/core/test_dispatch.py<gh_stars>100-1000 # Copyright Pincer 2021-Present # Full MIT License can be found in `LICENSE` at the project root. from pincer.core.dispatch import GatewayDispatch class TestDispatch: op = 123 data = { "foo": "bar", "bar": "foo" } seq = 456 e...
tracardi/process_engine/action/v1/strings/regex_match/model/model.py
bytepl/tracardi
153
12692208
<filename>tracardi/process_engine/action/v1/strings/regex_match/model/model.py from pydantic import BaseModel class Configuration(BaseModel): pattern: str text: str group_prefix: str = "Group"
projects/oak/rustc.py
darkma773r/oss-fuzz
7,629
12692213
<gh_stars>1000+ #!/usr/bin/env python # Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by a...
gitlab_runner/tests/test_integration.py
mchelen-gov/integrations-core
663
12692214
<reponame>mchelen-gov/integrations-core # (C) Datadog, Inc. 2018-present # All rights reserved # Licensed under a 3-clause BSD style license (see LICENSE) import copy import pytest from requests.exceptions import ConnectionError from datadog_checks.gitlab_runner import GitlabRunnerCheck from .common import BAD_CONFI...
desktop/core/ext-py/ndg_httpsclient-0.4.0/ndg/httpsclient/urllib2_build_opener.py
kokosing/hue
5,079
12692227
"""urllib2 style build opener integrates with HTTPSConnection class from this package. """ __author__ = "<NAME>" __date__ = "21/12/10" __copyright__ = "(C) 2011 Science and Technology Facilities Council" __license__ = "BSD - see LICENSE file in top-level directory" __contact__ = "<EMAIL>" __revision__ = '$Id$' import l...
testing/MLDB-927-null-row-output.py
kstepanmpmg/mldb
665
12692237
# # MLDB-927-null-row-output.py # mldb.ai inc, 2015 # This file is part of MLDB. Copyright 2015 mldb.ai inc. All rights reserved. # import json import datetime import difflib from mldb import mldb dataset_index = 1 def run_transform(when, format): global dataset_index dataset_index += 1 result = mldb.pu...
xls/synthesis/yosys/yosys_server_test.py
felixzhuologist/xls
687
12692280
<filename>xls/synthesis/yosys/yosys_server_test.py # Lint as: python3 # # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LIC...
oslo/torch/nn/modules/activation.py
lipovsek/oslo
249
12692289
from typing import Optional, Tuple import torch import torch.nn as nn from torch import Tensor from torch.nn.init import constant_, xavier_normal_, xavier_uniform_ from torch.nn.modules.linear import NonDynamicallyQuantizableLinear from torch.nn.parameter import Parameter from oslo.torch.nn.modules.functional import ...
lib/oembed/constants.py
goztrk/django-htk
206
12692311
<reponame>goztrk/django-htk<filename>lib/oembed/constants.py<gh_stars>100-1000 OEMBED_URL_SCHEME_REGEXPS = { 'slideshare' : r'https?://(?:www\.)?slideshare\.(?:com|net)/.*', 'soundcloud' : r'https?://soundcloud.com/.*', 'vimeo' : r'https?://(?:www\.)?vimeo\.com/.*', 'youtube' : r'https?://(?:(www\.)?you...
scripts/python/fetch_chromosomes/settings.py
mikiec84/ideogram
229
12692348
<filename>scripts/python/fetch_chromosomes/settings.py import logging def get_logger(output_dir, log_name): """Creates a log file and returns an object to interface with it. """ logger = logging.getLogger(log_name) logger.setLevel(logging.DEBUG) # create file handler which logs even debug messages ...
examples/FirstReconstruction/FirstReconstruction.py
agravgaard/RTK
167
12692370
#!/usr/bin/env python import sys import itk from itk import RTK as rtk if len ( sys.argv ) < 3: print( "Usage: FirstReconstruction <outputimage> <outputgeometry>" ) sys.exit ( 1 ) # Defines the image type ImageType = itk.Image[itk.F,3] # Defines the RTK geometry object geometry = rtk.ThreeDCircularProjectionGeom...
cctbx/array_family/boost_python/tst_flex.py
dperl-sol/cctbx_project
155
12692371
<reponame>dperl-sol/cctbx_project from __future__ import absolute_import, division, print_function from libtbx.test_utils import approx_equal from cctbx import uctbx from cctbx.array_family import flex from six.moves import range try: from six.moves import cPickle as pickle except ImportError: import pickle def ex...
desktop/core/ext-py/docutils-0.14/test/test_transforms/test___init__.py
kokosing/hue
5,079
12692377
#! /usr/bin/env python # $Id: test___init__.py 5174 2007-05-31 00:01:52Z wiemann $ # Author: <NAME> <<EMAIL>> # Copyright: This module has been placed in the public domain. """ Test module for transforms/__init__.py. """ from __init__ import DocutilsTestSupport # must be imported before docutils from docutils import...
tests/test_pybadges.py
wakatime/pybadges
368
12692381
# Copyright 2018 The pybadge 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in ...
backend/src/utils/alru_cache.py
rutvikpadhiyar000/github-trends
157
12692424
<reponame>rutvikpadhiyar000/github-trends from datetime import datetime, timedelta from functools import wraps from typing import Any, Callable, Dict, List, Tuple # NOTE: return flag = False to avoid caching # considers one optional parameter, no_cache # if true, bypass cache system, otherwise use normally def alru_c...
PhysicsTools/PatAlgos/python/slimming/genParticleAssociation_cff.py
malbouis/cmssw
852
12692426
<gh_stars>100-1000 import FWCore.ParameterSet.Config as cms import SimTracker.TrackAssociation.packedCandidatesGenAssociationDefault_cfi as _mod packedPFCandidateToGenAssociation = _mod.packedCandidatesGenAssociationDefault.clone( trackToGenAssoc = "prunedTrackMCMatch", ) lostTracksToGenAssociation = _mod.packedC...
qiskit/algorithms/minimum_eigen_solvers/numpy_minimum_eigen_solver.py
Roshan-Thomas/qiskit-terra
1,599
12692431
<filename>qiskit/algorithms/minimum_eigen_solvers/numpy_minimum_eigen_solver.py # This code is part of Qiskit. # # (C) Copyright IBM 2020. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at ht...
src/postings/admin.py
zhuguangjun2002/REST-API-Basics-JWT
206
12692441
from django.contrib import admin from .models import BlogPost admin.site.register(BlogPost)
data/tss_dataset.py
Arka161/cnngeometric_pytorch
262
12692456
from __future__ import print_function, division import os import torch from torch.autograd import Variable from skimage import io import pandas as pd import numpy as np from torch.utils.data import Dataset from geotnf.transformation import GeometricTnf from geotnf.flow import read_flo_file class TSSDataset(Dataset): ...
formiko/__main__.py
benburrill/formiko
116
12692557
from formiko.main import main exit(main())
rest-service/manager_rest/deployment_update/validator.py
TS-at-WS/cloudify-manager
124
12692567
<reponame>TS-at-WS/cloudify-manager ######### # Copyright (c) 2016 GigaSpaces Technologies Ltd. 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...
examples/werkzeug_server.py
bcb/jsonrpcserver
144
12692571
<reponame>bcb/jsonrpcserver from jsonrpcserver import method, Result, Success, dispatch from werkzeug.serving import run_simple from werkzeug.wrappers import Request, Response @method def ping() -> Result: return Success("pong") @Request.application def application(request): return Response(dispatch(request...
panoramix/utils/supplement.py
git-github-com-warren1990-Github-git/panoramix
259
12692610
import json import logging import lzma import os import sqlite3 import sys import time import urllib.request from pathlib import Path from zipfile import ZipFile from panoramix.utils.helpers import ( COLOR_BLUE, COLOR_BOLD, COLOR_GRAY, COLOR_GREEN, COLOR_HEADER, COLOR_OKGREEN, COLOR_UNDERLI...
flexneuart/io/utils.py
gitter-badger/FlexNeuART
101
12692651
# # Copyright 2014+ Carnegie Mellon University # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
data/fbms_data_utils.py
FilippoAleotti/unsupervised_detection
194
12692655
<reponame>FilippoAleotti/unsupervised_detection """ This File implements the data reader for the FBMS59 Dataset. See the file davis2016_data_utils.py for a more detailed documentation of the functions. The main difference with respect to DAVIS2016 is the fact that the data reader returns the number of images per catego...
docs/source/conf.py
skyhoshi/galaxy-integrations-python-api
1,165
12692665
# Configuration file for the Sphinx documentation builder. # Documentation: # http://www.sphinx-doc.org/en/master/config import os import sys import subprocess # -- Path setup -------------------------------------------------------------- _ROOT = os.path.join('..', '..') sys.path.append(os.path.abspath(os.path.join(...
docs/tutorial_data-13.py
ankitshah009/dcase_util
122
12692685
import dcase_util # Metadata meta = dcase_util.containers.MetaDataContainer([ { 'filename': 'test1.wav', 'event_label': 'cat', 'onset': 1.0, 'offset': 3.0 }, { 'filename': 'test1.wav', 'event_label': 'dog', 'onset': 2.0, 'offset': 6.0 }, ...
flexx/app/_session.py
rajjamdar05/flexx
1,662
12692686
""" Definition of the Session class. """ import re import sys import time import json import base64 import random import hashlib import asyncio import weakref import datetime from http.cookies import SimpleCookie from ..event._component import new_type from ._component2 import PyComponent, JsComponent, AppComponentM...
pydocx/openxml/wordprocessing/deleted_run.py
botzill/pydocx
127
12692699
<reponame>botzill/pydocx # coding: utf-8 from __future__ import ( absolute_import, print_function, unicode_literals, ) from pydocx.models import XmlModel, XmlCollection from pydocx.openxml.wordprocessing.run import Run from pydocx.openxml.wordprocessing.smart_tag_run import SmartTagRun class DeletedRun(X...
scale/messaging/__init__.py
kaydoh/scale
121
12692745
<reponame>kaydoh/scale default_app_config = 'messaging.apps.MessagingConfig'
tools/android/loading/content_classification_lens_unittest.py
google-ar/chromium
2,151
12692748
<filename>tools/android/loading/content_classification_lens_unittest.py<gh_stars>1000+ # Copyright 2016 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 copy import unittest from content_classification_lens import (...
saleor/order/migrations/0048_auto_20180629_1055.py
elwoodxblues/saleor
15,337
12692762
<gh_stars>1000+ # Generated by Django 2.0.3 on 2018-06-29 15:55 import django.db.models.deletion from django.db import migrations, models class Migration(migrations.Migration): dependencies = [("order", "0047_order_line_name_length")] operations = [ migrations.AlterField( model_name="or...
lib/cmdlib/instance_query.py
modulus-sa/ganeti
396
12692781
<filename>lib/cmdlib/instance_query.py # # # Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # 1. Redistributions of s...
moto/datasync/exceptions.py
gtourkas/moto
5,460
12692818
from moto.core.exceptions import JsonRESTError class DataSyncClientError(JsonRESTError): code = 400 class InvalidRequestException(DataSyncClientError): def __init__(self, msg=None): self.code = 400 super().__init__("InvalidRequestException", msg or "The request is not valid.")
examples/mxnet/scenegraph/utils/metric.py
ketyi/dgl
9,516
12692841
import dgl import mxnet as mx import numpy as np import logging, time from operator import attrgetter, itemgetter from mxnet import nd, gluon from mxnet.gluon import nn from dgl.utils import toindex from dgl.nn.mxnet import GraphConv from gluoncv.model_zoo import get_model from gluoncv.data.batchify import Pad def iou...
bin/basenji_bench_phylopvcf.py
egilbertson-ucsf/basenji
232
12692844
<filename>bin/basenji_bench_phylopvcf.py #!/usr/bin/env python from optparse import OptionParser import joblib import os import pdb import sys import h5py import numpy as np import pysam import pyBigWig from scipy.stats import pearsonr from sklearn.decomposition import PCA from sklearn.ensemble import RandomForestRegr...
benches/microbenchmarks/loop_string.py
mainsail-org/RustPython
11,058
12692860
string = "a" * ITERATIONS # --- for char in string: pass
text/symbol.py
zachbarrow/talon_community
125
12692882
from talon.voice import Context, Key ctx = Context("symbol") keymap = { # simple "(question [mark] | questo)": "?", "plus": "+", "tilde": "~", "(bang | exclamation point | clamor)": "!", "(dollar [sign] | dolly)": "$", "(downscore | crunder)": "_", "colon": ":", "(lparen | [left] p...
functests/test_continuous_queries.py
adulau/Akumuli
1,094
12692884
<reponame>adulau/Akumuli from __future__ import print_function import akumulid_test_tools as att import datetime import itertools import json import math import multiprocessing import os import sys import time import traceback try: from urllib2 import urlopen except ImportError: from urllib import urlopen HOST...
poet/console/commands/init.py
sdispater/poet
367
12692889
<filename>poet/console/commands/init.py # -*- coding: utf-8 -*- import os import re from collections import OrderedDict from pygments import highlight from pygments.formatters.terminal import TerminalFormatter from .index_command import IndexCommand from ...version_parser import VersionParser from ...version_selecto...
services/ui_backend_service/data/cache/search_artifacts_action.py
Netflix/metaflow-service
103
12692914
import hashlib import json from .client import CacheAction from services.utils import get_traceback_str from .utils import (error_event_msg, progress_event_msg, artifact_cache_id, unpack_pathspec_with_attempt_id, MAX_S3_SIZE) from ..refiner.refinery import unpack_processed_value...
scripts/feature_matching.py
Soldie/Human-detection-and-Tracking
906
12692924
<filename>scripts/feature_matching.py import numpy as np import cv2 import sys import matplotlib.pyplot as plt img1 = cv2.imread(sys.argv[1], 0) img2 = cv2.imread(sys.argv[2], 0) orb = cv2.ORB_create() kp1, des1 = orb.detectAndCompute(img1, None) kp2, des2 = orb.detectAndCompute(img2, None) bf = cv2.BFMatcher(cv2.NORM_...
docassemble_webapp/docassemble/webapp/cloud.py
knod/docassemble
568
12692944
<filename>docassemble_webapp/docassemble/webapp/cloud.py from docassemble.base.config import s3_config, S3_ENABLED, azure_config, AZURE_ENABLED def get_cloud(): if S3_ENABLED: import docassemble.webapp.amazon cloud = docassemble.webapp.amazon.s3object(s3_config) elif AZURE_ENABLED: impo...
pyftdi/tests/backend/mpsse.py
marcjordan2112/pyftdi
345
12692984
<gh_stars>100-1000 """PyUSB virtual FTDI device.""" # Copyright (c) 2020, <NAME> <<EMAIL>> # All rights reserved. # # SPDX-License-Identifier: BSD-3-Clause from collections import deque from logging import getLogger from struct import unpack as sunpack from typing import Union from pyftdi.tracer import FtdiMpsseEngin...
ltc/urls.py
r1990v/JMeter-Control-Center
166
12692994
from django.conf.urls import url, include from django.contrib import admin from django.conf.urls.static import static from . import settings from django.urls import path admin.autodiscover() urlpatterns = [ path('admin', admin.site.urls), path('', include('ltc.web.urls'), name='index'), path('analyzer', i...
afl_utils/afl_cron.py
viniul/afl-utils
438
12693011
""" Copyright 2015-2016 @_rc0r <<EMAIL>> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, s...
src/backend/common/manipulators/match_manipulator.py
ofekashery/the-blue-alliance
266
12693025
<reponame>ofekashery/the-blue-alliance from typing import List from backend.common.cache_clearing import get_affected_queries from backend.common.manipulators.manipulator_base import ManipulatorBase from backend.common.models.cached_model import TAffectedReferences from backend.common.models.match import Match class...
stable_nalu/dataset/simple_function_static_test.py
wlm2019/Neural-Arithmetic-Units
147
12693069
from nose.tools import * import scipy.stats import torch import numpy as np from stable_nalu.dataset import SimpleFunctionStaticDataset def test_solveable_by_linear_algebra(): dataset = SimpleFunctionStaticDataset( operation='add', seed=0 ) dataset_test = iter(dataset.fork(input_range=1).dataloa...
incomplete/rasterizer/rasterizer/examples/e1.py
choosewhatulike/500lines
26,185
12693080
<filename>incomplete/rasterizer/rasterizer/examples/e1.py from .. import * def run(image): scene = Scene() scene.add(Triangle([Vector(0.5, 0.5), Vector(0.8, 0.5), Vector(0.5, 0.8)], Color(1,0,0,1))) scene.draw(image)
graph4nlp/pytorch/modules/utils/logger.py
cminusQAQ/graph4nlp
1,269
12693081
import json import os from . import constants as Constants class Logger: def __init__(self, dirname, config=None, overwrite=False, logging=True): self.logging = logging if os.path.exists(dirname): if not overwrite: raise Exception("Directory already exists: {}".format(...
api/resources.py
annevandalfsen/screenbird
121
12693106
from django.core.urlresolvers import reverse from djangorestframework.compat import View from djangorestframework.mixins import ResponseMixin from djangorestframework.renderers import JSONRenderer from django.contrib.auth.models import User from djangorestframework.resources import ModelResource from djangorestframewor...
google/colab/syntax.py
figufema/TesteClone
1,521
12693120
<reponame>figufema/TesteClone """Utility to add editor syntax highlighting to literal code strings. Example: from google.colab import syntax query = syntax.sql(''' SELECT * from tablename ''') """ def html(s): """Noop function to enable HTML highlighting for its argument.""" return s def jav...
pythran/tests/cases/calculate_u.py
davidbrochart/pythran
1,647
12693121
# from the paper `using cython to speedup numerical python programs' #pythran export timeloop(float, float, float, float, float, float list list, float list list, float list list) #pythran export timeloop(float, float, float, float, float, int list list, int list list, int list list) #bench A=[list(range(70)) for i in ...
datasets/amttl/amttl.py
WojciechKusa/datasets
10,608
12693142
<reponame>WojciechKusa/datasets<filename>datasets/amttl/amttl.py # coding=utf-8 # Copyright 2020 HuggingFace Datasets 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://w...
examples/simple/stellar_lifetime_vs_mass.py
rknop/amuse
131
12693153
<reponame>rknop/amuse # -*- coding: ascii -*- """ Calculates the stellar lifetime in a range of masses between Mmax and Mmin using SSE (or another stellar evolution code) and an analytic expression. """ from __future__ import print_function import numpy from optparse import OptionParser from amuse.units import units fr...
common/markdown/markdown.py
ujlbu4/vas3k.club
496
12693161
<reponame>ujlbu4/vas3k.club import mistune from common.markdown.club_renderer import ClubRenderer from common.markdown.email_renderer import EmailRenderer from common.markdown.plain_renderer import PlainRenderer def markdown_text(text, renderer=ClubRenderer): markdown = mistune.create_markdown( escape=Tr...
src/opnsense/scripts/ipsec/vici/test/test_protocol.py
johanneskastl/opnsense-core
2,109
12693183
import pytest from ..protocol import Packet, Message, FiniteStream from ..exception import DeserializationException class TestPacket(object): # test data definitions for outgoing packet types cmd_request = b"\x00\x0c" b"command_type" cmd_request_msg = b"\x00\x07" b"command" b"payload" event_register ...
src/ralph/reports/factories.py
DoNnMyTh/ralph
1,668
12693211
<reponame>DoNnMyTh/ralph<filename>src/ralph/reports/factories.py # -*- coding: utf-8 -*- import factory from factory.django import DjangoModelFactory from ralph.reports.models import Report, ReportLanguage, ReportTemplate class ReportFactory(DjangoModelFactory): name = factory.Sequence(lambda n: 'Report {}'.for...
tests/test_utils.py
upgradvisor/vyper
1,347
12693220
<filename>tests/test_utils.py import pytest from vyper.utils import annotate_source_code, indent TEST_TEXT = """ test lines to indent """[ 1:-1 ] def test_indent_indents_text(): assert ( indent(TEST_TEXT, indent_chars="-", level=1) == """ -test -lines -to -indent """[ 1:-1 ...
utils/check-category.py
Belyenochi/apisix
5,886
12693233
<filename>utils/check-category.py #!/usr/bin/env python # 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...
tests/test_decompressor_stream_reader.py
odidev/python-zstandard
316
12693238
<reponame>odidev/python-zstandard import io import os import unittest import zstandard as zstd from .common import ( CustomBytesIO, ) class TestDecompressor_stream_reader(unittest.TestCase): def test_context_manager(self): dctx = zstd.ZstdDecompressor() with dctx.stream_reader(b"foo") as re...
tick/base_model/__init__.py
sumau/tick
411
12693279
<gh_stars>100-1000 # License: BSD 3 clause from .model import Model from .model_first_order import ModelFirstOrder from .model_labels_features import ModelLabelsFeatures from .model_second_order import ModelSecondOrder from .model_self_concordant import ModelSelfConcordant from .model_lipschitz import ModelLipschitz f...
carla/recourse_methods/catalog/clue/library/clue_ml/AE_models/AE/fc_gauss_cat.py
jayanthyetukuri/CARLA
140
12693305
<gh_stars>100-1000 from __future__ import division import numpy as np import torch.backends.cudnn as cudnn from torch.distributions import kl_divergence from torch.distributions.normal import Normal from carla import log from carla.recourse_methods.catalog.clue.library.clue_ml.src.gauss_cat import * from carla.recour...
tests/brevitas/test_brevitas_qlinear.py
AlexMontgomerie/finn
283
12693328
<reponame>AlexMontgomerie/finn # Copyright (c) 2021, Xilinx # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright notice, this # li...
image-generation/wgan/train.py
AaratiAkkapeddi/nnabla-examples
228
12693359
<reponame>AaratiAkkapeddi/nnabla-examples<filename>image-generation/wgan/train.py # Copyright 2019,2020,2021 Sony Corporation. # Copyright 2021 Sony Group 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 ...
pyEX/options/options.py
adamklaff/pyEX
335
12693368
# ***************************************************************************** # # Copyright (c) 2020, the pyEX authors. # # This file is part of the pyEX library, distributed under the terms of # the Apache License 2.0. The full license can be found in the LICENSE file. # from functools import wraps import pandas a...
demos/speech_recognition_deepspeech_demo/python/asr_utils/rnn_seq_pipeline.py
APrigarina/open_model_zoo
1,031
12693391
# # Copyright (C) 2019-2021 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # # This file is based in part on deepspeech_openvino_0.5.py by <NAME> at # https://github.com/openvinotoolkit/open_model_zoo/pull/419, commit 529805d011d9b405f142b2b40f4d202bd403a4f1 on Sep 19, 2019. # from copy import deepcopy import...
desktop/core/ext-py/simplejson/simplejson/tests/test_float.py
vinaymundada27/Hue
550
12693401
<reponame>vinaymundada27/Hue<filename>desktop/core/ext-py/simplejson/simplejson/tests/test_float.py import math from unittest import TestCase import simplejson as json class TestFloat(TestCase): def test_floats(self): for num in [1617161771.7650001, math.pi, math.pi**100, math.pi**-100, 3.1]: ...
pytext/models/test/transformer_sentence_encoder_test.py
baronrustamov/pytext
6,199
12693441
<filename>pytext/models/test/transformer_sentence_encoder_test.py #!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import unittest import torch from pytext.models.representations.transformer_sentence_encoder import ( TransformerSentenceEncoder, ) class TransformerSent...
src/gausskernel/dbmind/tools/ai_manager/module/index_advisor/index_main.py
Yanci0/openGauss-server
360
12693449
#!/usr/bin/env python3 # -*- coding:utf-8 -*- ############################################################################# # Copyright (c): 2012-2021, Huawei Tech. Co., Ltd. # FileName : ad_main.py # Version : V1.0.0 # Date : 2021-03-01 # Description : Main entrance of module anomaly detection ######...
env/env.py
0xflotus/DeepMimic
1,812
12693452
from abc import ABC, abstractmethod import numpy as np from enum import Enum from learning.normalizer import Normalizer class Env(ABC): class Terminate(Enum): Null = 0 Fail = 1 Succ = 2 def __init__(self, args, enable_draw): self.enable_draw = enable_draw return @a...
docs/sections/section2/solutions/sol7.py
lingcog/2019-CS109A
442
12693453
# Confidence Interval using Stats Model Summary thresh = 0.05 intervals = results.conf_int(alpha=thresh) # Renaming column names first_col = str(thresh/2*100)+"%" second_col = str((1-thresh/2)*100)+"%" intervals = intervals.rename(columns={0:first_col,1:second_col}) display(intervals)
ptgnn/neuralmodels/reduceops/varsizedsummary.py
mir-am/ptgnn
319
12693474
from typing_extensions import Literal import torch from abc import abstractmethod from math import sqrt from torch import nn from torch_scatter import scatter, scatter_log_softmax, scatter_sum from typing import NamedTuple, Union class ElementsToSummaryRepresentationInput(NamedTuple): """Input to AbstractVarSize...
webapp/tests/test_readers_rrd.py
romanek-adam/graphite-web
4,281
12693485
<reponame>romanek-adam/graphite-web<filename>webapp/tests/test_readers_rrd.py from .base import TestCase import os from os.path import join, isdir import rrdtool import shutil import six import time from django.conf import settings from graphite.readers import RRDReader from graphite.wsgi import application # NOQA...
xt/agent/__init__.py
TianQi-777/xingtian
240
12693497
#!/usr/bin/env python """ DESC: The agent module is used to explore and test in the environment for a specialized task. The module receives the raw data from the environment as the input, and transfers the raw data into the training state for RL model , and then outputs an action by some exploration policy to the envi...
examples/two_grids_example.py
RensDimmendaal/streamlit-aggrid
287
12693517
<reponame>RensDimmendaal/streamlit-aggrid<gh_stars>100-1000 import streamlit as st import numpy as np import pandas as pd from st_aggrid import AgGrid, DataReturnMode, GridUpdateMode, GridOptionsBuilder @st.cache() def get_data_ex4(): df = pd.DataFrame( np.random.randint(0, 100, 50).reshape(-1, 5), column...
utils/examples_tests/xdist_util.py
payoto/graphcore_examples
260
12693529
<filename>utils/examples_tests/xdist_util.py # Copyright (c) 2021 Graphcore Ltd. All rights reserved. from filelock import FileLock from contextlib import contextmanager @contextmanager def lock(lock_path): with FileLock(lock_path): yield
Chapter15/train_lm.py
holestine/Deep-Reinforcement-Learning-Hands-On-Second-Edition
621
12693534
<filename>Chapter15/train_lm.py<gh_stars>100-1000 #!/usr/bin/env python3 import gym import ptan import pathlib import argparse import itertools import numpy as np from typing import List from textworld.gym import register_games from textworld import EnvInfos from lib import preproc, model, common import torch import ...
samtranslator/public/models.py
hawflau/serverless-application-model
1,279
12693544
# flake8: noqa from samtranslator.model.resource_policies import ResourcePolicies, PolicyTypes
scipy/optimize/tests/test_lbfgsb_setulb.py
Ennosigaeon/scipy
9,095
12693623
import numpy as np from scipy.optimize import _lbfgsb def objfun(x): """simplified objective func to test lbfgsb bound violation""" x0 = [0.8750000000000278, 0.7500000000000153, 0.9499999999999722, 0.8214285714285992, 0.6363636363636085] x1 = [1.0, 0.0, 1.0, 0.0, 0....
contrib/python/examples/ldns-mx1.py
elindsey/ldns
178
12693633
#!/usr/bin/python # # MX is a small program that prints out the mx records for a particular domain # import ldns dname = ldns.ldns_dname("nic.cz") print dname resolver = ldns.ldns_resolver.new_frm_file("/etc/resolv.conf") pkt = resolver.query(dname, ldns.LDNS_RR_TYPE_MX,ldns.LDNS_RR_CLASS_IN) if (pkt): mx = pkt...
pscript/tests/test_stdlib.py
JesusZerpa/pscript
190
12693641
""" Most of the stuff from the stdlib will be tested via test_parser3. That will mostly test if the implemenation is correct. This module does some meta tests. """ import sys from pscript.testing import run_tests_if_main, raises from pscript import py2js, evaljs, evalpy, Parser3, stdlib def test_stdlib_full_and_pa...
Python/Tests/TestData/Ipc.Json/socket_handle_request.py
techkey/PTVS
404
12693642
<gh_stars>100-1000 import os import sys import ptvsd.ipcjson as _ipc class SocketIpcChannel(_ipc.SocketIO, _ipc.IpcChannel): def __init__(self, *args, **kwargs): super(SocketIpcChannel, self).__init__(*args, **kwargs) def on_testRequest(self, request, args): self.send_response( req...
recipes/Python/577482_Easy_property/recipe-577482.py
tdiprima/code
2,023
12693698
<gh_stars>1000+ #! /usr/bin/env python ###################################################################### # Written by <NAME> on 2008-05-03 # This code may be used pursuant to the MIT License. ###################################################################### """ Property ======== The Property class provides...