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 |
|---|---|---|---|---|
libsortvis/algos/oddevensort.py | tknuth/sortvis | 117 | 11184171 | <reponame>tknuth/sortvis
def oddevensort(lst, nloops=2):
finished = False
while not finished:
finished = True
for n in xrange(nloops):
for i in xrange(n, len(lst) - 1, nloops):
if lst[i] > lst[i + 1]:
lst[i], lst[i + 1] = lst[i + 1], lst[i]
... |
test/outputs/test_commentator.py | fetus-hina/IkaLog | 285 | 11184179 | <filename>test/outputs/test_commentator.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# IkaLog
# ======
# Copyright (C) 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... |
datasets/kitti_raw_monodepth.py | NIRVANALAN/self-mono-sf | 213 | 11184210 | from __future__ import absolute_import, division, print_function
import os.path
import torch
import torch.utils.data as data
import numpy as np
from torchvision import transforms as vision_transforms
from .common import read_image_as_byte, read_calib_into_dict
from .common import kitti_crop_image_list, kitti_adjust_i... |
src/olympia/scanners/migrations/0021_auto_20200122_1347.py | shashwatsingh/addons-server | 843 | 11184216 | <gh_stars>100-1000
# Generated by Django 2.2.9 on 2020-01-22 13:47
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('scanners', '0020_auto_20200116_1250'),
]
operations = [
migrations.AlterField(
model_name='scannerqueryresult... |
impala/_thrift_api.py | wzhou-code/impyla | 661 | 11184229 | # Copyright 2015 Cloudera Inc.
#
# 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... |
leo/external/leoserver/leoserver.py | ATikhonov2/leo-editor | 1,550 | 11184230 | #@+leo-ver=5-thin
#@+node:ekr.20180216124241.1: * @file c:/leo.repo/leo-editor/leo/external/leoserver/leoserver.py
#@@language python
#@@tabwidth -4
#@+<< imports >>
#@+node:ekr.20180216124319.1: ** << imports >>
import json
import webbrowser
from http.server import HTTPServer, BaseHTTPRequestHandler
import leo.core.le... |
youtube_dl/extractor/tiktok.py | thename2468/youtube-dl-commithistory88 | 927 | 11184235 | <reponame>thename2468/youtube-dl-commithistory88
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import (
compat_str,
ExtractorError,
int_or_none,
str_or_none,
try_get,
url_or_none,
)
class TikTokBaseIE(InfoExtractor):
def _extract_aw... |
albu/src/eval.py | chritter/kaggle_carvana_segmentation | 447 | 11184244 | import os
import cv2
import numpy as np
from scipy.spatial.distance import dice
import torch
import torch.nn.functional as F
import torch.nn as nn
# torch.backends.cudnn.benchmark = True
import tqdm
from dataset.neural_dataset import ValDataset, SequentialDataset
from torch.utils.data.dataloader import DataLoader as ... |
netrd/dynamics/voter.py | sdmccabe/netrd | 116 | 11184261 | """
voter.py
--------
Implementation of voter model dynamics on a network.
author: <NAME>
Submitted as part of the 2019 NetSI Collabathon.
"""
from netrd.dynamics import BaseDynamics
import numpy as np
import networkx as nx
from ..utilities import unweighted
class VoterModel(BaseDynamics):
"""Voter dynamics.... |
capstone/capdb/migrations/0028_auto_20180319_2038.py | rachelaus/capstone | 134 | 11184276 | # Generated by Django 2.0.2 on 2018-03-19 20:38
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('capdb', '0027_auto_20180314_2100'),
]
operations = [
migrations.RemoveField(
model_name='casexml',
name='case_id',
)... |
webhooks/fail2ban/setup.py | hamptons/alerta-contrib | 114 | 11184287 | <reponame>hamptons/alerta-contrib
from setuptools import setup, find_packages
version = '1.0.0'
setup(
name="alerta-fail2ban",
version=version,
description='Alerta Webhook for Fail2Ban',
url='https://github.com/alerta/alerta-contrib',
license='MIT',
author='<NAME>',
author_email='<EMAIL>',... |
tests/perf/adam_test1.py | ConnollyLeon/DeepSpeed | 6,728 | 11184345 | import torch
from deepspeed.ops.adam import DeepSpeedCPUAdam
import time
device = 'cpu'
model_size = 1 * 1024**3
param = torch.nn.Parameter(torch.ones(model_size, device=device))
param_fp16 = torch.nn.Parameter(torch.ones(model_size,
dtype=torch.half,
... |
brew/generation/bagging.py | va26/brew | 344 | 11184391 | import numpy as np
from sklearn.ensemble import BaggingClassifier
from brew.base import Ensemble
from brew.combination.combiner import Combiner
import sklearn
from .base import PoolGenerator
class Bagging(PoolGenerator):
def __init__(self,
base_classifier=None,
n_classifiers=1... |
Chapter05/sift_detect.py | debojyoti007/OpenCV | 105 | 11184400 | <gh_stars>100-1000
import cv2
import numpy as np
input_image = cv2.imread('images/fishing_house.jpg')
gray_image = cv2.cvtColor(input_image, cv2.COLOR_BGR2GRAY)
# For version opencv < 3.0.0, use cv2.SIFT()
sift = cv2.xfeatures2d.SIFT_create()
keypoints = sift.detect(gray_image, None)
cv2.drawKeypoints(input_... |
observations/r/co2.py | hajime9652/observations | 199 | 11184406 | # -*- 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 co2(path):
"""Carbon Dioxide Uptake in Grass Plants
The `CO2` data... |
plugin.video.yatp/site-packages/hachoir_parser/video/avchd.py | mesabib/kodi.yatp | 194 | 11184428 | """
Parser for AVCHD/Blu-ray formats
Notice: This parser is based off reverse-engineering efforts.
It is NOT based on official specifications, and is subject to change as
more information becomes available. There's a lot of guesswork here, so if you find
that something disagrees with an official specification, please ... |
apps/invitations/admin.py | goztrk/django-htk | 206 | 11184430 | <gh_stars>100-1000
# Python Standard Library Imports
# Django Imports
from django.contrib import admin
class HtkInvitationAdmin(admin.ModelAdmin):
list_display = (
'id',
'email',
'first_name',
'last_name',
'invited_by',
'campaign',
'notes',
'user',
... |
tests/files.py | sourya-deepsource/pdf-annotate | 137 | 11184439 | <reponame>sourya-deepsource/pdf-annotate<gh_stars>100-1000
import os.path
dirname, _ = os.path.split(os.path.abspath(__file__))
SIMPLE = os.path.join(dirname, 'pdfs', 'simple.pdf')
ROTATED_90 = os.path.join(dirname, 'pdfs', 'rotated_90.pdf')
ROTATED_180 = os.path.join(dirname, 'pdfs', 'rotated_180.pdf')
ROTATED_270 ... |
webcompat/db/__init__.py | Rahib777-7/webcompat.com | 298 | 11184447 | <gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
"""Database initialization."""
from hashlib import sha... |
python/linkedlist/leetcode/delete_nth_node.py | googege/algo-learn | 153 | 11184486 | <reponame>googege/algo-learn<gh_stars>100-1000
# 删除链表倒数第N个节点
class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
class Solution:
# 先计数,再删除
def removeNthFromEnd_1(self, head: ListNode, n: int) -> ListNode:
def length(node: ListNode) -> int:
... |
app/controllers/config/account/profile.py | ctxis/crackerjack | 237 | 11184524 | from .. import bp
from flask import current_app
from flask_login import login_required, current_user
from flask import render_template, redirect, url_for, flash, request
from app.lib.base.provider import Provider
@bp.route('/profile', methods=['GET'])
@bp.route('/profile/<int:user_id>', methods=['GET'])
@login_requir... |
tools/SeeDot/seedot/compiler/ONNX/onnx_test_run.py | Shenzhen-Cloudatawalk-Technology-Co-Ltd/EdgeML | 719 | 11184529 | <gh_stars>100-1000
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.
import numpy as np
import onnxruntime
import common
import os, sys
import onnx
from onnx import helper
file_path = '../../../model/lenet/cifar-multiclass/input.onnx'
model = onnx.load(file_path)
sess = onn... |
google_or_tools/coins3_sat.py | tias/hakank | 279 | 11184562 | # Copyright 2021 <NAME> <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 writin... |
example/functions/add.py | osblinnikov/pytorch-binary | 293 | 11184595 | # functions/add.py
import torch
from torch.autograd import Function
from _ext import my_lib
class MyAddFunction(Function):
def forward(self, input1, input2):
output = input1.new()
if not input1.is_cuda:
my_lib.my_lib_add_forward(input1, input2, output)
else:
my_lib.... |
src/python/nimbusml/feature_extraction/image/__init__.py | michaelgsharp/NimbusML | 134 | 11184726 | from .loader import Loader
from .pixelextractor import PixelExtractor
from .resizer import Resizer
__all__ = [
'Loader',
'PixelExtractor',
'Resizer'
]
|
src/test/tests/operators/multires.py | visit-dav/vis | 226 | 11184738 | # ----------------------------------------------------------------------------
# CLASSES: nightly
#
# Test Case: multires.py
#
# Programmer: <NAME>
# Date: August 6, 2010
#
# ----------------------------------------------------------------------------
ds = data_path("Chombo_test_data/chombo.visit")
OpenData... |
scripts/parse_atmo_status_logs.py | simpsonw/atmosphere | 197 | 11184778 | #!/usr/bin/env python
import csv
from datetime import datetime
def _parse_logs(filename):
user_history = {}
pending_instances = {}
with open(filename, 'r') as the_file:
csvreader = csv.reader(the_file, delimiter=',')
for row in csvreader:
try:
(
... |
ts_datasets/ts_datasets/anomaly/synthetic.py | ankitakashyap05/Merlion | 2,215 | 11184779 | #
# Copyright (c) 2021 salesforce.com, inc.
# All rights reserved.
# SPDX-License-Identifier: BSD-3-Clause
# For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
#
import glob
import os
import pandas as pd
from ts_datasets.anomaly.base import TSADBaseDataset
c... |
Candidates/trainCandidates.py | shv07/microexpnet | 150 | 11184790 | '''
Title :trainCandidates.py
Description :This script trains Candidate nets, plots learning curves
and saves corresponding Tensorflow models
Author :<NAME> & <NAME>
Date Created :28-04-2017
Date Modified :09-06-2019
version :1.3
python_version :2.7.11
'''
from __... |
rastervision/data/raster_transformer/raster_transformer.py | carderne/raster-vision | 1,577 | 11184865 | <gh_stars>1000+
from abc import (ABC, abstractmethod)
class RasterTransformer(ABC):
"""Transforms raw chips to be input to a neural network."""
@abstractmethod
def transform(self, chip, channel_order=None):
"""Transform a chip of a raster source.
Args:
chip: ndarray of shape ... |
transformations/factive_verb_transformation/transformation.py | JerryX1110/NL-Augmenter | 583 | 11184866 | <filename>transformations/factive_verb_transformation/transformation.py
from interfaces.SentenceOperation import SentenceOperation
from tasks.TaskTypes import TaskType
import random
from typing import List
import spacy
from initialize import spacy_nlp
def extract_names_and_titles():
"""
Extract names, titles,... |
eosfactory/core/utils.py | tuan-tl/eosfactory | 255 | 11184910 | <reponame>tuan-tl/eosfactory
import time
import os
import shutil
import threading
import subprocess
import eosfactory.core.errors as errors
def wslMapLinuxWindows(path, back_slash=True):
if not path or path.find("/mnt/") != 0:
return path
path = path[5].upper() + ":" + path[6:]
if back_slash:
... |
Twitter_Scraper_without_API/display_hashtags.py | avinashkranjan/PraticalPythonProjects | 930 | 11184927 | <reponame>avinashkranjan/PraticalPythonProjects<filename>Twitter_Scraper_without_API/display_hashtags.py
import sqlite3
import os
def sql_connection():
"""
Establishes a connection to the SQL file database
:return connection object:
"""
path = os.path.abspath('./Twitter_Scraper_without_API/Twitter... |
contrib/tools/python/src/Lib/plat-mac/lib-scriptpackages/Terminal/Terminal_Suite.py | HeyLey/catboost | 6,989 | 11184932 | <filename>contrib/tools/python/src/Lib/plat-mac/lib-scriptpackages/Terminal/Terminal_Suite.py
"""Suite Terminal Suite: Terms and Events for controlling the Terminal application
Level 1, version 1
Generated from /Applications/Utilities/Terminal.app
AETE/AEUT resource version 1/0, language 0, script 0
"""
import aetool... |
appengine/gallery_api/submit.py | bharati-software/blockly-games-Kannada | 1,184 | 11184946 | <reponame>bharati-software/blockly-games-Kannada
"""Blockly Games: Gallery
Copyright 2018 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
U... |
alipay/aop/api/domain/CarRentalVehicleInfo.py | antopen/alipay-sdk-python-all | 213 | 11184959 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class CarRentalVehicleInfo(object):
def __init__(self):
self._car_no = None
self._vehicle_capacity = None
self._vehicle_color = None
self._vehicle_models = None
... |
fastweb/test/interactive.py | BSlience/fastweb | 123 | 11184977 | import code
import readline
import atexit
import os
class HistoryConsole(code.InteractiveConsole):
def __init__(self, locals=None, filename="<console>",
histfile=os.path.expanduser("~/.console-history")):
code.InteractiveConsole.__init__(self, locals, filename)
self.init_history(h... |
commands/type_lookup.py | ikust/omnisharp-sublime | 424 | 11184995 | import os
import sublime
import sublime_plugin
from ..lib import helpers
from ..lib import omnisharp
class OmniSharpTypeLookup(sublime_plugin.TextCommand):
outputpanel = None
def run(self, edit):
sublime.active_window().run_command("hide_panel",{"panel": "output.variable_get"})
s... |
tools/generate-smtp.py | drewm27/misp-warninglists | 277 | 11185043 | <reponame>drewm27/misp-warninglists<filename>tools/generate-smtp.py
#!/usr/bin/env python3
import multiprocessing.dummy
from generator import get_version, write_to_file, Dns, consolidate_networks, create_resolver
# Source: https://github.com/mailcheck/mailcheck/wiki/List-of-Popular-Domains
domains = [
# Default do... |
macaw/core/interaction_handler/user_requests_db.py | SouvickG/macaw | 146 | 11185057 | """
The conversation (or interaction) database implemented using MongoDB.
Authors: <NAME> (<EMAIL>)
"""
from pymongo import MongoClient
from macaw import util
from macaw.core.interaction_handler.msg import Message
class InteractionDB:
def __init__(self, host, port, dbname):
self.client = MongoClient(ho... |
spectacles/types.py | felipefrancisco/spectacles | 150 | 11185098 | from typing import Dict, Any
from typing_extensions import Literal
QueryMode = Literal["batch", "hybrid", "single"]
JsonDict = Dict[str, Any]
|
docs/code/buffer_single_side.py | Jeremiah-England/Shapely | 2,382 | 11185155 | from matplotlib import pyplot
from shapely.geometry import LineString
from descartes import PolygonPatch
from figures import SIZE, BLUE, GRAY, set_limits, plot_line
line = LineString([(0, 0), (1, 1), (0, 2), (2, 2), (3, 1), (1, 0)])
fig = pyplot.figure(1, figsize=SIZE, dpi=90)
# 1
ax = fig.add_subplot(121)
plot_li... |
utils/imdb_data_util.py | dujiaxin/graph_star | 112 | 11185219 | import numpy as np
import os
import torch
import random
from bert_serving.client import BertClient
random.seed(31415926)
def build_imdb_npy(imdb_path):
for file_path in [os.path.join(imdb_path, "train"),
os.path.join(imdb_path, "test")]:
txt_list = []
y = []
for label... |
hpccm/building_blocks/kokkos.py | robertmaynard/hpc-container-maker | 340 | 11185228 | # Copyright (c) 2019, NVIDIA 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 copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
python/fetch.py | npmmirror/notes | 1,384 | 11185237 | #!/usr/bin/env python
# encoding: utf-8
import os
from contextlib import closing
from urllib.parse import urlparse
import requests
# 转自https://www.zhihu.com/question/41132103/answer/93438156
def wget(url, file_name):
with closing(requests.get(url, stream=True)) as response:
chunk_size = 1024 # 单次请求最大值... |
benchmark/scripts/benchmark_resnet.py | kalyc/keras-apache-mxnet | 300 | 11185250 | <filename>benchmark/scripts/benchmark_resnet.py
'''Trains a ResNet on the ImageNet/CIFAR10 dataset.
Credit:
Script modified from examples/cifar10_resnet.py
Reference:
ResNet v1
[a] Deep Residual Learning for Image Recognition
https://arxiv.org/pdf/1512.03385.pdf
ResNet v2
[b] Identity Mappings in Deep Residual Networks... |
okta/models/log_security_context.py | corylevine/okta-sdk-python | 145 | 11185261 | # flake8: noqa
"""
Copyright 2020 - Present Okta, Inc.
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 ... |
ebcli/controllers/setenv.py | senstb/aws-elastic-beanstalk-cli | 110 | 11185270 | <gh_stars>100-1000
# Copyright 2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "li... |
sdk/python/tests/compiler/testdata/many_results_with_warnings.py | shrivs3/kfp-tekton | 102 | 11185276 | <reponame>shrivs3/kfp-tekton<gh_stars>100-1000
# Copyright 2021 kubeflow.org
#
# 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 req... |
Python/QuantLib/__init__.py | yrtf/QuantLib-SWIG | 231 | 11185291 | # -*- coding: iso-8859-1 -*-
"""
Copyright (C) 2000, 2001, 2002, 2003 RiskMap srl
This file is part of QuantLib, a free-software/open-source library
for financial quantitative analysts and developers - http://quantlib.org/
QuantLib is free software: you can redistribute it and/or modify it
under the terms of the... |
deep_qa/layers/__init__.py | richarajpal/deep_qa | 459 | 11185310 | <reponame>richarajpal/deep_qa<gh_stars>100-1000
# Individual layers.
from .additive import Additive
from .bigru_index_selector import BiGRUIndexSelector
from .complex_concat import ComplexConcat
from .highway import Highway
from .l1_normalize import L1Normalize
from .masked_layer import MaskedLayer
from .noisy_or impo... |
tests/test_utils.py | MZehren/msaf | 372 | 11185321 | # Run me as follows:
# cd tests/
# nosetests -v -s test_utils.py
import copy
import librosa
import numpy as np
import os
# Msaf imports
import msaf
# Global vars
audio_file = os.path.join("fixtures", "chirp.mp3")
sr = msaf.config.sample_rate
audio, fs = librosa.load(audio_file, sr=sr)
y_harmonic, y_percussive = libro... |
Dynamic Programming/877. Stone Game.py | beckswu/Leetcode | 138 | 11185333 | <gh_stars>100-1000
class Solution:
def stoneGame(self, piles: List[int]) -> bool:
n = len(piles)
dp = [[0] * n for i in range(n)]
for i in range(n): dp[i][i] = piles[i]
for d in range(1, n):
for i in range(n - d):
dp[i][i + d] = max(piles[i] - dp[i + 1][i... |
packages/pyright-internal/src/tests/samples/assert1.py | sasano8/pyright | 4,391 | 11185366 | # This sample tests the ability to detect errant assert calls
# that are always true - the "reportAssertAlwaysTrue" option.
from typing import Any, Tuple
# This should generate a warning.
assert (1 != 2, "Error message")
def foo(a: Tuple[int, ...]):
assert a
b = ()
assert b
c = (2, 3)
# This should genera... |
idaes/tests/test_docs.py | eslickj/idaes-pse | 112 | 11185387 | #################################################################################
# The Institute for the Design of Advanced Energy Systems Integrated Platform
# Framework (IDAES IP) was produced under the DOE Institute for the
# Design of Advanced Energy Systems (IDAES), and is copyright (c) 2018-2021
# by the softwar... |
Day2/Python/String_and_pallindrome.py | Grace0Hud/dailycodebase | 249 | 11185389 | """
* @author Shashank
* @date 21/12/2018
"""
a=input("Enter the input string:")
d=a.replace(" ","")
c=list(d)
c.reverse()
e="".join(c)
if d==e:
print("String is pallindrome")
else:
print("Not a pallindrome")
|
tests/columns/test_choices.py | 0scarB/piccolo | 750 | 11185492 | from tests.base import DBTestCase
from tests.example_apps.music.tables import Shirt
class TestChoices(DBTestCase):
def _insert_shirts(self):
Shirt.insert(
Shirt(size=Shirt.Size.small),
Shirt(size=Shirt.Size.medium),
Shirt(size=Shirt.Size.large),
).run_sync()
... |
mobility_scraper/__init__.py | ActiveConclusion/COVID19_mobility | 239 | 11185495 | <gh_stars>100-1000
from .paths_and_URLs import *
from .download_files import *
from .utils import *
from .mobility_processing import (
google_mobility,
apple_mobility,
waze_mobility,
tomtom_mobility,
merge_reports,
) |
tensorflow_model_analysis/evaluators/analysis_table_evaluator.py | jaymessina3/model-analysis | 1,118 | 11185499 | # Lint as: python3
# Copyright 2018 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 agr... |
scripts/python/qliblabels.py | JosephSilvermanArt/qLib | 572 | 11185500 | <filename>scripts/python/qliblabels.py
"""
@file qliblabels.py
@author xy
@since 2014-08-09
@brief qLib, node tagging/labeling functions (semantics).
"""
import hou
import re
import traceback
import datetime
import sys
labels = {
# a completed partial-result... |
env/Lib/site-packages/OpenGL/GLES1/EXT/discard_framebuffer.py | 5gconnectedbike/Navio2 | 210 | 11185571 | '''OpenGL extension EXT.discard_framebuffer
This module customises the behaviour of the
OpenGL.raw.GLES1.EXT.discard_framebuffer to provide a more
Python-friendly API
Overview (from the spec)
This extension provides a new command, DiscardFramebufferEXT, which
causes the contents of the named framebuffer attach... |
tests/monitor_temp_file.py | ebourg/isign | 666 | 11185596 | """"
isign creates big temporary files, using the standard tempfile library.
If they are not cleaned up, they can fill up the disk. This has
already happened in production. :(
This library monkey-patches tempfile to use our own temporary
directory, so it's easy to test that we aren't leaving any temp files behind.
"""... |
qtl/leafcutter/src/cluster_prepare_fastqtl.py | cjops/gtex-pipeline | 247 | 11185598 | <filename>qtl/leafcutter/src/cluster_prepare_fastqtl.py
from __future__ import print_function
import pandas as pd
import numpy as np
import argparse
import subprocess
import os
import gzip
import contextlib
from datetime import datetime
import tempfile
import shutil
import glob
from sklearn.decomposition import PCA
@... |
nlpaug/model/spectrogram/time_warping.py | techthiyanes/nlpaug | 3,121 | 11185599 | # import numpy as np
#
# from nlpaug.model import Spectrogram
#
#
# class TimeWarping(Spectrogram):
# def __init__(self, time_warp):
# super(TimeWarping, self).__init__()
#
# self.time_warp = time_warp
#
# # TODO
# def mask(self, mel_spectrogram):
# """
# From: https://ar... |
benchmarks/benchmarks/cluster_hierarchy_disjoint_set.py | Ennosigaeon/scipy | 9,095 | 11185600 | import numpy as np
try:
from scipy.cluster.hierarchy import DisjointSet
except ImportError:
pass
from .common import Benchmark
class Bench(Benchmark):
params = [[100, 1000, 10000]]
param_names = ['n']
def setup(self, n):
# Create random edges
rng = np.random.RandomState(seed=0)
... |
tests/test_cursor.py | AlekseyMolchanov/aioodbc | 251 | 11185602 | <reponame>AlekseyMolchanov/aioodbc<gh_stars>100-1000
import pyodbc
import pytest
@pytest.mark.parametrize('db', pytest.db_list)
@pytest.mark.asyncio
async def test_cursor_with(conn, table):
ret = []
# regular cursor usage
cur = await conn.cursor()
await cur.execute('SELECT * FROM t1;')
assert not... |
examples/import_yara_ruleset.py | Dmenifee23-star/vt-py | 208 | 11185649 | <reponame>Dmenifee23-star/vt-py
#!/usr/local/bin/python
# Copyright © 2020 The vt-py 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/... |
vilya/libs/auth/check_auth.py | mubashshirjamal/code | 1,582 | 11185685 | # -*- coding: utf-8 -*-
from datetime import datetime
from vilya.models.api_key import ApiKey
from vilya.models.api_token import ApiToken
from vilya.libs.auth.oauth import OAuthError
from vilya.libs.auth import errors as err
from vilya.libs.auth import AuthCode
def check_auth(request):
auth_header = request.envi... |
backup/drivers/mysql_base.py | a4913994/openstack_trove | 244 | 11185743 | <gh_stars>100-1000
# Copyright 2020 Catalyst Cloud
#
# 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 app... |
greenbot/exc.py | EMorf/greenbot | 145 | 11185762 | class FailedCommand(Exception):
pass
class UserNotFound(Exception):
pass
class InvalidLogin(Exception):
pass
class InvalidPointAmount(Exception):
pass
class TimeoutException(Exception):
pass
|
pyekaboo/mkpyekaboo.py | SafeBreach-Labs/pyekaboo | 154 | 11185770 | #!/usr/bin/env python
#
# Copyright (c) 2017, SafeBreach
# 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 source code must retain the above
# copyright notice, this lis... |
python/ql/test/query-tests/Security/CWE-327/InsecureProtocol.py | timoles/codeql | 4,036 | 11185794 | <filename>python/ql/test/query-tests/Security/CWE-327/InsecureProtocol.py
import ssl
from OpenSSL import SSL
from ssl import SSLContext
# insecure versions specified
ssl.wrap_socket(ssl_version=ssl.PROTOCOL_SSLv2)
ssl.wrap_socket(ssl_version=ssl.PROTOCOL_SSLv3)
ssl.wrap_socket(ssl_version=ssl.PROTOCOL_TLSv1)
SSLConte... |
modules/method.py | Mattmess/Test | 638 | 11185800 | import asyncio
from modules.printer import clout
async def test_method(session, url):
try:
response = await session.get(url, allow_redirects=True)
if response.status != 404:
await clout(response.url)
else:
pass
except asyncio.exceptions.TimeoutError:
#pri... |
pkg_pytorch/blendtorch/btt/utils.py | kongdai123/pytorch-blender | 381 | 11185827 | <filename>pkg_pytorch/blendtorch/btt/utils.py<gh_stars>100-1000
import socket
def get_primary_ip():
'''Returns the primary IP address of this machine (the one with).
See https://stackoverflow.com/a/28950776
Returns the IP address with the default route attached or `127.0.0.1`.
'''
s = socket.socket... |
vit/color_mappings.py | kinifwyne/vit | 179 | 11185831 | import re
BRIGHT_REGEX = re.compile('.*bright.*')
def task_256_to_urwid_256():
manual_map = {
'red': 'dark red',
'green': 'dark green',
'blue': 'dark blue',
'cyan': 'dark cyan',
'magenta': 'dark magenta',
'gray': 'light gray',
'yellow': 'brown',
'colo... |
runtime/python/Lib/site-packages/pyvisa/compat/__init__.py | hwaipy/InteractionFreeNode | 154 | 11185882 | # -*- coding: utf-8 -*-
"""
pyvisa.compat
~~~~~~~~~~~~~
Compatibility layer.
:copyright: 2014 by PyVISA Authors, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import (division, unicode_literals, print_function,
absolute_impo... |
tests/test_gammatone_filters.py | glhr/gammatone | 176 | 11185889 | #!/usr/bin/env python3
# Copyright 2014 <NAME>, <EMAIL>
#
# This file is part of the gammatone toolkit, and is licensed under the 3-clause
# BSD license: https://github.com/detly/gammatone/blob/master/COPYING
import nose
import numpy as np
import scipy.io
from pkg_resources import resource_stream
import gammatone.fil... |
migrations/versions/501983249c94_set_on_delete_cascad.py | vault-the/changes | 443 | 11185891 | """Set ON DELETE CASCADE on Patch.*
Revision ID: 501983249c94
Revises: 403b3fb41569
Create Date: 2013-12-23 16:12:13.610366
"""
# revision identifiers, used by Alembic.
revision = '501983249c94'
down_revision = '403b3fb41569'
from alembic import op
def upgrade():
op.drop_constraint('patch_change_id_fkey', 'pa... |
app/manifest_worker.py | tappi287/openvr_fsr_app | 146 | 11185895 | import concurrent.futures
import logging
import os
from pathlib import Path
from typing import Optional, List
from .globals import OPEN_VR_DLL, EXE_NAME
from .openvr_mod import get_available_mods
class ManifestWorker:
""" Multi threaded search in steam apps for openvr_api.dll """
max_workers = min(48, int(ma... |
Trakttv.bundle/Contents/Libraries/Shared/oem_framework/models/core/base/mapping.py | disrupted/Trakttv.bundle | 1,346 | 11185925 | from oem_framework.models.core.base.model import Model
from oem_framework.models.core.mixins.names import NamesMixin
class BaseMapping(Model, NamesMixin):
__slots__ = ['collection']
def __init__(self, collection):
self.collection = collection
def to_dict(self, key=None, flatten=True):
ra... |
happytransformer/wp/__init__.py | TheCuriousNerd/happy-transformer | 277 | 11185935 | from .trainer import WPTrainer
from .default_args import ARGS_WP_TRAIN, ARGS_WP_EVAl, ARGS_WP_TEST
name = "happytransformer.mwp"
|
timemachines/skaters/rvr/rvrsarimax.py | iklasky/timemachines | 253 | 11185944 | from timemachines.skaters.rvr.rvrinclusion import using_river
from timemachines.skatertools.utilities.conventions import Y_TYPE, A_TYPE, R_TYPE, E_TYPE, T_TYPE, wrap
if using_river:
from river import linear_model, optim, preprocessing, time_series
from timemachines.skatertools.components.parade import parade
... |
recipes/Python/162224_Check_HTTP_Content_Type/recipe-162224.py | tdiprima/code | 2,023 | 11186001 | import urllib
from types import *
def iscontenttype(URLorFile,contentType='text'):
"""
Return true or false (1 or 0) based on HTTP Content-Type.
Accepts either a url (string) or a "urllib.urlopen" file.
Defaults to 'text' type.
Only looks at start of content-type, so you can be as vague or prec... |
peering/migrations/0031_auto_20190227_2210.py | schiederme/peering-manager | 173 | 11186010 | <filename>peering/migrations/0031_auto_20190227_2210.py
# Generated by Django 2.1.7 on 2019-02-27 21:10
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [("peering", "0030_directpeeringsession_router")]
operations = [
migrations.AlterModelOptions(
n... |
aliyun-python-sdk-hcs-mgw/aliyunsdkhcs_mgw/request/v20171024/CreateRemoteRequest.py | yndu13/aliyun-openapi-python-sdk | 1,001 | 11186019 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
aleph/logic/diagrams.py | tolgatasci/aleph | 1,213 | 11186028 | import logging
from uuid import uuid4
from flask import render_template
from tempfile import NamedTemporaryFile
from pantomime.types import HTML
from aleph import settings
from aleph.core import archive
from aleph.index.entities import entities_by_ids
log = logging.getLogger(__name__)
FIELDS = ["id", "schema", "prope... |
python/ql/test/library-tests/frameworks/pycurl/test.py | RoryPreddyGithubEnterprise/codeql | 643 | 11186108 | <gh_stars>100-1000
import pycurl
c = pycurl.Curl()
c.setopt(pycurl.URL, "url") # $ clientRequestUrlPart="url" |
recipes/Python/578988_Money_Game/recipe-578988.py | tdiprima/code | 2,023 | 11186109 | <filename>recipes/Python/578988_Money_Game/recipe-578988.py
"""A simple money counting game for kids."""
import random
import sys
class Money:
def __init__(self):
pass
@staticmethod
def display_intro():
"""Display the introduction at the start of program execution."""
print('*' *... |
benchmarks/tpch-pyarrow-p.py | ritchie46/connector-x | 565 | 11186139 | """
Usage:
tpch-pyarrow-p.py <num>
Options:
-h --help Show this screen.
--version Show version.
"""
import io
import itertools
import os
from multiprocessing import Pool
from typing import Any, List
import numpy as np
import pyarrow as pa
from contexttimer import Timer
from docopt import docopt
from pya... |
icevision/models/mmdet/lightning/__init__.py | ai-fast-track/mantisshrimp | 580 | 11186177 | from icevision.models.mmdet.lightning.model_adapter import *
|
examples/getting_started/plot_nested_pipelines.py | vincent-antaki/Neuraxle | 519 | 11186209 | """
Create Nested Pipelines in Neuraxle
================================================
You can create pipelines within pipelines using the composition design pattern.
This demonstrates how to create pipelines within pipelines, and how to access the steps and their
attributes in the nested pipelines.
For more info,... |
tests/api/product_tests.py | prdonahue/overholt | 1,152 | 11186230 | # -*- coding: utf-8 -*-
"""
tests.api.product_tests
~~~~~~~~~~~~~~~~~~~~~~~
api product tests module
"""
from ..factories import CategoryFactory, ProductFactory
from . import OverholtApiTestCase
class ProductApiTestCase(OverholtApiTestCase):
def _create_fixtures(self):
super(ProductApiTestC... |
bench/convert.py | security-geeks/paratext | 1,145 | 11186350 | <reponame>security-geeks/paratext
#!/usr/bin/env python
import pandas
import pickle
import feather
import h5py
import numpy as np
import scipy.io as sio
import os
import sys
def convert_feather(df, output_filename):
feather.write_dataframe(df, output_filename)
def convert_hdf5(df, output_filename):
X = df.va... |
lib/stripe_lib/enums.py | goztrk/django-htk | 206 | 11186416 | <reponame>goztrk/django-htk
# Python Standard Library Imports
from enum import Enum
class StripeProductType(Enum):
good = 1
service = 2
class StripePlanInterval(Enum):
day = 1
week = 2
month = 3
year = 4
|
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/varscript_formatting/helperfunc.py | medismailben/llvm-project | 2,338 | 11186424 | import lldb
def f(value, d):
return "pointer type" if value.GetType().GetTemplateArgumentType(
0).IsPointerType() else "non-pointer type"
|
jupyterlab_git/tests/test_single_file_log.py | bsande6/jupyterlab-git | 1,097 | 11186452 | <reponame>bsande6/jupyterlab-git
from pathlib import Path
from unittest.mock import patch
import pytest
from jupyterlab_git.git import Git
from .testutils import maybe_future
@pytest.mark.asyncio
async def test_single_file_log():
with patch("jupyterlab_git.git.execute") as mock_execute:
# Given
... |
plyer/platforms/android/devicename.py | lcs-d3v/plyer | 1,184 | 11186455 | <gh_stars>1000+
'''
Module of Android API for plyer.devicename.
'''
from jnius import autoclass
from plyer.facades import DeviceName
Build = autoclass('android.os.Build')
class AndroidDeviceName(DeviceName):
'''
Implementation of Android devicename API.
'''
def _get_device_name(self):
"""
... |
osr2mp4/VideoProcess/Setup.py | ADoesGit/osr2mp4-core | 103 | 11186465 | <filename>osr2mp4/VideoProcess/Setup.py
import numpy as np
from PIL import Image
from recordclass import recordclass
FrameInfo = recordclass("FrameInfo", "cur_time index_hitobj info_index osr_index index_fp obj_endtime x_end y_end, break_index")
CursorEvent = recordclass("CursorEvent", "event old_x old_y")
def get_b... |
generalization/utils/client_data_utils_test.py | garyxcheng/federated | 330 | 11186505 | <filename>generalization/utils/client_data_utils_test.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 the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# ... |
scripts/run_parsers.py | joye1503/cocrawler | 166 | 11186521 | <reponame>joye1503/cocrawler
'''
Runs all of the available parsers over a tree of html
Accumulate cpu time
Compare counts of urls and embeds
'''
import sys
import os
import logging
import functools
from bs4 import BeautifulSoup
import cocrawler.stats as stats
import cocrawler.parse as parse
def parse_all(name, st... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.