max_stars_repo_path
stringlengths
3
269
max_stars_repo_name
stringlengths
4
119
max_stars_count
int64
0
191k
id
stringlengths
1
7
content
stringlengths
6
1.05M
score
float64
0.23
5.13
int_score
int64
0
5
tests/test_basics.py
viki-org/logstash-docker
305
47400
<filename>tests/test_basics.py from .fixtures import logstash from .constants import logstash_version_string def test_logstash_is_the_correct_version(logstash): assert logstash_version_string in logstash.stdout_of('logstash --version') def test_the_default_user_is_logstash(logstash): assert logstash.stdout_...
2.328125
2
algorithms/topological_maps/tests/test_topological.py
alex-petrenko/landmark-exploration
4
47401
<gh_stars>1-10 import copy import math import random import shutil from string import ascii_lowercase from unittest import TestCase import numpy as np import networkx as nx from algorithms.agent import AgentLearner from algorithms.tests.test_wrappers import TEST_ENV_NAME from algorithms.topological_maps.topological_m...
2.328125
2
ch8/exercises/ans8_6.py
chunhua2017/pythonprogrammingdemo
4
47402
<reponame>chunhua2017/pythonprogrammingdemo # 获取CPU的核数N,创建N个线程。每个线程使用同一个函数作为target输入, # 在该函数中,定义一个局部变量,并对它做1000000次加1, # 查看局部变量的最终结果是否等于1000000,并分析为什么? import threading, os, time N = os.cpu_count() # 获取CPU的核数N # 定义任务 def task(n): counter = 0 for i in range(n): counter += 1 #局部变量n次自加1 print(f"coun...
3.921875
4
src/utils.py
Benjvdg/altered-configurator
0
47403
<gh_stars>0 from .configuration import Configuration def create_config_list(lst_config): lst_obj_config = [] for config in lst_config: split_path = config.split("\\") name = split_path[-1].replace(".txt", "") new_config = Configuration(name, config) lst_obj_config.append(new_co...
2.5
2
DataParser.pyw
RobustProgram/Python-GEngine
0
47404
import configparser """ VARIABLES """ config_Path = "EngineDataFile\EngineConfig\GEngineSettings.ini" class GEngineConfig: def __init__(self): try: with open(config_Path): print("File exists") except IOError: print("Error opening " + str(config_Path) + ", cr...
3.046875
3
profile/bcs_gap_energy.py
pleroux0/super_material
3
47405
#!/usr/bin/env python3 from cProfile import Profile from numpy import linspace from super_material.gap_energy import BCSGapEnergy def run(): bcs_gap_energy = BCSGapEnergy(1.5e-3, 4000) temperatures = linspace(0, bcs_gap_energy.critical_temperature(), 500) with Profile() as profile: for tempera...
2.46875
2
rotkehlchen/tests/unit/uniswap/test_calculate_events_balances.py
rotkehlchenio/rotkehlchen
137
47406
<filename>rotkehlchen/tests/unit/uniswap/test_calculate_events_balances.py from typing import List import pytest from rotkehlchen.chain.ethereum.interfaces.ammswap.types import LiquidityPool, LiquidityPoolEvent from .utils import ( LP_1_EVENTS, LP_1_EVENTS_BALANCE, LP_2_EVENTS, LP_2_EVENTS_BALANCE, ...
2.0625
2
chat/forms.py
Firexd2/social-network
2
47407
<reponame>Firexd2/social-network from django import forms from chat.models import Message, Room class NewRoomForm(forms.ModelForm): ids_users = forms.CharField(label='', required=False, widget=forms.TextInput(attrs={'hidden': 'true'})) first_message = forms.CharField(label='Приветственное сообщение', requi...
2.34375
2
Books/GodOfPython/P17_Database/chapter17.py
Tim232/Python-Things
2
47408
from sqlite3 import * # mydb = connect('D:/02.Python/ch17/fruit.db') # csr = mydb.cursor() # csr.execute('create table test(fruit varchar(20), num int, price int)') # csr.execute("insert into test(fruit, num, price) values('Apple', 10, 1000)") # csr.execute('select * from test') # row = csr.fetchone() # print(row) # my...
4.25
4
jogo_nim.py
paulo-caixeta/00_CURSO_PYTHON
0
47409
def partida (): n = int(input("Escolha quantas peças para jogar: ")) while n <= 0: print ("Jogada não permitida. Escolha um número inteiro positivo") n = int(input("Escolha quantas peças para jogar: ")) m = int(input("Qual a quantidade máxima de peças removidas? ")) while m >= n or m <= ...
4.09375
4
difference_scores_scripts/difference_time_score.py
smoorjani/LA-Crime-Analysis
0
47410
<reponame>smoorjani/LA-Crime-Analysis<filename>difference_scores_scripts/difference_time_score.py import numpy as np import pandas as pd # Graphs the difference scores explained in slides with respect to time def chunkIt(seq, num): avg = len(seq) / float(num) out = [] last = 0.0 while last ...
3.515625
4
procafe/appProcafe/admin.py
ChrisTGX/PROCAFE
0
47411
# -*- coding: utf-8 -*- from django.contrib import admin from django.contrib.auth.admin import UserAdmin from appProcafe.models import Department, Unit, Section, Risk, Position, Location,\ Paysheet, Type, CourseRequest, CourseChangeRequest from appProcafe.models import Telephone, Document, Takes, Course from ...
1.953125
2
Scrapping JSON.py
AndrewPotap/Coursera_Python_Course
0
47412
<gh_stars>0 import urllib.request, urllib.parse, urllib.error import json url_link = input('Enter location: ') print('Retrieving:', url_link) handler = urllib.request.urlopen(url_link).read() js = json.loads(handler) print('Retrieved', len(handler), "characters") total = 0 count = 0 for comment in js['comm...
3.171875
3
jkonet/models/model_jko.py
bunnech/jkonet
1
47413
<reponame>bunnech/jkonet #!/usr/bin/python3 # author: <NAME> # imports import jax import jax.numpy as jnp import numpy as np import optax # internal imports from jkonet.utils.helper import count_parameters from jkonet.utils.optim import global_norm, penalize_weights_icnn from jkonet.models import fixpoint_loop from j...
1.742188
2
chap02/v2.0/app.py
usadamasa/Understanding-K8s
48
47414
#!/usr/bin/env python3 from flask import Flask, render_template, request import os,random,socket app = Flask(__name__) images = [ "las-01.jpg", "las-02.jpg", "las-03.jpg", "las-04.jpg", "las-05.jpg", "las-06.jpg" ] @app.route('/') def index(): host_name = "{} to {}".format(socket.gethost...
2.484375
2
python/testData/inspections/PyTypeCheckerInspection/PromotingBytearrayToStrAndUnicode.py
jnthn/intellij-community
2
47415
def f(bar): # type: (str) -> str return bar f(bytearray())
2.234375
2
botornado/__init__.py
bopopescu/botornado-1
22
47416
<reponame>bopopescu/botornado-1 # Copyright (c) 2006-2011 <NAME> http://garnaat.org/ # Copyright (c) 2010-2011, Eucalyptus Systems, Inc. # Copyright (c) 2011, Nexenta Systems Inc. # All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated do...
1.890625
2
src/notebooks/nsynth_interpolation.py
BZ-2453/DeepBass
1
47417
from os import listdir from os.path import isfile, join import numpy as np import matplotlib.pyplot as plt from magenta.models.nsynth.wavenet import fastgen import sys # Change path back to /src to load other modules sys.path.insert(0, '/home/ubuntu/DeepBass/src') from ingestion.IO_utils import Load, Save from preproce...
1.90625
2
src/runner/__init__.py
cmlab-mira/MedicalPro
6
47418
<filename>src/runner/__init__.py<gh_stars>1-10 from .trainers import * from .predictors import * from .utils import *
1.054688
1
recommend/eusolver/scripts/job_list_icfp_anytime.py
jiry17/IntSy
7
47419
<reponame>jiry17/IntSy # job_list_one_shot.py --- # # Filename: job_list_one_shot.py # Author: <NAME> # Created: Tue Jan 26 15:13:19 2016 (-0500) # # # Copyright (c) 2015, <NAME>, University of Pennsylvania # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are...
1.453125
1
api/app/database.py
Le96/todays-mazai
0
47420
import os from sqlalchemy import create_engine from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker USER = os.getenv("DB_USER") PASS = os.getenv("DB_PASSWORD") HOST = os.getenv("DB_HOST") PORT = os.getenv("DB_PORT") SCHEMA = os.getenv("DB_SCHEMA") SQLALCHEMY_DATABASE_URL = ...
2.921875
3
tests/application/models.py
YoungAspirations/QA-Projects
0
47421
<reponame>YoungAspirations/QA-Projects<filename>tests/application/models.py from application import db class Users(db.Model): id = db.Column(db.Integer, primary_key=True) First_name = db.Column(db.String(30), nullable = False) Last_name = db.Column(db.String(50), nullable = False) User_name = db.Column...
2.5
2
wearebeautiful/bin/make_bundle.py
MarcTschudin/wearebeautiful.info
0
47422
#!/usr/bin/env python import sys sys.path.append("..") import json import click import datetime import os import shutil from zipfile import ZipFile from tempfile import mkdtemp from scale_mesh import scale_mesh from wearebeautiful.bundles import validate_manifest, MAX_SCREENSHOT_SIZE from wearebeautiful import model_...
2.328125
2
ICS4U/ICS4U-2017-2018-Code/examples/inheritance/Python-based/Vehicle.py
mrseidel-classes/archives
5
47423
class Vehicle: ''' Documentation needed here ''' def __init__(self, numberOfTires, colorOfVehicle): ''' Documentation needed here ''' self.numberOfTires = numberOfTires self.colorOfVehicle = colorOfVehicle def start(self): ''' This function starts the vehicle ''' print("I started!") def dr...
3.6875
4
tools/BackProp.py
ywzhao2002/DeepEverest
10
47424
""" Adapted from https://github.com/hovinh/DeCNN """ import numpy as np from keras import backend as K class Backpropagation(): def __init__(self, model, layer_name, input_data, layer_idx=None, masking=None): """ @params: - model: a Keras Model. - layer_name: name of layer...
3.515625
4
src/visualization/visualize_all.py
mwegrzyn/volume-wise-language
1
47425
<filename>src/visualization/visualize_all.py # coding: utf-8 # # Collect axes and make big plot # # This notebook is used to collect the output of all analyses which were ran for a single patient and to wrap all generated figures in a big plot which consists of multiple subplots. As with other notebooks which are ne...
2.375
2
dragonbot/game/output.py
Chainso/DragonBot
0
47426
import torch import numpy as np from rlbot.agents.base_agent import SimpleControllerState, BaseAgent class OutputFormatter(): """ A class to format model output """ def transform_action(self, action): """ Transforms the action into a controller state. """ action = acti...
2.84375
3
DeepLearningExamples/PyTorch/SpeechRecognition/Jasper/common/dataset.py
puririshi98/benchmark
0
47427
<gh_stars>0 # 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 requir...
2.265625
2
GroovBot Revamped/Utils/converters.py
OGminecraft/GroovBot-Work-in-proggress-
0
47428
import discord from discord.ext import commands import re from .errors import BadGameArgument from dateutil.relativedelta import relativedelta import datetime import parsedatetime as pdt import typing import operator __all__ = ( 'CommandConverter', 'dice_roll', 'board_coords', 'espeak...
2.53125
3
imagersite/imager_images/test/test_integration_images.py
brickfaced/django-imager
0
47429
<filename>imagersite/imager_images/test/test_integration_images.py from django.test import TestCase from imager_profile.models import User from ..models import Album, Photo from model_mommy import mommy import tempfile import factory from random import choice from django.urls import reverse_lazy choices = (('PRIVATE',...
2.140625
2
fabfile.py
hirokazumiyaji/blue-green-sample
0
47430
# coding: utf-8 from __future__ import absolute_import, print_function, unicode_literals from datetime import datetime import time from fabric.api import cd, sudo, run as fabrun, env, settings, abort, hide env.use_ssh_config = True env.ssh_config_path = "ssh.config" CONTAINER_PORT = { "blue": "4567", "green...
2.171875
2
testmapwithspy1.py
Toinas/IntelligentSuit
0
47431
import numpy np image=[0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 1, 1, 0, 0, 0, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, ...
2.203125
2
e2e/test_override.py
navoday-91/oncall
857
47432
# Copyright (c) LinkedIn Corporation. All rights reserved. Licensed under the BSD-2 Clause license. # See LICENSE in the project root for license information. import requests import time from testutils import prefix,api_v0 start, end = int(time.time()), int(time.time() + 36000) start = start / 1000 * 1000 end = end /...
2.15625
2
convert/photo2movie.py
penrin/SP-mapping
0
47433
<reponame>penrin/SP-mapping import sys import cv2 import argparse import time from math import ceil class ProgressBar(): def __init__(self, bar_length=40, slug='#', space='-', countdown=True): self.bar_length = bar_length self.slug = slug self.space = space self.countdown = count...
2.5625
3
Chapter04/deque_tail.py
PacktPublishing/Secret-Recipes-of-the-Python-Ninja
13
47434
<filename>Chapter04/deque_tail.py<gh_stars>10-100 def tail(filename, n=10): 'Return the last n lines of a file' with open(filename) as f: return deque(f, n)
3.125
3
src/retrocookie/pr/events.py
iamamutt/retrocookie
15
47435
<gh_stars>10-100 """Events and contexts for the message bus.""" from dataclasses import dataclass from typing import List from retrocookie import git from retrocookie.pr.base import bus from retrocookie.pr.protocols import github @dataclass class GitNotFound(bus.Event): """Cannot find an installation of git.""" ...
2.421875
2
genie/commands/minify_json.py
namuan/alfred-genie
5
47436
import json from genie import uid, with_clip class MinifyJsonCommand: def metadata(self, parameters): arg = "minify-json" return dict( uid=uid(1), arg=arg, title="Minify JSON", subtitle="Minify JSON from Clipboard", ) @with_clip def...
2.703125
3
course_flow/serializers.py
aahilgert/CourseFlow
0
47437
from rest_framework import serializers from .models import ( Program, ComponentProgram, Course, Preparation, Activity, Assessment, Artifact, Strategy, Node, NodeStrategy, StrategyActivity, ComponentWeek, WeekCourse, Component, Week, Discipline, Outcome...
2.25
2
Euclides.py
GuillermoSP96/Criptografia
0
47438
import sys import math def euclides( m, n): x0, x1 = 1, 0 y0, y1 = 0, 1 r0, r1 = m, n r, i = n, 2 c = 0 while r != 0: q = int(r0 / r1) x = x1 * q + x0 y = y1 * q + y0 res = r0 % r1 print("{} = {} * {} + {}".format(int(r0), int(r1), int(q), int(res))) ...
3.5625
4
tests/strategies/base.py
lycantropos/clipping
4
47439
from fractions import Fraction from functools import partial from hypothesis import strategies MAX_NUMBER = 10 ** 10 MIN_NUMBER = -MAX_NUMBER coordinates_strategies_factories = { float: partial(strategies.floats, allow_nan=False, allow_infinity=False), Fraction: partial(s...
2.28125
2
svm.py
edmundwsy/ASR-for-chinese-number
2
47440
import numpy as np from sklearn import svm from data_loader import data_loader N = 100 NUM_CLASS = 4 data_dir = "C:\\Users\\wsy\\Documents\\Audio\\*.m4a" data_X, data_Y = data_loader(data_dir) print(len(data_X)) clf_list = [] for idx in range(NUM_CLASS): for i, X in enumerate(data_X): if ...
2.71875
3
comments/views.py
orlowdev/aite
1
47441
from django.contrib import messages from django.contrib.auth.decorators import login_required from django.contrib.contenttypes.models import ContentType from django.http import Http404, HttpResponse, HttpResponseRedirect from django.shortcuts import render from .forms import CommentForm from .models import Comment @...
2
2
backend/src/incidents/migrations/0014_merge_20190918_1515.py
pavan168/IncidentManagement
17
47442
# Generated by Django 2.2.1 on 2019-09-18 15:15 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('incidents', '0013_auto_20190918_1415'), ('incidents', '0011_auto_20190918_1356'), ] operations = [ ]
1.367188
1
openbook_notifications/models/post_reaction_notification.py
TamaraAbells/okuna-api
164
47443
from django.contrib.contenttypes.fields import GenericRelation from django.db import models from openbook_notifications.models.notification import Notification from openbook_posts.models import PostReaction class PostReactionNotification(models.Model): notification = GenericRelation(Notification, related_name='po...
1.875
2
src/tsipy/correction/exposure.py
roksikonja/tsipy
1
47444
<reponame>roksikonja/tsipy<gh_stars>1-10 """ Module implements a function for degradation correction. """ import numpy as np __all__ = ["compute_exposure"] def compute_exposure( x: np.ndarray, method: str = "num_measurements", x_mean: float = 1.0, ) -> np.ndarray: """Computes exposure of a given sig...
2.828125
3
core/agents/models/customs/da6.py
Yoshi-0921/MAEXP
0
47445
<reponame>Yoshi-0921/MAEXP<gh_stars>0 """Source code for multi-agent transfromer (DA6) model. Author: <NAME> <<EMAIL>> """ from typing import List import numpy as np import torch from core.utils.logging import initialize_logging from omegaconf import DictConfig from torch import nn import numpy.typing as npt from ..ha...
2.078125
2
xskillscore/core/deterministic.py
weiclimate/xskillscore
1
47446
import xarray as xr from.np_deterministic import _pearson_r, _pearson_r_p_value, _rmse __all__ = ['pearson_r', 'rmse'] def pearson_r(a, b, dim): """ Pearson's correlation coefficient. Parameters ---------- a : Dataset, DataArray, GroupBy, Variable, numpy/dask arrays or scalars Mix of ...
3.296875
3
python3/maximum_depth_of_n-ary_tree.py
joshiaj7/CodingChallenges
1
47447
<gh_stars>1-10 from .model import NaryNode # Space : O(n) # Time : O(n) class Solution: def maxDepth(self, root: NaryNode) -> int: if not root: return 0 ans = 0 stack = [root] while stack: ans += 1 temp = [] for node in stack: ...
2.796875
3
astetik/tables/table.py
meirm/astetik
8
47448
import pandas as pd from IPython.core.display import display, HTML def table(data, title="Descriptive Stats", sub_title="", table_width=630, indexcol_width=150, return_html=False): '''Displays a publication quality data table with any number of columns and a...
3.609375
4
EXAMPLES/scripts/scenes/tasks.py
K9Kraken/EZpanda
0
47449
<gh_stars>0 render = ez.Node() aspect2D = ez.Node() camera = ez.Camera(parent=render) camera.y = -20 # Create a a model: dirt = ez.load.texture('dirt.png') mesh = ez.load.mesh('hex.bam') model = ez.Model( mesh, parent=render) model.shader = ez.load.shader('shaded.glsl') model.set_shader_input('texture0', dirt) # Our...
2.390625
2
019. Enumerating Gene Orders/Main.py
SyouTono242/Rosalind
0
47450
# Given: A positive integer n≤7. # # Return: The total number of permutations of length n, followed by a list of all such permutations (in any order). def to_string(list): return " ".join(list) def permute(list, start, end): if start == end: print(to_string(list)) else: for i in range(star...
3.71875
4
src/utils/fft/ifft.py
BystrickyK/SINDy
1
47451
<reponame>BystrickyK/SINDy import numpy as np def ifft(x_hat): x_hat = np.fft.ifftshift(x_hat, axes=0) x = np.fft.ifft(x_hat, axis=0) return x
2.90625
3
power_perceiver/np_batch_processor/__init__.py
openclimatefix/power_perceiver
0
47452
from power_perceiver.np_batch_processor.encode_space_time import EncodeSpaceTime from power_perceiver.np_batch_processor.sun_position import SunPosition from power_perceiver.np_batch_processor.topography import Topography
1.234375
1
scripts/add_groups.py
hseritt/alfmonitor
0
47453
<filename>scripts/add_groups.py #!/usr/bin/env python import os import sys import django from django.db.utils import IntegrityError sys.path.append('.') os.environ['DJANGO_SETTINGS_MODULE'] = 'alfmonitor.settings' django.setup() from django.contrib.auth.models import Group, User user_groups = ( 'console_admin...
2.46875
2
models/strategy.py
CBarreiro96/PRICE-INSPECTOR
1
47454
#!/usr/bin/python """class Strategy""" import models from models.base_model import BaseModel, Base from sqlalchemy import Column, String, Float, ForeignKey from sqlalchemy.orm import relationship class Strategy(BaseModel, Base): """Representation of a Strategy""" __tablename__ = 'strategies' name = Colum...
3.109375
3
apps/shows/migrations/0006_comment.py
jorgesaw/oclock
0
47455
<gh_stars>0 # Generated by Django 2.2.13 on 2020-09-27 03:14 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('shows', '00...
1.789063
2
scripts/subreddit_comments_alt.py
awesome-archive/subreddit-analyzer
497
47456
<filename>scripts/subreddit_comments_alt.py """ This script uses the Pushshift API to download comments from the specified subreddits. By default it downloads all the comments from the newest one to the first one of the specified date. """ import csv import sys import time from datetime import datetime import request...
3.5625
4
django/bosscore/views/views_resource.py
jhuapl-boss/boss
20
47457
# Copyright 2016 The Johns Hopkins University Applied Physics Laboratory # # 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 ...
1.671875
2
main.py
bogdanbledea/python-rdf-controller
0
47458
<reponame>bogdanbledea/python-rdf-controller from datetime import datetime from apscheduler.schedulers.background import BackgroundScheduler from flask import Flask, request import pandas as pd import requests # read the test file data = pd.read_csv('date_test.csv') # convert date column to datetime, so python can un...
2.8125
3
examples/00_load-a-map/00_load_map.py
inniyah/pytmxloader
1
47459
#!/usr/bin/python # -*- coding: utf-8 -*- """ This is the pygame minimal example. """ __revision__ = "$Rev$" __version__ = "3.0.0." + __revision__[6:-2] __author__ = 'DR0ID @ 2009-2011' import sys import os try: import _path except: pass import tiledtmxloader # ----------------------------------------...
3.234375
3
projects/migrations/0010_auto_20200217_0313.py
wilbrone/Awards
0
47460
# Generated by Django 3.0.2 on 2020-02-17 03:13 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('projects', '0009_auto_20200217_0306'), ] operations = [ migrations.AlterField( model_name='profile', name='profile_p...
1.507813
2
project1/src/run_test.py
JinquanPeng/CS323-Compilers
0
47461
import os import hashlib def getHash(f): line=f.readline() hash=hashlib.md5() while(line): hash.update(line) line=f.readline() return hash.hexdigest() def IsHashEqual(f1,f2): str1=getHash(f1) str2=getHash(f2) return str1==str2 if __name__ == '__main__': cmds = [] ans = [] cmd = "./...
3.015625
3
CybORG/CybORG/Shared/Actions/ShellActionsFolder/PersistenceFolder/Schtasks.py
rafvasq/cage-challenge-1
18
47462
<filename>CybORG/CybORG/Shared/Actions/ShellActionsFolder/PersistenceFolder/Schtasks.py<gh_stars>10-100 # Copyright DST Group. Licensed under the MIT license. from CybORG.Shared.Actions.ShellActionsFolder.PersistenceFolder.Persistence import Persistence from CybORG.Simulator.State import State from CybORG.Shared.Enums ...
1.976563
2
ch02-安装OpenCV/最简单-使用pip安装opencv-python和opencv-contrib-python/test_video.py
makelove/OpenCV-Python-Tutorial
2,875
47463
# -*- coding: utf-8 -*- # @Time : 2017/8/2 10:46 # @Author : play4fun # @File : test_video.py # @Software: PyCharm """ test_video.py: """ import numpy as np import cv2 from matplotlib import pyplot as plt cap = cv2.VideoCapture('../../data/vtest.avi')#不支持读取视频 # cap = cv2.VideoCapture('output.avi') # cap = cv2...
2.90625
3
src/news/migrations/0007_auto_20200211_0715.py
HammudElHammud/newspage
0
47464
<gh_stars>0 # Generated by Django 3.0.3 on 2020-02-11 15:15 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('news', '0006_auto_20200210_1343'), ] operations = [ migrations.RemoveField( model_name='news', name='pic...
1.523438
2
006_Picraft_advancedMinecraft/4_bench.py
McrRaspJam/McrRaspJam
0
47465
#API setup from picraft import Vector from picraft import World, Block def translate_left(position, data): if data == 0: return position - Vector(z=1) elif data == 1: return position + Vector(z=1) elif data == 2: return position + Vector(x=1) else: return position - Vector(x=1) def translate_right(positio...
2.984375
3
Python/011. Built-ins/04. Athlete Sort.py
subhadeep-123/HackerRank
2
47466
<reponame>subhadeep-123/HackerRank n, m = map(int, input().split()) array = [input() for _ in range(n)] k = int(input()) for row in sorted(array, key=lambda row: int(row.split()[k])): print(row)
3.078125
3
src/log.py
object-ptr/teletweet
2
47467
<reponame>object-ptr/teletweet<gh_stars>1-10 class Logger: import logging from logging.handlers import RotatingFileHandler def __init__(self, **kwargs): self.logger = Logger.logging.getLogger('root') self.logger.setLevel(Logger.logging.INFO) __formatter = Logger.logging.Formatter("%...
2.578125
3
Leetcoding-Actions/Explore-Monthly-Challenges/2020-08/05-add-and-search-word-data-stracture-design.py
shoaibur/SWE
1
47468
class WordDictionary: def __init__(self): """ Initialize your data structure here. """ self.endWord = False self.children = [None] * 26 def addWord(self, word: str) -> None: """ Adds a word into the data structure. """ curr = sel...
3.8125
4
Hardware/const_hardware.py
modelsplaid/tzq_raspi_hexapod
0
47469
import json #json does not support int type key in dictionary, #so I created this function to do that. def str_key2int(str_key_dic): int_key_dic = dict() for strkey in str_key_dic: int_key_dic[int(strkey)] = str_key_dic[strkey] return int_key_dic def dum_config(): dict_json = {'NU...
3.171875
3
strings.py
Abhiforcs/mypythonworkspace
1
47470
def count(char,word): total=0 for any in word: if any in char: total = total + 1 return total result = count('a','banana') print(result)
4.03125
4
migrations/versions/bbdff842b0cb_add_revokedtoken.py
rivalrockets/benchmarks.rivalrockets.com
0
47471
<reponame>rivalrockets/benchmarks.rivalrockets.com """add revokedtoken Revision ID: bbdff842b0cb Revises: <PASSWORD> Create Date: 2018-08-22 23:34:44.240714 """ # revision identifiers, used by Alembic. revision = '<KEY>' down_revision = '<PASSWORD>' from alembic import op import sqlalchemy as sa def upgrade(): ...
1.117188
1
test/testRational.py
turkeydonkey/nzmath3
1
47472
import unittest from nzmath.rational import * import nzmath.finitefield as finitefield from nzmath.plugins import FLOATTYPE as Float # Rational, Integer, theIntegerRing, theRationalField class RationalTest (unittest.TestCase): def testInit(self): self.assertEqual("2/1", str(Rational(2))) self.asse...
2.796875
3
src/tests/test_schema.py
DmytroKaminskiy/hillel-rest-tutorial
0
47473
from django.urls import reverse import pytest @pytest.mark.parametrize('url_name', ( 'schema-swagger-ui', 'schema-redoc', )) def test_docs(url_name, client): url = reverse(url_name) response = client.get(url) assert response.status_code == 200 @pytest.mark.parametrize('response_format',...
2.328125
2
note/views.py
DisMosGit/Dodja
0
47474
from rest_framework import request from rest_framework.viewsets import ModelViewSet from django.db.models import Q from docker_host.permissions import IsHostOperationAllowed, HostOperationMixin from .models import Note from .serializer import NoteSerializer class NoteView(ModelViewSet, HostOperationMixin): quer...
2.09375
2
build_correlation_network.py
1kc2/Minimal-Correlation-Portfolio
4
47475
<filename>build_correlation_network.py import pandas as pd import numpy as np import preprocess as pre import detrend as dtr import networkx as nx import distance_correlation as dc def build_network(): df = dc.distance_correlation() # converts the dataframe to a matrix (need this to generate the graph from th...
3.234375
3
rcsworld/rcs/point.py
Indeximal/RailControlSystemV3
0
47476
<gh_stars>0 from typing import Tuple import numpy as np def lerp(a, b, t): return a*(1-t) + b*t class DirectedPoint: def __init__(self, pos: Tuple[float], dir_tup: Tuple[float]): self.pos_vec = np.array(pos) self.dir_vec = np.array(dir_tup) if len(self.pos_vec) != 2: raise Exception("Position must be...
2.921875
3
analysis/NumpyFunctionLoop.py
clearyb1/COVIDDataViz
0
47477
import numpy as np #create array of weekly vaccination numbers from https://opendata-geohive.hub.arcgis.com/datasets/0101ed10351e42968535bb002f94c8c6_0.csv?outSR=%7B%22latestWkid%22%3A3857%2C%22wkid%22%3A102100%7D a= np.array([3946, 43856, 52659, 49703, 51381, 56267, 32176, 86434, 88578, 88294, 91298, 64535, 133195, ...
3.09375
3
variable_engine/engine.py
Ngtfury/variable_engine
1
47478
<gh_stars>1-10 class VariableEngine: """A simple package for handling variables in string.""" def __init__(self, prefix: str = None, suffix: str = None): self.variables = {} self.prefix = str(prefix) if prefix else '' #If prefix is none prefix defaults to '' self.suffix = str(suffix) i...
3.390625
3
mExports.py
SkyLined/mProductVersionAndLicense
3
47479
<filename>mExports.py from .cLicenseServer import cLicenseServer; from .cProductDetails import cProductDetails; from .faoGetLicensesFromFile import faoGetLicensesFromFile; from .faoGetLicensesFromRegistry import faoGetLicensesFromRegistry; from .faoGetProductDetailsForAllLoadedModules import faoGetProductDetailsForAllL...
1.28125
1
Python Programs/perfect-number.py
muhammad-masood-ur-rehman/Skillrack
2
47480
Perfect Number Given a positive integer N as the input, the program must print yes if N is a perfect number. Else no must be printed. Input Format: The first line contains N. Output Format: The first line contains yes or no Boundary Conditions: 1 <= N <= 999999 Example Input/Output 1: Input: 6 Output: yes Example Inpu...
3.90625
4
line/f_CallService.py
winbotscript/LineService
1
47481
<filename>line/f_CallService.py # # Autogenerated by Frugal Compiler (3.4.3) # # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING # from threading import Lock from frugal.middleware import Method from frugal.exceptions import TApplicationExceptionType from frugal.exceptions import TTransportExceptio...
1.726563
2
gs_nosql.py
accidentalrebel/GameSparks-NoSQL-Python-Library
0
47482
<filename>gs_nosql.py<gh_stars>0 #!/usr/bin/env python3 import os import requests import json AUTH_URL = 'https://auth.gamesparks.net/restv2/auth' GAME_URL = 'https://config2.gamesparks.net/restv2/game/' access_token = None stage_base_url = None jwt_token = None api_key = None def authenticate(is_live = False): ...
2.4375
2
chroma_core/migrations/0025_createsnapshotjob_destroysnapshotjob.py
intel-hpdd/-intel-manager-for-lustre
52
47483
# -*- coding: utf-8 -*- # Generated by Django 1.11.23 on 2020-09-10 14:23 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ("chroma_core", "0024_mountsnapshotjob_unmountsnapshotjob"),...
1.789063
2
easy/maximum number of words you can type/solurion.py
ilya-sokolov/leetcode
4
47484
class Solution: def canBeTypedWords(self, text: str, brokenLetters: str) -> int: result = 0 words = text.split(" ") set_chars = set(brokenLetters) for i in words: set_word = set(i) sub = set_word - set_chars if len(set_word) == len(sub): ...
3.34375
3
instance/config.py
adriankiprono/pitches_project
0
47485
SECRET_KEY='<KEY>'
1.015625
1
setup.py
thatch/bace
8
47486
#!/usr/bin/env python from setuptools import setup, find_packages #if sys.argv[-1] == 'publish': # os.system('python setup.py sdist upload') # sys.exit() with open('bace/__init__.py') as fid: for line in fid: if line.startswith('__version__'): VERSION = line.strip().split()[-1][1:-1] ...
1.6875
2
extract/wav2spec_utils.py
daisukelab/uclser20
79
47487
<reponame>daisukelab/uclser20 import os import numpy as np import scipy import librosa import soundfile import matplotlib.pyplot as plt import glob ######################################################################### # Some of these functions have been inspired on the DCASE UTIL framework by <NAME> # https://dcas...
2.5625
3
modules/convertpng.py
winosli/SuperPDF
1
47488
<reponame>winosli/SuperPDF import os from pdf2image import convert_from_path, convert_from_bytes from os import path from glob import glob from wand.image import Image from modules.mytools import MyTools class ConvertPNG: png_name = '' format = 'pdf' def __init__(self): global png_name ...
3.125
3
contrib/stack/alosStack/estimate_swath_offset.py
yuankailiu/isce2
1,133
47489
#!/usr/bin/env python3 # # Author: <NAME> # Copyright 2015-present, NASA-JPL/Caltech # import os import glob import datetime import numpy as np import isce, isceobj from isceobj.Alos2Proc.runSwathOffset import swathOffset from StackPulic import loadTrack from StackPulic import acquisitionModesAlos2 def cmdLinePar...
2.4375
2
examples/main.py
vnpnh/Pyvalo
0
47490
<filename>examples/main.py import valorant from valorant.utils.gameplay import check_buy_phase from valorant.utils.gameplay import enemy_score_info, own_score_info import time from valorant.utils.helper import apply_config # default config # valo = valorant.config() # custom config valo = valorant.config(tesseract=r...
2.59375
3
login/migrations/0005_employee_username.py
mankek/Time-Tracker
6
47491
# Generated by Django 2.1 on 2018-10-10 22:21 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('login', '0004_auto_20181010_1640'), ] operations = [ migrations.AddField( model_name='employee', name='Username', ...
1.78125
2
qtpyvcp/widgets/qtdesigner/stylesheet.py
Lcvette/qtpyvcp
71
47492
<filename>qtpyvcp/widgets/qtdesigner/stylesheet.py # Copyright (c) 2017-2018, SLAC National Accelerator Laboratory # This file has been adapted from PyDM, and can be redistributed and/or # modified in accordance with terms in conditions set forth in the BSD # 3-Clause License. You can find the complete licence text in...
2.265625
2
ElevatorBot/commands/a_destiny/lfg/create.py
TheDescend/elevatorbot
0
47493
<gh_stars>0 import asyncio from dis_snek import InteractionContext, Modal, OptionTypes, ParagraphText, slash_command, slash_option from ElevatorBot.commandHelpers import autocomplete from ElevatorBot.commandHelpers.optionTemplates import ( autocomplete_activity_option, default_time_option, get_timezone_ch...
2.375
2
datapack/data/scripts/custom/6667_ClanManager/__init__.py
DigitalCoin1/L2SPERO
0
47494
<reponame>DigitalCoin1/L2SPERO<filename>datapack/data/scripts/custom/6667_ClanManager/__init__.py<gh_stars>0 import sys from com.l2jfrozen.gameserver.model.actor.instance import L2PcInstance from com.l2jfrozen.gameserver.model.actor.instance import L2NpcInstance from java.util import Iterator from com.l2jfrozen.util.da...
2.234375
2
tests/functions/test_get_referencing_foreign_keys.py
tteaka/sqlalchemy-utils
879
47495
<gh_stars>100-1000 import pytest import sqlalchemy as sa from sqlalchemy_utils import get_referencing_foreign_keys class TestGetReferencingFksWithCompositeKeys(object): @pytest.fixture def User(self, Base): class User(Base): __tablename__ = 'user' first_name = sa.Column(sa.Un...
2.265625
2
python/oskar/vis_header.py
happyseayou/OSKAR
46
47496
<gh_stars>10-100 # -*- coding: utf-8 -*- # # Copyright (c) 2016-2020, The University of Oxford # 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 th...
1.507813
2
test/test_client.py
pastchick3/aioclient
0
47497
import asyncio import logging import os from time import time from yarl import URL from ..client.client import Client from ..client.request import HTTPMethod, Request from .asynctest import AsyncTest class TestClient(AsyncTest): @classmethod def setUpClass(cls): logger = logging.getLogger('client')...
2.328125
2
mars/serialization/arrow.py
hxri/mars
2,413
47498
<reponame>hxri/mars # Copyright 1999-2021 Alibaba Group Holding 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...
1.75
2
etc/setup.py
c4s4/mysql_commando
2
47499
<reponame>c4s4/mysql_commando #!/usr/bin/env python # encoding: UTF-8 from distutils.core import setup setup( name = 'mysql_commando', version = 'VERSION', author = '<NAME>', author_email = '<EMAIL>', packages = ['mysql_commando'], url = 'http://pypi.python.org/pypi/mysql_commando/', licen...
1.125
1