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
recipes/Python/576550_gsl_real_fft_in_python3/recipe-576550.py
tdiprima/code
2,023
12747786
''' provide a simple python3 interface to the gsl_fft_real_transform function ''' import sys import itertools from gsl_setup import * def grouper(n, iterable, fillvalue=None): # http://docs.python.org/dev/3.0/library/itertools.html#module-itertools "grouper(3, 'ABCDEFG', 'x') --> ABC DEF Gxx" args = [...
alipay/aop/api/domain/QueryComplexLabelRule.py
snowxmas/alipay-sdk-python-all
213
12747788
<filename>alipay/aop/api/domain/QueryComplexLabelRule.py #!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * class QueryComplexLabelRule(object): def __init__(self): self._label_id = None self._label_name = None self._label_value...
lib/_included_packages/plexnet/threadutils.py
aleenator/plex-for-kodi
233
12747815
<reponame>aleenator/plex-for-kodi # import inspect # import ctypes from __future__ import absolute_import import threading # import time # def _async_raise(tid, exctype): # '''Raises an exception in the threads with id tid''' # if not inspect.isclass(exctype): # raise TypeError("Only types can be rais...
examples/torchscript_resnet18_all_output_types.py
rdadolf/torch-mlir
213
12747828
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. # See https://llvm.org/LICENSE.txt for license information. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception # Also available under a BSD-style license. See LICENSE. import torch import torchvision import torch_mlir resnet18 = t...
examples/wolfcamp_single.py
SPWLA-ORG/PetroPy
145
12747868
<filename>examples/wolfcamp_single.py """ ================================== Wolfcamp Example - Single las file ================================== This example shows the full petrophysical workflow avaiable in PetroPy for a single wolfcamp las file courtesy of University Lands Texas. The workflow progresses in these ...
homeassistant/components/rpi_power/const.py
tbarbette/core
30,023
12747870
"""Constants for Raspberry Pi Power Supply Checker.""" DOMAIN = "rpi_power"
podman/tests/unit/test_manifests.py
kevinwylder/podman-py
106
12747879
<reponame>kevinwylder/podman-py<filename>podman/tests/unit/test_manifests.py import unittest from podman import PodmanClient, tests from podman.domain.manifests import ManifestsManager, Manifest class ManifestTestCase(unittest.TestCase): def setUp(self) -> None: super().setUp() self.client = Pod...
examples.py
pauloromeira/onegram
150
12747894
<reponame>pauloromeira/onegram #!/usr/bin/env python from operator import itemgetter from itertools import islice from collections import defaultdict from onegram import Login, login, logout # Queries from onegram import user_info, post_info from onegram import followers, following from onegram import posts, likes, ...
client/verta/tests/bases/test_deployable_entity.py
benshaw/modeldb
835
12747922
<gh_stars>100-1000 # -*- coding: utf-8 -*- import hashlib import string import tempfile import hypothesis import hypothesis.strategies as st import six from verta._protos.public.common import CommonService_pb2 from verta._internal_utils import _artifact_utils from verta.tracking.entities._deployable_entity import _...
vedacore/parallel/_functions.py
jie311/vedadet
424
12747926
<reponame>jie311/vedadet # Copyright (c) Open-MMLab. All rights reserved. import torch from torch.nn.parallel._functions import _get_stream def scatter(input, devices, streams=None): """Scatters tensor across multiple GPUs. """ if streams is None: streams = [None] * len(devices) if isinstance...
tests/unit/cli/test_archives.py
tehlingchu/anchore-cli
110
12747934
from anchorecli.cli import archives
Whole-App-Acceleration/apps/resnet50/build_flow/DPUCADF8H_u200/scripts/utility/readme_gen/gs_summary_subdir.py
hito0512/Vitis-AI
848
12747975
<reponame>hito0512/Vitis-AI<filename>Whole-App-Acceleration/apps/resnet50/build_flow/DPUCADF8H_u200/scripts/utility/readme_gen/gs_summary_subdir.py #!/usr/bin/env python import os, re import fnmatch import json import sys sys.path.append(".") import gs_summary_util gs_summary_util.genReadMe2(".")
r2l/rerank.py
thilakshiK/wmt16-scripts
132
12747982
<reponame>thilakshiK/wmt16-scripts<gh_stars>100-1000 #!/usr/bin/python # -*- coding: utf-8 -*- # Author: <NAME> # Distributed under MIT license import sys from collections import defaultdict if __name__ == '__main__': if len(sys.argv) > 1: k = int(sys.argv[1]) else: k = float('inf') cur = ...
demo.py
dmis-lab/BioSyn
114
12747993
<reponame>dmis-lab/BioSyn import argparse import os import pdb import pickle import tornado.web import tornado.ioloop import tornado.autoreload import logging import json from src.biosyn import ( DictionaryDataset, BioSyn, TextPreprocess ) logging.basicConfig( filename='.server.log', format="%(asc...
lib/PyAMF-0.6.1/pyamf/tests/adapters/_google_models.py
MiCHiLU/google_appengine_sdk
790
12748003
<reponame>MiCHiLU/google_appengine_sdk from google.appengine.ext import db class PetModel(db.Model): """ """ # 'borrowed' from http://code.google.com/appengine/docs/datastore/entitiesandmodels.html name = db.StringProperty(required=True) type = db.StringProperty(required=True, choices=set(["cat",...
general/file-downloader/download.py
caesarcc/python-code-tutorials
1,059
12748020
<filename>general/file-downloader/download.py<gh_stars>1000+ from tqdm import tqdm import requests import cgi import sys # the url of file you want to download, passed from command line arguments url = sys.argv[1] # read 1024 bytes every time buffer_size = 1024 # download the body of response by chunk, not immediatel...
examples/design_search/mcts.py
ONLYA/RoboGrammar
156
12748028
<filename>examples/design_search/mcts.py from collections import defaultdict from math import log, sqrt import random class TreeNode(object): def __init__(self, state): self.state = state self.visit_count = 0 self.result_sum = 0 self.result_max = float('-inf') self.action_visit_counts = defaultdi...
helpers/json_manager.py
xxopcode90xx/DiscordChatBotProject
491
12748030
<gh_stars>100-1000 import json def add_user_to_blacklist(user_id: int): with open("blacklist.json", "r+") as file: file_data = json.load(file) file_data["ids"].append(user_id) with open("blacklist.json", "w") as file: file.seek(0) json.dump(file_data, file, indent=4) def remo...
demos/sort.py
bahmanahmadi/mpyc
232
12748049
<reponame>bahmanahmadi/mpyc """Demo oblivious sorting in MPyC, with full secrecy. Randomly generated secret-shared lists of numbers (integers or fixed-point numbers) are sorted using MPyC's built-in functions mcp.sorted() and seclist.sort(), which are the secure counterparts of Python's built-in function sorted() and ...
examples/host_external_norestart.py
virtualgod/python-sc2
621
12748051
import argparse import sys import asyncio import sc2 from sc2 import Race from sc2.player import Bot from zerg.zerg_rush import ZergRushBot def main(): portconfig = sc2.portconfig.Portconfig() print(portconfig.as_json) player_config = [ Bot(Race.Zerg, ZergRushBot()), Bot(Race.Zerg, None...
bpycv/physic_utils.py
TheShadow29/bpycv
248
12748067
<filename>bpycv/physic_utils.py #!/usr/bin/env python3 import bpy import mathutils from .object_utils import activate_obj SET_ORIGIN_HOOK_NAME = "set_back_origin" OLD_V0_KEY = "old_object.data.vertices[0].co" def set_origin_and_record_old_v0(obj, type="ORIGIN_CENTER_OF_VOLUME", center="MEDIAN"): obj[OLD_V0_KEY...
android_env/components/adb_log_stream.py
yjaeseok/android_env
768
12748096
# coding=utf-8 # Copyright 2021 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applic...
src/pretix/plugins/statistics/signals.py
fabm3n/pretix
1,248
12748109
<gh_stars>1000+ # # This file is part of pretix (Community Edition). # # Copyright (C) 2014-2020 <NAME> and contributors # Copyright (C) 2020-2021 rami.io GmbH and contributors # # This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General # Public License as publi...
asv/commands/rm.py
jaimergp/asv
476
12748115
# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst from __future__ import (absolute_import, division, print_function, unicode_literals) import six from fnmatch import fnmatchcase import sys from . import Command from .. import console from ..console impor...
ansible/roles/test/files/ptftests/vlan_test.py
shubav/sonic-mgmt
132
12748133
<gh_stars>100-1000 import ast import json import logging import subprocess from collections import defaultdict from ipaddress import ip_address, ip_network import ptf import ptf.packet as scapy import ptf.dataplane as dataplane from ptf import config from ptf.base_tests import BaseTest from ptf.testutils import * fr...
nagios/nagiosxi_556_rce_lpe.py
iamarkaj/poc
1,007
12748135
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler import SocketServer, threading, ssl import requests, urllib import sys, os, argparse from OpenSSL import crypto from requests.packages.urllib3.exceptions import InsecureRequestWarning requests.packages.urllib3.disable_warnings(InsecureRequestWarning) # http...
pyhealth/data/expdata_generator.py
Abhinav43/PyHealth
485
12748155
<filename>pyhealth/data/expdata_generator.py # -*- coding: utf-8 -*- # Author: <NAME> <<EMAIL>> # License: BSD 2 clause import os import csv import pickle import random import numpy as np import pandas as pd import tqdm from tqdm._tqdm import trange import time try: from ..utils.check import * except: from p...
tests/contrib/pymemcache/test_client.py
p7g/dd-trace-py
308
12748161
# 3p import pymemcache from pymemcache.exceptions import MemcacheClientError from pymemcache.exceptions import MemcacheIllegalInputError from pymemcache.exceptions import MemcacheServerError from pymemcache.exceptions import MemcacheUnknownCommandError from pymemcache.exceptions import MemcacheUnknownError import pytes...
convlab2/laug/Text_Paraphrasing/utils.py
ljw23/ConvLab-2
339
12748173
# -*- coding: utf-8 -*- from convlab2.util.multiwoz.paraphrase_span_detection import phrase_idx_utt def paraphrase_span_detection(new_text,span_info): new_words=new_text.split() new_span_info=[] for span in span_info: span_words=span[2].split() result=phrase_idx_utt(span_words,new_w...
tensorflow_examples/lite/model_maker/core/task/recommendation.py
duy-maimanh/examples
6,484
12748193
# Copyright 2020 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the 'License'); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
migrations/versions/9d370f33f1a0_user_login_types.py
pombredanne/vulncode-db
592
12748198
<gh_stars>100-1000 """user login types Revision ID: 9d370f33f1a0 Revises: <KEY> Create Date: 2020-11-30 12:58:31.046646 """ from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import mysql # revision identifiers, used by Alembic. revision = "9d370f33f1a0" down_revision = "<KEY>" branch_labels = N...
bocadillo/converters.py
teaglebuilt/bocadillo
434
12748239
<reponame>teaglebuilt/bocadillo import decimal import inspect from datetime import date, datetime, time from functools import wraps import typing import typesystem FIELD_ALIASES: typing.Dict[typing.Type, typesystem.Field] = { int: typesystem.Integer, float: typesystem.Float, bool: typesystem.Boolean, ...
machine-learning-ex7/ex7/computeCentroids.py
ShawnT4ever/coursera-ml-py
1,333
12748242
<filename>machine-learning-ex7/ex7/computeCentroids.py import numpy as np def compute_centroids(X, idx, K): # Useful values (m, n) = X.shape # You need to return the following variable correctly. centroids = np.zeros((K, n)) # ===================== Your Code Here ===================== # Inst...
foundations_ui/cypress/fixtures/atlas_scheduler/envsubst.py
DeepLearnI/atlas
296
12748254
<reponame>DeepLearnI/atlas<filename>foundations_ui/cypress/fixtures/atlas_scheduler/envsubst.py def _flattened_config_walk(): import os import os.path as path for dir_name, _, files in os.walk('cypress/fixtures/atlas_scheduler/.foundations'): for file_name in files: if file_name.endswit...
DataFlow_Suite/lstm_exec.py
seenu037/algotrading
200
12748256
<filename>DataFlow_Suite/lstm_exec.py<gh_stars>100-1000 import tensorflow as tf import numpy as np import numpy.random as rng import pandas.io.data as web import numpy as np import pandas as pd def get_prices(symbol): start, end = '2007-05-02', '2016-04-11' data = web.DataReader(symbol, 'yahoo', start, end) ...
indy_common/test/auth/metadata/test_auth_rule_with_metadata_simple.py
Rob-S/indy-node
627
12748270
<reponame>Rob-S/indy-node from indy_common.authorize.auth_constraints import AuthConstraint, IDENTITY_OWNER, AuthConstraintForbidden from indy_common.constants import ENDORSER from indy_common.test.auth.metadata.helper import validate, PLUGIN_FIELD, Action from plenum.common.constants import TRUSTEE MAX_SIG_COUNT = 3 ...
chrome/test/kasko/py/kasko/report.py
google-ar/chromium
777
12748304
<reponame>google-ar/chromium #!/usr/bin/env python # 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. """Utility functions for dealing with crash reports.""" import logging import os _LOGGER = logging.getLog...
lib/django-0.96/django/conf/project_template/urls.py
MiCHiLU/google_appengine_sdk
790
12748335
<filename>lib/django-0.96/django/conf/project_template/urls.py from django.conf.urls.defaults import * urlpatterns = patterns('', # Example: # (r'^{{ project_name }}/', include('{{ project_name }}.foo.urls')), # Uncomment this for admin: # (r'^admin/', include('django.contrib.admin.urls')), )
edward2/jax/nn/random_feature.py
google/edward2
591
12748339
# coding=utf-8 # Copyright 2021 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
Chapter20/02_xmlrpc_fetch_data/books_data2.py
PacktPublishing/-Odoo-13-Development-Cookbook-Fouth-Edition
125
12748342
<filename>Chapter20/02_xmlrpc_fetch_data/books_data2.py from xmlrpc import client # books data with search_read method server_url = 'http://localhost:8069' db_name = 'book-db-14' username = 'admin' password = '<PASSWORD>' common = client.ServerProxy('%s/xmlrpc/2/common' % server_url) user_id = common.authenticate(db_...
beginner_source/former_torchies/autograd_tutorial_old.py
Ismail-Mustapha/tutorials
6,424
12748343
<gh_stars>1000+ # -*- coding: utf-8 -*- """ Autograd ======== Autograd is now a core torch package for automatic differentiation. It uses a tape based system for automatic differentiation. In the forward phase, the autograd tape will remember all the operations it executed, and in the backward phase, it will replay t...
qqzone/qq_zone.py
rua-aaa/awesome-python-login-model
5,857
12748357
<reponame>rua-aaa/awesome-python-login-model #!/usr/bin/env python # -*- coding: utf-8 -*- """ info: author:CriseLYJ github:https://github.com/CriseLYJ/ update_time:2019-3-7 """ import time # 用来延时 from selenium import webdriver driver = webdriver.Chrome() # 选择浏览器,此处我选择的Chrome QQ_NUMBER = input('请输入你的QQ号') PASSWORD ...
core/sqf/src/seatrans/hbase-trx/src/main/python/thrift2/gen-py/hbase/THBaseService.py
CoderSong2015/Apache-Trafodion
148
12748386
<gh_stars>100-1000 # # Autogenerated by Thrift Compiler (0.9.0) # # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING # # options string: py # from thrift.Thrift import TType, TMessageType, TException, TApplicationException from ttypes import * from thrift.Thrift import TProcessor from thrift.transport...
lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene84/gen_ForUtil.py
dameikle/lucene
903
12748420
#! /usr/bin/env python # 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 "Lic...
examples/benchmark/run_sift1b.py
abcp4/rii
120
12748464
<reponame>abcp4/rii import numpy as np import pathlib import nanopq import pickle import time import more_itertools import texmex_python import util ### If you'd like to debug, please uninstall rii and uncomment the following lines #import sys #sys.path.append('../../') import rii def run(engine, L, Xq, gt, r): ...
Trescope4Python/library/src/trescope/config/VectorField3DConfig.py
aaabbb2021/Trescope
105
12748468
from typing import List from trescope.config import Config, AnchorType, AnchorCM from trescope.core.Utils import toListIfNumpyOrTensorArray class VectorField3DConfig(Config): """Config for :py:meth:`trescope.Output.plotVectorField3D`""" def __init__(self): super().__init__() self.__sizeFacto...
modules/dns.py
tomsec/FinalRecon
1,391
12748482
<reponame>tomsec/FinalRecon #!/usr/bin/env python3 import os import dnslib R = '\033[31m' # red G = '\033[32m' # green C = '\033[36m' # cyan W = '\033[0m' # white Y = '\033[33m' # yellow def dnsrec(domain, output, data): result = {} print('\n' + Y + '[!]' + Y + ' Starting DNS Enumeration...' + W + '\n') types = ...
Additional_File/16_ClearDM/cleardm.py
nomrsavage/Discord-All-Tools-In-One
197
12748493
import os, os.path, discord from discord.ext import commands from colorama import Fore os.system('cls' if os.name == 'nt' else 'clear') cleardmtitle() print(f"""{y}[{w}+{y}]{w} Enter your token""") token = input(f"""{y}[{b}#{y}]{w} Token: """) print(f"""\n{y}[{b}#{y}]{w} Write "!clear" in one of your DMs to de...
python/paddle/fluid/dygraph/parallel_helper.py
OuyangChao/Paddle
17,085
12748530
# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except jin compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
misc/DS1307/DS1307.py
garymeg/mpy-lib
116
12748541
''' DS1307 RTC drive Author: shaoziyang Date: 2018.3 http://www.micropython.org.cn ''' from micropython import const DS1307_I2C_ADDRESS = const(104) DS1307_REG_SECOND = const(0) DS1307_REG_MINUTE = const(1) DS1307_REG_HOUR = const(2) DS1307_REG_WEEKDAY = const(3) DS1307_REG_DAY = con...
modelci/experimental/finetuner/__init__.py
FerdinandZhong/ML-Model-CI
170
12748555
<gh_stars>100-1000 #!/usr/bin/env python # -*- coding: utf-8 -*- """ Author: <NAME> Email: <EMAIL> Date: 1/12/2021 """ from pathlib import Path OUTPUT_DIR = Path.home() / 'tmp' OUTPUT_DIR.mkdir(parents=True, exist_ok=True)
openshift/installer/vendored/openshift-ansible-3.11.28-1/roles/lib_utils/test/test_sanity_checks.py
fahlmant/openshift-tools
164
12748567
<reponame>fahlmant/openshift-tools<gh_stars>100-1000 ''' Unit tests for wildcard ''' import os import sys MODULE_PATH = os.path.realpath(os.path.join(__file__, os.pardir, os.pardir, 'action_plugins')) sys.path.insert(0, MODULE_PATH) # pylint: disable=import-error,wrong-import-position,missing-docstring from sanity_c...
dalib/vision/__init__.py
xyzhu12/Transfer-Learning-Library
109
12748569
__all__ = ['datasets', 'models']
distributed training/tf-sentiment-script-mode/sentiment.py
merb92/amazon-sagemaker-keras-text-classification
106
12748573
<reponame>merb92/amazon-sagemaker-keras-text-classification import argparse import numpy as np import os import tensorflow as tf from tensorflow.contrib.eager.python import tfe from keras.models import Sequential from keras.layers import Dense, Dropout, Activation from keras.layers import Embedding from keras.layers im...
torch/nn/grad.py
Hacky-DH/pytorch
60,067
12748595
<reponame>Hacky-DH/pytorch<filename>torch/nn/grad.py """Gradient interface""" import torch from .modules.utils import _single, _pair, _triple import warnings def _grad_input_padding(grad_output, input_size, stride, padding, kernel_size, dilation=None): if dilation is None: # For backward compatibility ...
pyalgotrade/optimizer/server.py
cdyfng/pyalgotrade
1,000
12748617
# PyAlgoTrade # # Copyright 2011-2015 <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.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed t...
build_files/buildbot/codesign/config_server_template.py
intrigus/blender-1
116
12748625
# ##### BEGIN GPL LICENSE BLOCK ##### # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distrib...
finalists/yc14600/PyTorch-Encoding/scripts/prepare_imagenet.py
lrzpellegrini/cvpr_clvision_challenge
2,190
12748635
"""Prepare the ImageNet dataset""" import os import argparse import tarfile import pickle import gzip import subprocess from tqdm import tqdm import subprocess from encoding.utils import check_sha1, download, mkdir _TARGET_DIR = os.path.expanduser('~/.encoding/data/ILSVRC2012') _TRAIN_TAR = 'ILSVRC2012_img_train.tar' ...
tests/test_provider_vmware_vmc.py
mjuenema/python-terrascript
507
12748637
# tests/test_provider_vmware_vmc.py # Automatically generated by tools/makecode.py (24-Sep-2021 15:30:35 UTC) def test_provider_import(): import terrascript.provider.vmware.vmc def test_resource_import(): from terrascript.resource.vmware.vmc import vmc_cluster from terrascript.resource.vmware.vmc impor...
sqlite_table_check.py
nicetone/Python
28,321
12748653
<reponame>nicetone/Python # Script Name : sqlite_table_check.py # Author : <NAME> # Created : 07 June 2013 # Last Modified : # Version : 1.0 # Modifications : # Description : Checks the main SQLITE database to ensure all the tables should exist import os import sqlite3 dropbox = os.getenv("dropbox...
Src/StdLib/Lib/whichdb.py
cwensley/ironpython2
6,989
12748662
# !/usr/bin/env python """Guess which db package to use to open a db file.""" import os import struct import sys try: import dbm _dbmerror = dbm.error except ImportError: dbm = None # just some sort of valid exception which might be raised in the # dbm test _dbmerror = IOError def whichdb(fil...
discord_embedded_message/message.py
sonalimahajan12/Automation-scripts
496
12748674
import datetime import json import requests def send_message( webhook_url: str, content_msg="", title="", title_url="", color=00000000, timestamp=datetime.datetime.now().isoformat(), footer_icon="", footer="", thumbnail_url="", author="", author_url="", author_icon_url=...
fugue_notebook/env.py
fugue-project/fugue
547
12748697
<reponame>fugue-project/fugue # pylint: disable=W0611,W0613 import html import json from typing import Any, Callable, Dict, List import fugue_sql import pandas as pd from fugue import ( ExecutionEngine, NativeExecutionEngine, make_execution_engine, register_execution_engine, ) from fugue.dataframe impo...
slybot/slybot/starturls/generator.py
hackrush01/portia
6,390
12748703
<reponame>hackrush01/portia from collections import OrderedDict from datetime import datetime from itertools import chain, product from scrapy.utils.spider import arg_to_iter import six try: from itertools import izip_longest except ImportError: from itertools import zip_longest as izip_longest from six.move...
test/test_tls.py
alexmv/python-binary-memcached
103
12748707
import os import pytest import subprocess import ssl import time import trustme import bmemcached import test_simple_functions ca = trustme.CA() server_cert = ca.issue_cert(os.environ["MEMCACHED_HOST"] + u"") @pytest.yield_fixture(scope="module", autouse=True) def memcached_tls(): key = server_cert.private_key...
dataset/squad_dataset.py
jamaalhay/Final_Proj
104
12748718
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = 'han' import os import h5py import math import torch import torch.utils.data from torch.utils.data.sampler import Sampler, SequentialSampler import logging import pandas as pd from dataset.preprocess_data import PreprocessData from utils.functions import * l...
38-neuro-monolithic/tf-38-learning.py
cyyeh/exercises-in-programming-style
1,821
12748783
<gh_stars>1000+ from keras.models import Sequential from keras.layers import Dense from keras.losses import binary_crossentropy, categorical_crossentropy from keras.optimizers import SGD from keras. metrics import top_k_categorical_accuracy from keras import backend as K import numpy as np import sys, os, string, rando...
mmtrack/datasets/pipelines/loading.py
BigBen0519/mmtracking
2,226
12748787
<filename>mmtrack/datasets/pipelines/loading.py # Copyright (c) OpenMMLab. All rights reserved. from mmdet.datasets.builder import PIPELINES from mmdet.datasets.pipelines import LoadAnnotations, LoadImageFromFile from mmtrack.core import results2outs @PIPELINES.register_module() class LoadMultiImagesFromFile(LoadIma...
Creational/Factory-Method/python/FactoryMethod.py
Hkataya/design-patterns
294
12748796
<reponame>Hkataya/design-patterns<filename>Creational/Factory-Method/python/FactoryMethod.py from abc import ABC, abstractmethod class Creator(ABC): def some_operation(self): product = self.create_product() product.do_stuff() @abstractmethod def create_product(self): pass class...
supervisor/scripts/sample_exiting_eventlistener.py
LexMachinaInc/supervisor
365
12748826
<filename>supervisor/scripts/sample_exiting_eventlistener.py #!/usr/bin/env python # A sample long-running supervisor event listener which demonstrates # how to accept event notifications from supervisor and how to respond # properly. It is the same as the sample_eventlistener.py script # except it exits after each r...
content/test/gpu/gpu_tests/cloud_storage_test_base.py
iplo/Chain
231
12748831
<gh_stars>100-1000 # Copyright 2013 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. """Base classes for a test and validator which upload results (reference images, error images) to cloud storage.""" import os import re i...
arcade/drawing_support.py
janscas/arcade
824
12748848
<reponame>janscas/arcade<filename>arcade/drawing_support.py """ Functions used to support drawing. No Pyglet/OpenGL here. """ import math from typing import Tuple, Union, cast from arcade import Color from arcade import RGBA, RGB def get_points_for_thick_line(start_x: float, start_y: float, ...
L1Trigger/L1TMuonEndCap/test/tools/print_sector.py
ckamtsikis/cmssw
852
12748882
<gh_stars>100-1000 #!/usr/bin/env python from __future__ import print_function import sys from math import degrees, pi def main(): if len(sys.argv) < 2: print("Usage: %s radian" % sys.argv[0]) return rad = eval(sys.argv[1]) if rad <= 0.: rad += 2*pi deg = degrees(rad) print("rad: {0} deg: {1}"....
saleor/graphql/channel/dataloaders.py
fairhopeweb/saleor
15,337
12748908
from collections import defaultdict from django.db.models import Exists, OuterRef from ...channel.models import Channel from ...order.models import Order from ...shipping.models import ShippingZone from ..checkout.dataloaders import CheckoutByIdLoader, CheckoutLineByIdLoader from ..core.dataloaders import DataLoader ...
venv/lib/python3.9/site-packages/py2app/bootstrap/reset_sys_path.py
dequeb/asmbattle
193
12748926
def _reset_sys_path(): # Clear generic sys.path[0] import os import sys resources = os.environ["RESOURCEPATH"] while sys.path[0] == resources: del sys.path[0] _reset_sys_path()
src/seedwork/infrastructure/test_repository.py
Ermlab/python-ddd
308
12748929
from seedwork.infrastructure.repository import InMemoryRepository from seedwork.domain.entities import Entity class Person(Entity): first_name: str last_name: str def test_InMemoryRepository_persist_one(): # arrange person = Person(first_name="John", last_name="Doe") repository = InMemoryReposit...
components/isceobj/Alos2burstProc/runSwathMosaic.py
vincentschut/isce2
1,133
12748932
# # Author: <NAME> # Copyright 2015-present, NASA-JPL/Caltech # import os import logging import isceobj from isceobj.Alos2Proc.runSwathMosaic import swathMosaic from isceobj.Alos2Proc.runSwathMosaic import swathMosaicParameters from isceobj.Alos2Proc.Alos2ProcPublic import create_xml logger = logging.getLogger('isce...
manubot/cite/tests/test_pubmed.py
benstear/manubot
299
12748972
import pytest from manubot.cite.pubmed import ( get_pmcid_and_pmid_for_doi, get_pmid_for_doi, get_pubmed_ids_for_doi, ) @pytest.mark.parametrize( ("doi", "pmid"), [ ("10.1098/rsif.2017.0387", "29618526"), # in PubMed and PMC ("10.1161/CIRCGENETICS.115.001181", "27094199"), # in ...
Python/split-a-string-in-balanced-strings.py
shreyventure/LeetCode-Solutions
388
12749011
class Solution: """ Time Complexity: O(N) Space Complexity: O(1) """ def balanced_string_split(self, s: str) -> int: # initialize variables L_count, R_count = 0, 0 balanced_substring_count = 0 # parse the string for char in s: # update the numbe...
Chapter10/webapp/blog/models.py
jayakumardhananjayan/pythonwebtut
135
12749019
import datetime from .. import db tags = db.Table( 'post_tags', db.Column('post_id', db.Integer, db.ForeignKey('post.id')), db.Column('tag_id', db.Integer, db.ForeignKey('tag.id')) ) class Post(db.Model): id = db.Column(db.Integer(), primary_key=True) title = db.Column(db.String(255), nullable=Fa...
tests/data/test_unsupervised_sampler.py
LarsNeR/stellargraph
2,428
12749027
<filename>tests/data/test_unsupervised_sampler.py # -*- coding: utf-8 -*- # # Copyright 2017-2020 Data61, CSIRO # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licen...
Programming Languages/Python/Theory/100_Python_Exercises/Exercises/Exercise 28/28.py
jaswinder9051998/Resources
101
12749144
<gh_stars>100-1000 #Why is the error and how to fix it? #A: A TypeError menas you are using the wrong type to make an operation. Change print(a+b) to return a+b def foo(a, b): print(a + b) x = foo(2, 3) * 10
core/native/vendor/cx_Freeze-5.0.1/cx_Freeze/samples/simple/hello.py
tensorlang/nao
332
12749152
#!/usr/bin/env python # -*- coding: utf-8 -*- from datetime import datetime import sys from sys import stdout stdout.write('Hello from cx_Freeze\n') stdout.write('The current date is %s\n\n' % datetime.today().strftime('%B %d, %Y %H:%M:%S')) stdout.write('Executable: %r\n' % sys.executable) stdout.write...
lite/tests/unittest_py/op/test_linspace_op.py
714627034/Paddle-Lite
808
12749159
# Copyright (c) 2021 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 required by appli...
scripts/cmt/rig/spaceswitch.py
kamilisa/cmt
199
12749173
"""Space switching without constraints or extra DAG nodes. Contains functions to create a space switching network as well as seamlessly switching between spaces. Example Usage ============= :: import cmt.rig.spaceswitch as spaceswitch # Create the space switch spaceswitch.create_space_switch( p...
nmigen/hdl/mem.py
psumesh/nmigen
528
12749228
from amaranth.hdl.mem import * from amaranth.hdl.mem import __all__ import warnings warnings.warn("instead of nmigen.hdl.mem, use amaranth.hdl.mem", DeprecationWarning, stacklevel=2)
examples/smartsheet_report_to_bigquery_example.py
Ressmann/starthinker
138
12749270
<reponame>Ressmann/starthinker<filename>examples/smartsheet_report_to_bigquery_example.py ########################################################################### # # Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with...
testing/unit/tp/atomic_swap/test_init.py
FerrySchuller/remme-core
129
12749301
""" Provide tests for atomic swap handler initialization method implementation. """ import datetime import time import pytest from sawtooth_sdk.processor.exceptions import InvalidTransaction from sawtooth_sdk.protobuf.processor_pb2 import TpProcessRequest from sawtooth_sdk.protobuf.setting_pb2 import Setting from sawt...
tests/tracing.py
kihyuks/objax
715
12749308
# 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
tests/test_physical_systems/test_physical_systems.py
RaviPandey33/gym-electric-motor-1
179
12749321
import numpy as np from ..testing_utils import DummyConverter, DummyLoad, DummyNoise, DummyOdeSolver, DummyVoltageSupply, DummyElectricMotor,\ mock_instantiate, instantiate_dict from gym_electric_motor.physical_systems import physical_systems as ps, converters as cv, electric_motors as em,\ mechanical_loads as ...
fastmri_recon/training_scripts/single_coil/kikinet_sep_approach_af4_oasis.py
samiulshuvo/fastmri-reproducible-benchmark
105
12749329
import os.path as op import random import time from keras.callbacks import TensorBoard, ModelCheckpoint, LearningRateScheduler import tensorflow as tf from tensorflow_addons.callbacks import TQDMProgressBar from fastmri_recon.data.sequences.oasis_sequences import Masked2DSequence, KIKISequence from fastmri_recon.mode...
ochopod/core/core.py
autodesk-cloud/ochopod
139
12749350
# # Copyright (c) 2015 Autodesk 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 l...
observations/r/bmt.py
hajime9652/observations
199
12749367
<filename>observations/r/bmt.py # -*- 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 bmt(path): """data from Section 1.3 ...
tiktok_bot/models/post.py
reliefs/tiktok_bot
118
12749384
<filename>tiktok_bot/models/post.py from typing import List, Optional from pydantic import BaseModel from .music import MusicTrack from .request import ( BaseResponseData, CursorOffsetRequestParams, CursorOffsetResponseParams, ListRequestParams, ListResponseData, ) from .user import CommonUserDeta...
preprocessing/TRStemmer/states/__init__.py
ucekmez/summarizer
205
12749387
from ..transitions import Transition from ..suffixes import * __all__ = ["State"] class State(object): def __init__(self, initialState, finalState, *suffixes): self.initialState = initialState self.finalState = finalState if suffixes is None: self.suffixes = () else: ...
examples/pixelcnn/model_test.py
navjotts/flax
2,249
12749392
<gh_stars>1000+ # Copyright 2021 The Flax Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ...
mcbv/edit_custom.py
akulakov/django
150
12749429
from copy import copy from django.forms import formsets from django.contrib import messages from django.db.models import Q from django.forms.formsets import formset_factory, BaseFormSet, all_valid from detail import * from edit import * class SearchFormViewMixin(BaseFormView): ignore_get_keys = ("page", ) # T...
tests/dicts/parse/test_parse_util.py
next-franciscoalgaba/python-benedict
365
12749433
<reponame>next-franciscoalgaba/python-benedict<gh_stars>100-1000 # -*- coding: utf-8 -*- from benedict.dicts.parse import parse_util import unittest class parse_util_test_case(unittest.TestCase): def test_parse_bool(self): f = parse_util.parse_bool self.assertTrue(f(1)) self.assertTrue(...
TradzQAI/core/__init__.py
kkuette/AI_project
164
12749446
from .environnement import Local_env from .environnement import Live_env from .worker import Local_Worker from .worker import Live_Worker from .session import Local_session from .session import Live_session
custom_components/local_luftdaten/__init__.py
Aulos/local_luftdaten
163
12749452
""" Support for local Luftdaten sensors. Copyright (c) 2019 <NAME> Licensed under MIT. All rights reserved. https://github.com/lichtteil/local_luftdaten/ """