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
tests/data/user_dir/datasets/always_one.py
dk25021999/mmf
3,252
12637766
# Copyright (c) Facebook, Inc. and its affiliates. from mmf.common.registry import registry from mmf.datasets.base_dataset_builder import BaseDatasetBuilder from tests.test_utils import NumbersDataset DATASET_LEN = 20 @registry.register_builder("always_one") class AlwaysOneBuilder(BaseDatasetBuilder): def __in...
iot_hunter/dynamic_analysis/DynamicPlugins/ScannerOn.py
byamao1/HaboMalHunter
727
12637769
<filename>iot_hunter/dynamic_analysis/DynamicPlugins/ScannerOn.py # Tencent is pleased to support the open source community by making IoTHunter available. # Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved. # Licensed under the MIT License (the "License"); you may not use this file except in...
Algo and DSA/LeetCode-Solutions-master/Python/maximize-palindrome-length-from-subsequences.py
Sourav692/FAANG-Interview-Preparation
3,269
12637790
<gh_stars>1000+ # Time: O((m + n)^2) # Space: O((m + n)^2) class Solution(object): def longestPalindrome(self, word1, word2): """ :type word1: str :type word2: str :rtype: int """ s = word1+word2 dp = [[0]*len(s) for _ in xrange(len(s))] result = 0 ...
sfaira/versions/topologies/musmusculus/embedding/vaeiaf.py
johnmous/sfaira
110
12637813
<gh_stars>100-1000 VAEIAF_TOPOLOGIES = { "0.1": { "model_type": "vaeiaf", "input": { "genome": "Mus_musculus.GRCm38.102", "genes": ["biotype", "protein_coding"], }, "output": {}, "hyper_parameters": { "latent_dim": (256, 128, 64, 128, 256),...
scripts/script.py
nickk/awesome-panel
179
12637825
import panel as pn pn.config.sizing_mode = "stretch_width" pn.extension() pn.template.MaterialTemplate( sidebar=[ pn.Column( pn.widgets.AutocompleteInput(options=["test"] * 1000), pn.widgets.Select(options=["a", "b", "c"]), pn.widgets.Select(name="under"), ...
vegans/models/unconditional/AAE.py
unit8co/vegans
459
12637834
<reponame>unit8co/vegans """ AAE --- Implements the Adversarial Autoencoder[1]. Instead of using the Kullback Leibler divergence to improve the latent space distribution we use a discriminator to determine the "realness" of the latent vector. Losses: - Encoder: Binary cross-entropy + Mean-squared error - Gene...
examples.py/Topics/Image Processing/EdgeDetection.py
timgates42/processing.py
1,224
12637872
<gh_stars>1000+ """ * Edge Detection. * * Exposing areas of contrast within an image * by processing it through a high-pass filter. """ kernel = (( -1, -1, -1 ), ( -1, 9, -1 ), ( -1, -1, -1 )) size(200, 200) img = loadImage("house.jpg") # Load the original image image(img, 0, 0) ...
pcdet/utils/depth_utils.py
Bosszhe/CaDDN_wzh
205
12637892
<gh_stars>100-1000 import torch import math def bin_depths(depth_map, mode, depth_min, depth_max, num_bins, target=False): """ Converts depth map into bin indices Args: depth_map [torch.Tensor(H, W)]: Depth Map mode [string]: Discretiziation mode (See https://arxiv.org/pdf/2005.13423.pdf fo...
extraPackages/matplotlib-3.0.3/examples/text_labels_and_annotations/date_index_formatter.py
dolboBobo/python3_ios
130
12637912
""" ===================================== Custom tick formatter for time series ===================================== When plotting time series, e.g., financial time series, one often wants to leave out days on which there is no data, i.e. weekends. The example below shows how to use an 'index formatter' to achieve t...
ratelimit/backends/__init__.py
abersheeran/asgi-ratelim
136
12637919
from .base import BaseBackend # noqa: F401
upvote/gae/datastore/models/event.py
iwikmai/upvote
453
12637948
# Copyright 2017 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
examples/sfwa_ukf/python/ukf/__init__.py
rafaelrietmann/ukf
320
12637994
<reponame>rafaelrietmann/ukf #Copyright (C) 2013 <NAME> # #Permission is hereby granted, free of charge, to any person obtaining a copy #of this software and associated documentation files (the "Software"), to deal #in the Software without restriction, including without limitation the rights #to use, copy, modify, merg...
src/main/resources/resource/Deeplearning4j/Deeplearning4j.py
holgerfriedrich/myrobotlab
179
12638034
<gh_stars>100-1000 ################################################################################## # Deeplearning4j.py # description: A wrapper service for the Deeplearning4j framework. # categories: ai # more info @: http://myrobotlab.org/service/Deeplearning4j ######################################################...
Liez-python-code/0000/0000.py
saurabh896/python-1
3,976
12638090
<gh_stars>1000+ from PIL import Image, ImageDraw, ImageFont def add_num(): im = Image.open('in.jpg') xsize, ysize = im.size draw = ImageDraw.Draw(im) font = ImageFont.truetype("arial.ttf", xsize // 3) draw.text((ysize // 5 * 4, 0), '3', (250,128,114), font) im.save('out.jpg') add_num()
seahub/api2/endpoints/be_shared_repo.py
weimens/seahub
420
12638092
<reponame>weimens/seahub # Copyright (c) 2012-2016 Seafile Ltd. from rest_framework.authentication import SessionAuthentication from rest_framework.permissions import IsAuthenticated from rest_framework.response import Response from rest_framework.views import APIView from rest_framework import status import seaserv f...
datar/dplyr/arrange.py
stjordanis/datar
110
12638113
<reponame>stjordanis/datar<filename>datar/dplyr/arrange.py """Arrange rows by column values See source https://github.com/tidyverse/dplyr/blob/master/R/arrange.R """ from typing import Any, Iterable, Mapping, Tuple from pandas import DataFrame from pipda import register_verb from pipda.symbolic import DirectRefAttr, D...
src/mygrad/typing/_array_like.py
kw-0/MyGrad
147
12638139
import sys from typing import TYPE_CHECKING, List, Sequence, Tuple, TypeVar, Union import numpy as np if TYPE_CHECKING: # pragma: no cover from mygrad import Tensor if sys.version_info >= (3, 8): # pragma: no cover from typing import Protocol HAS_PROTOCOL = True else: # pragma: no cover try: ...
my_algo.py
codesociety/friartuck
157
12638148
<reponame>codesociety/friartuck<filename>my_algo.py<gh_stars>100-1000 """ MIT License Copyright (c) 2017 Code Society Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, includin...
inselect/tests/gui/test_action_state.py
NaturalHistoryMuseum/inselect
128
12638162
import unittest from pathlib import Path from .gui_test import GUITest TESTDATA = Path(__file__).parent.parent / 'test_data' class TestActionState(GUITest): """Test the state of UI actions """ def _test_no_document(self): "Enabled state for actions when no document is open" w = self.win...
lib/GANDCTAnalysis/crop_celeba.py
vwesselkamp/deepfake-fingerprint-atacks
108
12638164
<filename>lib/GANDCTAnalysis/crop_celeba.py """Script for cropping celebA adopted from: https://github.com/ningyu1991/GANFingerprints/""" import argparse import os from PIL import Image import numpy as np from concurrent.futures import ProcessPoolExecutor def crop_image(stupid): i, directory, file_path, output =...
test/absolute_import/local_module.py
DamnWidget/jedi
239
12638182
<filename>test/absolute_import/local_module.py """ This is a module that imports the *standard library* unittest, despite there being a local "unittest" module. It specifies that it wants the stdlib one with the ``absolute_import`` __future__ import. The twisted equivalent of this module is ``twisted.trial._synctest``...
nazurin/sites/Bilibili/api.py
Misaka13514/nazurin
170
12638191
import json import os from typing import List from nazurin.models import Caption, Illust, Image from nazurin.utils import Request class Bilibili(object): async def getDynamic(self, dynamic_id: int): """Get dynamic data from API.""" api = 'https://api.vc.bilibili.com/dynamic_svr/v1/dynamic_svr/get_...
pkg/win32/mod_tools/tools/scripts/compiledefs.py
hexgear-studio/ds_mod_tools
112
12638205
<reponame>hexgear-studio/ds_mod_tools<gh_stars>100-1000 import sys import optparse import glob import os import string import tempfile import shutil import zipfile from pipelinetools import * from objloader import * import struct def ProcessFile(file, options): #figure out some name stuff basenam...
Python3/181.py
rakhi2001/ecom7
854
12638206
<filename>Python3/181.py<gh_stars>100-1000 __________________________________________________________________________________________________ SELECT e1.Name FROM Employee e1 JOIN Employee e2 ON e1.ManagerId = e2.Id WHERE e1.Salary > e2.Salary; ___________________________________________________________________________...
analysis_engine/load_algo_dataset_from_s3.py
virdesai/stock-analysis-engine
819
12638233
""" Helper for loading datasets from s3 """ import boto3 import analysis_engine.consts as ae_consts import analysis_engine.prepare_dict_for_algo as prepare_utils import analysis_engine.s3_read_contents_from_key as s3_utils import spylunking.log.setup_logging as log_utils log = log_utils.build_colorized_logger(name=__...
src/tests/api/test_membershiptypes.py
fabm3n/pretix
1,248
12638236
# # 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 published by the Free...
examples/novels/baidu_novels.py
atiasn/novel
2,344
12638252
<reponame>atiasn/novel #!/usr/bin/env python import aiohttp import arrow import asyncio import async_timeout import re from bs4 import BeautifulSoup from urllib.parse import urlparse from owllook.fetcher.function import get_random_user_agent from owllook.config import CONFIG, LOGGER, BLACK_DOMAIN, RULES, LATEST_RULES...
genia.py
kimiyoung/transfer
147
12638264
import numpy as np from collections import defaultdict as dd from scipy import sparse as sp import cnn_rnn import sample LABEL_INDEX = ['PRP$', 'VBG', 'VBD', '``', 'VBN', 'POS', "''", 'VBP', 'WDT', 'JJ',\ 'WP', 'VBZ', 'DT', '#', 'RP', '$', 'NN', 'FW', ',', '.', 'TO', 'PRP', 'RB', '-LRB-',\ ':', 'NNS', 'NNP', 'VB',...
tests/utils/test_bipartite.py
UCLCheminformatics/ScaffoldGraph
121
12638281
""" scaffoldgraph tests.utils.test_bipartite """ import scaffoldgraph as sg import networkx as nx from scaffoldgraph.utils.bipartite import make_bipartite_graph from . import mock_sdf def test_bipartite(sdf_file): network = sg.ScaffoldNetwork.from_sdf(sdf_file) biparite = make_bipartite_graph(network) a...
tools/analysis/report_map.py
rlleshi/mmaction2
1,870
12638335
<reponame>rlleshi/mmaction2 # Copyright (c) OpenMMLab. All rights reserved. import argparse import os import os.path as osp import mmcv import numpy as np from mmaction.core import ActivityNetLocalization args = None def cuhk17_top1(): """Assign label for each proposal with the cuhk17 result, which is the #2 ...
example/test.py
osblinnikov/pytorch-binary
293
12638349
<reponame>osblinnikov/pytorch-binary<gh_stars>100-1000 import torch import torch.nn as nn from torch.autograd import Variable from modules.add import MyAddModule class MyNetwork(nn.Module): def __init__(self): super(MyNetwork, self).__init__() self.add = MyAddModule() def forward(self, input1...
utils/common.py
PaddleEdu/Transformer-CV-models
113
12638351
<reponame>PaddleEdu/Transformer-CV-models<filename>utils/common.py import paddle import paddle.nn as nn from paddle.nn.initializer import TruncatedNormal, KaimingNormal, Constant, Assign # Common initializations ones_ = Constant(value=1.) zeros_ = Constant(value=0.) kaiming_normal_ = KaimingNormal() trunc_normal_ = ...
Common/Core/Testing/Python/TestFilePath.py
cclauss/VTK
1,755
12638353
<reponame>cclauss/VTK<gh_stars>1000+ """Test support for fspath protocol VTK-Python In VTK 3.6 and later, the Python open() method accepts pathlike objects, such as pathlib.Path(), which represent file system paths and which return a string via their __fspath__ slot. This test checks that the VTK SetFileName() method...
agents/tools/attr_dict_test.py
DoxasticFox/batch-ppo
210
12638355
<filename>agents/tools/attr_dict_test.py # Copyright 2017 The TensorFlow Agents 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 # ...
astrality/tests/actions/test_symlink_action.py
JakobGM/Astrality
111
12638361
"""Tests for astrality.actions.SymlinkAction.""" from pathlib import Path from astrality.actions import SymlinkAction from astrality.persistence import CreatedFiles def test_null_object_pattern(): """Copy actions without options should do nothing.""" symlink_action = SymlinkAction( options={}, ...
ch12/tspTests.py
MohammedMajidKhadim/GeneticAlgorithmsWithPython
1,008
12638363
<filename>ch12/tspTests.py # File: tspTests.py # from chapter 12 of _Genetic Algorithms with Python_ # # Author: <NAME> <<EMAIL>> # Copyright (c) 2016 <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 ...
examples/widgets/meter/lv_example_meter_2.py
nickzhuang0613/lvgl
5,238
12638372
#!//opt/bin/lv_micropython -i import utime as time import lvgl as lv import display_driver def set_value(indic,v): meter.set_indicator_end_value(indic, v) # # A meter with multiple arcs # meter = lv.meter(lv.scr_act()) meter.center() meter.set_size(200, 200) # Remove the circle from the middle meter.remove_styl...
social/utils.py
raccoongang/python-social-auth
1,987
12638378
from social_core.utils import social_logger, SSLHttpAdapter, import_module, \ module_member, user_agent, url_add_parameters, to_setting_name, \ setting_name, sanitize_redirect, user_is_authenticated, user_is_active, \ slugify, first, parse_qs, drop_lists, partial_pipeline_data, \ build_absolute_uri, con...
tests/PyroTests/testsupport.py
brubbel/Pyro4
638
12638414
<reponame>brubbel/Pyro4<gh_stars>100-1000 """ Support code for the test suite. There's some Python 2.x <-> 3.x compatibility code here. Pyro - Python Remote Objects. Copyright by <NAME> (<EMAIL>). """ import sys import pickle import threading from Pyro4 import errors, core, expose, behavior, current_context from Pyr...
ngym_shaping/wrappers/noise.py
manuelmolano/ngym_shaping
112
12638422
""" Noise wrapper. Created on Thu Feb 28 15:07:21 2019 @author: molano """ # !/usr/bin/env python3 # -*- coding: utf-8 -*- import gym class Noise(gym.Wrapper): """Add Gaussian noise to the observations. Args: std_noise: Standard deviation of noise. (def: 0.1) perf_th: If != None, the wrap...
sblibs/display/asciiart.py
StudyBlue/sblibs
281
12638426
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # Copyright © <NAME> 2016 # # @project: Decorating # @author: <NAME> # @email: <EMAIL> # # # .. .;-:!!>>!!:--;.. . # . .-:!>7?CO$QQQQ$OC?:--::-..... # . .-!7?CO$QQQQQ$$$OCCCC?!:--:>>:;;;... # ...
chapter3/chapter3_path_parameters_03.py
GoodMonsters/Building-Data-Science-Applications-with-FastAPI
107
12638449
from enum import Enum from fastapi import FastAPI class UserType(str, Enum): STANDARD = "standard" ADMIN = "admin" app = FastAPI() @app.get("/users/{type}/{id}/") async def get_user(type: UserType, id: int): return {"type": type, "id": id}
rules/community/packetbeat/packetbeat_dns_lookup.py
cninja1/streamalert
2,770
12638472
<gh_stars>1000+ """Alert on PacketBeat events""" from streamalert.shared.rule import rule @rule(logs=['packetbeat:dns']) def packetbeat_dns_lookup(rec): """ author: gavin (gavinelder) description: Alert on DNS lookup for Blacklisted domain testing: (a) Review traffic logs for machine in qu...
reagent/prediction/cfeval/predictor_wrapper.py
dmitryvinn/ReAgent
1,156
12638475
<gh_stars>1000+ #!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. import logging from typing import List, Tuple import torch from reagent.core import types as rlt from reagent.prediction.predictor_wrapper import DiscreteDqnWithPreprocessor logger = logging.getLogger(__nam...
SRT/lib/xvision/transformsImage.py
yerang823/landmark-detection
612
12638478
<reponame>yerang823/landmark-detection # Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # from __future__ import division import torch, cv2 import sys, math, random, PIL fro...
simfin/signals.py
tom3131/simfin
231
12638481
########################################################################## # # Functions for calculating signals from share-prices and financial data. # ########################################################################## # SimFin - Simple financial data for Python. # www.simfin.com - www.github.com/simfin/simfin...
src/agent/kubernetes-agent/src/utils/download.py
hyperledger-gerrit-archive/cello
865
12638497
# # SPDX-License-Identifier: Apache-2.0 # import requests import mimetypes import os from uuid import uuid4 def download_file(url, target_dir): r = requests.get(url, allow_redirects=True) content_type = r.headers["content-type"] extension = mimetypes.guess_extension(content_type) file_name = "%s%s" % ...
chembl_webresource_client/elastic_client.py
RowAnalytics/chembl_webresource_client
248
12638513
<reponame>RowAnalytics/chembl_webresource_client import json from chembl_webresource_client.query import Query from chembl_webresource_client.settings import Settings class ElasticClient(Query): def __init__(self): super(ElasticClient, self).__init__() def _search(self, query, method_name): ...
python/oneflow/framework/distribute.py
grybd/oneflow
3,285
12638526
""" Copyright 2020 The OneFlow Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agr...
academicstoday_project/teacher/tests/test_syllabus.py
LeeDoona/EasyGrading
146
12638532
<reponame>LeeDoona/EasyGrading from django.core.urlresolvers import resolve from django.http import HttpRequest from django.http import QueryDict from django.test import TestCase from django.test import Client from django.contrib.auth.models import User from django.contrib.auth import authenticate, login, logout from d...
GPy/kern/src/__init__.py
ekalosak/GPy
1,685
12638547
from . import psi_comp
src/tests/v010/delete_model_test.py
isaacna/FireO
231
12638555
<gh_stars>100-1000 from fireo.fields import TextField, NumberField from fireo.models import Model class DeleteModelUser(Model): name = TextField() class DeleteModelChild(Model): age = NumberField() def test_simple_delete(): d = DeleteModelUser(name="Name") d.save() DeleteModelUser.collection....
recipes/Python/576487_flatten_sequences/recipe-576487.py
tdiprima/code
2,023
12638557
def flatten(list): """Flatten a list of elements into a unique list Author: <NAME> Examples: >>> flatten(['a']) ['a'] >>> flatten('b') ['b'] >>> flatten( [] ) [] >>> flatten( [[], [[]]] ) [] >>> flatten( [[['a','b'], 'c'], 'd', ['e', [], 'f']] ) ['a', 'b', 'c', '...
blockchain-workbench/rest-api-samples/python/swagger_client/models/contract_action.py
chaosmail/blockchain
738
12638559
# coding: utf-8 """ Azure Blockchain Workbench REST API The Azure Blockchain Workbench REST API is a Workbench extensibility point, which allows developers to create and manage blockchain applications, manage users and organizations within a consortium, integrate blockchain applications into services and plat...
ex48/lexicon.py
youknowone/learn-python3-thw-code-ko
329
12638586
<filename>ex48/lexicon.py WORD_TYPES = { "north" : "direction", "south" : "direction", "east" : "direction", "west" : "direction", "go" : "verb", "kill" : "verb", "eat" : "verb", "the" : "stop", "in" : "stop", "of" : "stop", "bear" : "noun", "princess" : "noun", } def...
tests/test_base.py
ParikhKadam/pycorrector
3,153
12638632
# -*- coding: utf-8 -*- """ @author:XuMing(<EMAIL>) @description: """ import sys import unittest sys.path.append('..') import pycorrector class BaseTestCase(unittest.TestCase): def test_base_correct(self): query = '机七学习是人工智能领遇最能体现智能的一个分知' corrected_sent, detail = pycorrector.correct(query) ...
package/kedro_viz/data_access/__init__.py
deepyaman/kedro-viz
125
12638639
<gh_stars>100-1000 """`kedro_viz.data_access` provides an interface to save and load data for viz backend.""" from .managers import DataAccessManager data_access_manager = DataAccessManager()
maskrcnn_benchmark/layers/sigmoid_focal_loss.py
microsoft/GLIP
295
12638649
<filename>maskrcnn_benchmark/layers/sigmoid_focal_loss.py import torch from torch import nn import torch.nn.functional as F from torch.autograd import Function from torch.autograd.function import once_differentiable from maskrcnn_benchmark import _C # TODO: Use JIT to replace CUDA implementation in the futu...
lib/exabgp/bgp/message/update/nlri/evpn/__init__.py
cloudscale-ch/exabgp
1,560
12638656
""" evpn/__init__.py Created by <NAME> on 2014-06-27. Copyright (c) 2014-2017 Orange. All rights reserved. License: 3-clause BSD. (See the COPYRIGHT file) """ # Every EVPN should be imported from this file # as it makes sure that all the registering decorator are run from exabgp.bgp.message.update.nlri.evpn.nlri imp...
apps/dash-3d-image-partitioning/app.py
JeroenvdSande/dash-sample-apps
2,332
12638663
import dash from dash.dependencies import Input, Output, State, ClientsideFunction import dash_html_components as html import dash_core_components as dcc import plotly.graph_objects as go from skimage import data, img_as_ubyte, segmentation, measure from dash_canvas.utils import array_to_data_url import plotly.graph_ob...
coding_interviews/leetcode/easy/remove_duplicates.py
LeandroTk/Algorithms
205
12638683
<reponame>LeandroTk/Algorithms # https://leetcode.com/problems/remove-duplicates-from-sorted-array/description/ ''' - Examples: [1, 1, 2] # => 2 [] # => 0 [1, 1, 1] # => 1 [1, 2, 3, 3, 4, 5] # => 5 ''' def remove_duplicates(nums): if not nums: return 0 total_result = 1 num = nums[0] for inde...
pyqubo/integer/one_hot_enc_integer.py
dmiracle/pyqubo
124
12638685
# Copyright 2018 Recruit Communications Co., Ltd. # # 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 a...
prml/nn/math/__init__.py
jinmang2/PRML
11,017
12638694
from prml.nn.math.negative import negative from prml.nn.math.add import add from prml.nn.math.subtract import subtract, rsubtract from prml.nn.math.divide import divide, rdivide from prml.nn.math.mean import mean from prml.nn.math.multiply import multiply from prml.nn.math.matmul import matmul, rmatmul from prml.nn.mat...
sandbox/gkahn/gcg/eval_exp.py
ICRA-2018/gcg
120
12638725
import os import yaml import argparse import joblib from rllab.misc.ext import set_seed import rllab.misc.logger as logger from sandbox.gkahn.gcg.policies.mac_policy import MACPolicy from sandbox.gkahn.gcg.sampler.sampler import RNNCriticSampler from sandbox.gkahn.gcg.envs.env_utils import create_env class EvalExp(...
src/ostorlab/cli/auth/revoke/__init__.py
bbhunter/ostorlab
113
12638726
"""Module for the auth revoke command""" from ostorlab.cli.auth.revoke import revoke
Common/DataModel/Testing/Python/TestNumericArrayImageData.py
txwhhny/vtk
1,755
12638746
#!/usr/bin/env python """ This file tests vtk.util.vtkImageExportToArray and vtk.util.vtkImageImportFromArray. It tests the code by first exporting a PNG image to a Numeric Array and then converts the array to an image and compares that image to the original image. It does this for all PNG images in a particular dir...
hackerrank/cracking-the-coding-interview/ctci-array-left-rotation.py
Ashindustry007/competitive-programming
506
12638755
<reponame>Ashindustry007/competitive-programming #!/usr/bin/env python2 # https://www.hackerrank.com/challenges/ctci-array-left-rotation def array_left_rotation(a, n, k): return a[k:] + a[:k] n, k = map(int, raw_input().strip().split(' ')) a = map(int, raw_input().strip().split(' ')) answer = array_left_rotation(a...
testing/play_rtree.py
alitrack/dtreeviz
1,905
12638777
<gh_stars>1000+ from dtreeviz.trees import * df_cars = pd.read_csv("data/cars.csv") X = df_cars.drop('MPG', axis=1) y = df_cars['MPG'] X_train, y_train = X, y max_depth = 3 fig = plt.figure() ax = fig.gca() t = rtreeviz_univar(ax, X_train.WGT, y_train, max_depth=max_depth, ...
examples/fireworks.py
aforren1/glumpy
1,074
12638787
<reponame>aforren1/glumpy # ----------------------------------------------------------------------------- # Copyright (c) 2009-2016 <NAME>. All rights reserved. # Distributed under the (new) BSD License. # ----------------------------------------------------------------------------- """ Example demonstrating simulation...
applications/SwimmingDEMApplication/tests/drag_tests/chien_law/chien_drag_test_analysis.py
clazaro/Kratos
778
12638806
<reponame>clazaro/Kratos from KratosMultiphysics import Parameters import os # Importing the Kratos Library import KratosMultiphysics file_path = os.path.abspath(__file__) dir_path = os.path.dirname(file_path) import KratosMultiphysics.KratosUnittest as KratosUnittest from KratosMultiphysics.SwimmingDEMApplication.swim...
tacker/tests/unit/sol_refactored/api/test_api_version.py
h1r0mu/tacker
116
12638825
<filename>tacker/tests/unit/sol_refactored/api/test_api_version.py # Copyright (C) 2021 Nippon Telegraph and Telephone Corporation # 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 cop...
tools/codegen/core/gen_server_registered_method_bad_client_test_body.py
samotarnik/grpc
2,151
12638835
<filename>tools/codegen/core/gen_server_registered_method_bad_client_test_body.py #!/usr/bin/env python2.7 # Copyright 2015 gRPC 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 # # ...
haxor_news/lib/haxor/haxor.py
donnemartin/hn
4,091
12638862
<reponame>donnemartin/hn # The MIT License (MIT) # Copyright (c) 2014-15 <NAME> <<EMAIL>> # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in # the Software without restriction, including without limitation t...
examples/find_tags.py
pketthong/ruuvitag-sensor
166
12638864
<reponame>pketthong/ruuvitag-sensor """ Find RuuviTags """ from ruuvitag_sensor.ruuvi import RuuviTagSensor import ruuvitag_sensor.log ruuvitag_sensor.log.enable_console() # This will print sensor's mac and state when new sensor is found if __name__ == "__main__": RuuviTagSensor.find_ruuvitags()
bugtests/test385.py
jeff5/jython-whinchat
577
12638867
""" Try importing from a jar after sys.path.append(jar) This nails down a bug reported here: http://sourceforge.net/mailarchive/message.php?msg_id=14088259 which only occurred on systems where java.io.File.separatorChar is not a forward slash ('/') since - at the moment - jython modules hide java packag...
tbx/people/migrations/0026_culturepage_instagram_posts.py
elviva404/wagtail-torchbox
103
12638916
# Generated by Django 2.2.17 on 2021-05-21 21:22 from django.db import migrations import tbx.people.blocks import wagtail.core.blocks import wagtail.core.fields class Migration(migrations.Migration): dependencies = [ ("people", "0025_auto_20210505_1057"), ] operations = [ migrations.Add...
AutoSketcher/predict.py
D1anaGreen/essaykiller
4,551
12638933
import torch import random from utils.logging import logger, init_logger from models.pytorch_pretrained_bert.modeling import BertConfig from models import data_loader, model_builder from models.trainer import build_trainer import argparse import os def str2bool(v): if v.lower() in ('yes', 'true', 't', 'y', '1'): ...
meilisearch/tests/settings/test_settings_ranking_rules_meilisearch.py
jrinder42/meilisearch-python
159
12638934
NEW_RANKING_RULES = ['typo', 'exactness'] DEFAULT_RANKING_RULES = [ 'words', 'typo', 'proximity', 'attribute', 'sort', 'exactness' ] def test_get_ranking_rules_default(empty_index): """Tests getting the default ranking rules.""" response = empty_index().get_ranking_rules() assert i...
wagtailmenus/migrations/0007_auto_20160131_2000.py
pierremanceaux/wagtailmenus
329
12638938
<filename>wagtailmenus/migrations/0007_auto_20160131_2000.py # -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('wagtailmenus', '0006_auto_20160131_1347'), ] operations = [ mig...
functions/Cythonize.py
mmfink/raster-functions
173
12638987
<gh_stars>100-1000 """ Cythonize.py build_ext --inplace Cythonize.py clean """ from distutils.core import setup from Cython.Build import cythonize setup(ext_modules = cythonize("*.py"))
corehq/util/metrics/const.py
dimagilg/commcare-hq
471
12639027
import settings ALERT_ERROR = 'error' ALERT_WARNING = 'warning' ALERT_INFO = 'info' ALERT_SUCCESS = 'success' COMMON_TAGS = {'environment': settings.SERVER_ENVIRONMENT} TAG_UNKNOWN = '<unknown>' # Prometheus multiprocess_mode options MPM_ALL = 'all' MPM_LIVEALL = 'liveall' MPM_LIVESUM = 'livesum' MPM_MAX = 'max' MP...
tests/list_repos_test.py
charlievieth/all-repos
350
12639036
from all_repos.list_repos import main def test_list_repos_main(file_config_files, capsys): assert not main(('--config-filename', str(file_config_files.cfg))) out, _ = capsys.readouterr() assert out == 'repo1\nrepo2\n' def test_list_repos_with_output_paths(file_config_files, capsys): assert not main(...
lfs/core/__init__.py
michael-hahn/django-lfs
345
12639039
<reponame>michael-hahn/django-lfs default_app_config = 'lfs.core.apps.LfsCoreAppConfig'
Burp/lib/methodology_tsl.py
wisdark/HUNT
1,628
12639046
<reponame>wisdark/HUNT from javax.swing.event import TreeSelectionListener class TSL(TreeSelectionListener): def __init__(self, view): self.tree = view.get_tree() self.pane = view.get_pane() self.checklist = view.get_checklist() self.issues = view.get_issues() self.tabbed_pa...
querybook/server/lib/query_executor/executors/presto.py
shivammmmm/querybook
1,144
12639053
<gh_stars>1000+ from pyhive.exc import Error from const.query_execution import QueryExecutionErrorType from lib.query_executor.base_executor import QueryExecutorBaseClass from lib.query_executor.utils import get_parsed_syntax_error from lib.query_executor.clients.presto import PrestoClient from lib.query_executor.exec...
tests/meltano/core/test_project_files.py
meltano/meltano
122
12639070
<reponame>meltano/meltano<gh_stars>100-1000 import pytest # noqa: F401 class TestProjectFiles: def test_resolve_subfiles(self, project_files): assert project_files._meltano_file_path == (project_files.root / "meltano.yml") assert project_files.meltano == { "version": 1, "i...
Alignment/CommonAlignmentProducer/python/ALCARECOTkAlUpsilonMuMuPA_Output_cff.py
ckamtsikis/cmssw
852
12639074
import FWCore.ParameterSet.Config as cms # AlCaReco for track based alignment using Upsilon->mumu events in heavy ion (PA) data OutALCARECOTkAlUpsilonMuMuPA_noDrop = cms.PSet( SelectEvents = cms.untracked.PSet( SelectEvents = cms.vstring('pathALCARECOTkAlUpsilonMuMuPA') ), outputCommands = cms.unt...
tutorials/ner_pytorch_medical/scripts/azure/text_analytics.py
apjanco/projects
823
12639106
<filename>tutorials/ner_pytorch_medical/scripts/azure/text_analytics.py<gh_stars>100-1000 """ Custom Entity Recognition pipeline component using Azure Text Analytics. This implementation is based on the Presidio example here: https://microsoft.github.io/presidio/samples/python/text_analytics/example_text_analytics_re...
starthinker/tool/newsletter.py
arbrown/starthinker
138
12639207
########################################################################### # # 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 # # https://www.apache.org/l...
backend/kale/common/serveutils.py
brness/kale
502
12639208
# Copyright 2020 The Kale Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
Chapter06/flat/flatten.py
apolukhin/boost-cookbook
313
12639244
<reponame>apolukhin/boost-cookbook<gh_stars>100-1000 import os import sys import signal import subprocess import re import shutil class flattener: ''' ****************************************** Private functions ********************************************** ''' @staticmethod def _process_source(out, path)...
colossalai/nn/layer/colossalai_layer/linear.py
RichardoLuo/ColossalAI
1,630
12639259
<filename>colossalai/nn/layer/colossalai_layer/linear.py import math import inspect from typing import Callable from colossalai.utils import get_current_device from torch import dtype, nn from ... import init as init from ..parallel_1d import * from ..parallel_2d import * from ..parallel_2p5d import * from...
macro_benchmark/BERT_PyTorch/run_pretraining_inference.py
songhappy/ai-matrix
180
12639260
<gh_stars>100-1000 # coding=utf-8 # Copyright (c) 2019 NVIDIA CORPORATION. All rights reserved. # Copyright 2018 The Google AI Language Team Authors and The HugginFace Inc. team. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You ma...
docs/OOPS/Reference_variable_2.py
munyumunyu/Python-for-beginners
158
12639290
''' Just like a balloon without a ribbon, an object without a reference variable cannot be used later. ''' class Mobile: def __init__(self, price, brand): self.price = price self.brand = brand Mobile(1000, "Apple") #After the above line the Mobile # object created is lost and unusable
src/enamlnative/widgets/checkbox.py
codelv/enaml-native
237
12639292
""" Copyright (c) 2017, <NAME>. Distributed under the terms of the MIT License. The full license is in the file LICENSE, distributed with this software. Created on May 20, 2017 @author: jrm """ from atom.api import ( Typed, ForwardTyped, Bool, observe ) from enaml.core.declarative import d_ from .compound_but...
third_party/mesa/MesaLib/src/gallium/drivers/llvmpipe/lp_tile_shuffle_mask.py
Scopetta197/chromium
212
12639309
<reponame>Scopetta197/chromium tile = [[0,1,4,5], [2,3,6,7], [8,9,12,13], [10,11,14,15]] shift = 0 align = 1 value = 0L holder = [] import sys basemask = [0x fd = sys.stdout indent = " "*9 for c in range(4): fd.write(indent + "*pdst++ = \n"); for l,line in enumerate(tile): fd.write(indent + " %s_mm_s...
app/lib/cli/settings.py
grepleria/SnitchDNS
152
12639352
<reponame>grepleria/SnitchDNS<filename>app/lib/cli/settings.py<gh_stars>100-1000 import click import tabulate from flask.cli import with_appcontext from app.lib.base.provider import Provider @click.group('settings', help='SnitchDNS Setting Management') @with_appcontext def main(): pass @main.command('list') @wi...
pages/widgets.py
timbortnik/django-page-cms
113
12639366
# -*- coding: utf-8 -*- """Django CMS come with a set of ready to use widgets that you can enable in the admin via a placeholder tag in your template.""" from pages.settings import PAGES_MEDIA_URL, PAGES_STATIC_URL from pages.settings import PAGE_LANGUAGES from pages.models import Page from pages.widgets_registry impo...
test/test_objective.py
HowardHu97/ZOOpt
403
12639390
<reponame>HowardHu97/ZOOpt from zoopt import Objective from zoopt import Parameter from zoopt import Dimension from zoopt import Solution import numpy as np def ackley(solution): """ Ackley function for continuous optimization """ x = solution.get_x() bias = 0.2 ave_seq = sum([(i - bias) * (i ...
reviewboard/reviews/evolutions/group_email_list_only.py
amalik2/reviewboard
921
12639406
from __future__ import unicode_literals from django_evolution.mutations import AddField from django.db import models MUTATIONS = [ AddField('Group', 'email_list_only', models.BooleanField, initial=True) ]