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 |
|---|---|---|---|---|---|---|
gridfs/grid_file.py | naomielst/mongo-python-driver | 2 | 5500 | # Copyright 2009-present MongoDB, 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 wri... | 2.1875 | 2 |
forte/processors/tests/stanfordnlp_processor_test.py | tcl326/forte | 0 | 5501 | """This module tests Stanford NLP processors."""
import os
import unittest
from texar.torch import HParams
from forte.pipeline import Pipeline
from forte.data.readers import StringReader
from forte.processors.stanfordnlp_processor import StandfordNLPProcessor
from ft.onto.base_ontology import Token, Sentence
class ... | 2.65625 | 3 |
src/serve_files.py | eventh/m3u8looper | 0 | 5502 | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Serve current folder files in a HTTP webserver.
"""
import socketserver
from threading import Thread
from http.server import SimpleHTTPRequestHandler
PORT = 8000
def start_http_server(port=PORT):
httpd = socketserver.TCPServer(("", port), SimpleHTTPRequestHand... | 2.90625 | 3 |
pypy/module/__builtin__/test/test_compile.py | yxzoro/pypy | 0 | 5503 | # coding: utf-8
class AppTestCompile:
def test_simple(self):
import sys
co = compile('1+2', '?', 'eval')
assert eval(co) == 3
co = compile(memoryview(b'1+2'), '?', 'eval')
assert eval(co) == 3
exc = raises(ValueError, compile, chr(0), '?', 'eval')
assert str(... | 2.6875 | 3 |
tickers_graphing_module.py | huangbrandon432/Investing-Trading-Tool | 0 | 5504 |
import yfinance as yf
import matplotlib.pyplot as plt
import plotly.express as px
import plotly.graph_objects as go
from plotly.subplots import make_subplots
import pandas as pd
from IPython.display import Markdown
import numpy as np
from datetime import date, timedelta
def plot_and_get_info(ticker, start = None, en... | 2.640625 | 3 |
flexbe_navigation_states/src/flexbe_navigation_states/navigation_sm.py | amsks/generic_flexbe_states | 0 | 5505 | <gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###########################################################
# WARNING: Generated code! #
# ************************** #
# Manual changes may get lost if file is generated again. #
# Only code inside the... | 1.890625 | 2 |
text2cc/xml_assessment.py | dlehman83/text2cc | 1 | 5506 | # -*- coding: utf-8 -*-
#
# Copyright (c) 2021, <NAME>
# Copyright (c) 2020, <NAME>
# All rights reserved.
#
# Licensed under the BSD 3-Clause License:
# http://opensource.org/licenses/BSD-3-Clause
#
from .quiz import Quiz, Question, GroupStart, GroupEnd, TextRegion
BEFORE_ITEMS = '''\
<?xml version="1.0" encoding=... | 1.78125 | 2 |
tests/test_aggregate_stats_design.py | bids-standard/bids-statsmodels-design-synthesizer | 0 | 5507 | #!/usr/bin/env python
"""Tests for `bids_statsmodels_design_synthesizer` package."""
import pytest
import subprocess as sp
from pathlib import Path
SYNTHESIZER = "aggregate_stats_design.py"
from bids_statsmodels_design_synthesizer import aggregate_stats_design as synth_mod
# from bids_statsmodels_design_synthesizer... | 2.328125 | 2 |
skynet-agent/plugins/plugin_api.py | skynetera/skynet | 3 | 5508 | #!/usr/bin/env python
# coding: utf-8
__author__ = 'whoami'
"""
@version: 1.0
@author: whoami
@license: Apache Licence 2.0
@contact: <EMAIL>
@site: http://www.itweet.cn
@software: PyCharm Community Edition
@file: plugin_api.py
@time: 2015-11-28 下午1:52
"""
from linux import cpu,disk,iostats,loadavg,memory,netstats,swa... | 1.789063 | 2 |
code/figure_warp.py | jwcarr/drift | 2 | 5509 | import numpy as np
import eyekit
import algorithms
import core
data = eyekit.io.load(core.FIXATIONS / 'sample.json')
passages = eyekit.io.load(core.DATA / 'passages.json')
original_sequence = data['trial_5']['fixations']
fixation_XY = np.array([fixation.xy for fixation in original_sequence], dtype=int)
word_XY = np.... | 2.125 | 2 |
storm/Nimbus.py | krux/python-storm | 0 | 5510 | <reponame>krux/python-storm<filename>storm/Nimbus.py<gh_stars>0
#
# Autogenerated by Thrift Compiler (0.9.0)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
# options string: py
#
from thrift.Thrift import TType, TMessageType, TException, TApplicationException
from ttypes import *
from thrift.T... | 2 | 2 |
gemucator/__init__.py | philipwfowler/genucator | 0 | 5511 | #! /usr/bin/env python
from .core import gemucator
| 1.015625 | 1 |
client/checkout/schema/types.py | daniel-waruo/e-commerse-api | 6 | 5512 | <gh_stars>1-10
import graphene
from graphene_django import DjangoObjectType
from graphene_django.converter import convert_django_field
from pyuploadcare.dj.models import ImageField
| 1.15625 | 1 |
pangenome_fluidity.py | PlantDr430/CSU_scripts | 1 | 5513 | #!/usr/bin/python3
'''
This script follows formulas put forth in Kislyuk et al. (2011) to calculate genome
fluidity of a pangenome dataset. Variance and standard error are estimated as total
variance containing both the variance due to subsampling all possible combinations
(without replacement) of N genomes from th... | 2.671875 | 3 |
osvolbackup/backup.py | CCSGroupInternational/osvolbackup | 1 | 5514 | #
# This module provides the Instance class that encapsulate some complex server instances related operations
#
from __future__ import print_function
from json import loads
from neutronclient.v2_0 import client as neutron_client
from novaclient import client as nova_client
from cinderclient import client as cinder_cli... | 2.25 | 2 |
gammapy/estimators/profile.py | JohannesBuchner/gammapy | 1 | 5515 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Tools to create profiles (i.e. 1D "slices" from 2D images)."""
import numpy as np
import scipy.ndimage
from astropy import units as u
from astropy.convolution import Box1DKernel, Gaussian1DKernel
from astropy.coordinates import Angle
from astropy.table ... | 2.578125 | 3 |
ABC/abc001-abc050/abc007/b.py | KATO-Hiro/AtCoder | 2 | 5516 | <reponame>KATO-Hiro/AtCoder
# -*- coding: utf-8 -*-
def main():
a = input()
# See:
# https://www.slideshare.net/chokudai/abc007
if a == 'a':
print('-1')
else:
print('a')
if __name__ == '__main__':
main()
| 3.65625 | 4 |
env/lib/python3.8/site-packages/versatileimagefield/mixins.py | crimergio/linux_test | 1 | 5517 | """versatileimagefield Field mixins."""
import os
import re
from .datastructures import FilterLibrary
from .registry import autodiscover, versatileimagefield_registry
from .settings import (
cache,
VERSATILEIMAGEFIELD_CREATE_ON_DEMAND,
VERSATILEIMAGEFIELD_SIZED_DIRNAME,
VERSATILEIMAGEFIELD_FILTERED_DIR... | 1.992188 | 2 |
differential_privacy/run_federated.py | HanGuo97/federated | 330 | 5518 | # Copyright 2020, Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | 1.796875 | 2 |
waymo_kitti_converter/tools/visual_point_cloud.py | anhvth/Pseudo_Lidar_V2 | 0 | 5519 | import open3d as o3d
import numpy as np
pc_load_pathname = '/home/caizhongang/github/waymo_kitti_converter/007283-000.bin'
pc = np.fromfile(pc_load_pathname, dtype=np.float32).reshape(-1, 3)
pcd = o3d.geometry.PointCloud()
pcd.points = o3d.utility.Vector3dVector(pc)
axis = o3d.geometry.TriangleMesh.create_coordinat... | 2.15625 | 2 |
designate-8.0.0/designate/tests/test_api/test_v2/test_limits.py | scottwedge/OpenStack-Stein | 145 | 5520 | <reponame>scottwedge/OpenStack-Stein
# Copyright 2013 Hewlett-Packard Development Company, L.P.
#
# Author: <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://ww... | 2.140625 | 2 |
pythonAnimations/pyOpenGLChess/engineDirectory/oglc-env/lib/python2.7/site-packages/OpenGLContext/scenegraph/nodepath.py | alexus37/AugmentedRealityChess | 1 | 5521 | """node-path implementation for OpenGLContext
"""
from vrml.vrml97 import nodepath, nodetypes
from vrml.cache import CACHE
from OpenGLContext import quaternion
from OpenGL.GL import glMultMatrixf
class _NodePath( object ):
"""OpenGLContext-specific node-path class
At the moment this only adds a single method,... | 2.640625 | 3 |
part01_basic/for_while_loop.py | ApprenticeOne/python_learn | 0 | 5522 | import random
from math import sqrt
sum = 0
for x in range(101):
sum += x
print(sum)
'''
range(101) 0-100 一共101个数
range(1,101) 1-100
range(1,101,2) 1-100间的奇数 步长为2
range(100,0,-2) 100-0间的偶数 步长为-2
'''
sum = 0
for x in range(100, 0, -2):
sum += x
print(sum)
# while
# 0-100间的随机数
answer = random.randint(0, 1... | 3.78125 | 4 |
src/toil/batchSystems/htcondor.py | ElementGenomicsInc/toil | 2 | 5523 | <filename>src/toil/batchSystems/htcondor.py
# Copyright (C) 2018, HTCondor Team, Computer Sciences Department,
# University of Wisconsin-Madison, WI.
#
# 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 Lic... | 2.140625 | 2 |
paddlespeech/t2s/modules/tacotron2/decoder.py | alanlv/PaddleSpeech | 0 | 5524 | <gh_stars>0
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | 2.21875 | 2 |
pyblazing/__init__.py | Mattlk13/pyBlazing | 0 | 5525 | from .api import run_query_get_token
from .api import convert_to_dask
from .api import run_query_get_results
from .api import run_query_get_concat_results
from .api import register_file_system
from .api import deregister_file_system
from .api import FileSystemType, DriverType, EncryptionType
from .api import SchemaFro... | 1.296875 | 1 |
bootstrap/p1.5.0/src/common/const.py | apurwaj2/df-on-k8s | 0 | 5526 |
class Constants(object):
LOGGER_CONF = "common/mapr_conf/logger.yml"
USERNAME = "mapr"
GROUPNAME = "mapr"
USERID = 5000
GROUPID = 5000
ADMIN_USERNAME = "custadmin"
ADMIN_GROUPNAME = "custadmin"
ADMIN_USERID = 7000
ADMIN_GROUPID = 7000
ADMIN_PASS = "<PASSWORD>"
MYSQL_USER = "... | 1.929688 | 2 |
dataset/scan2cad/s2c_collect_pgroup.py | jeonghyunkeem/PointGroup | 0 | 5527 | <gh_stars>0
# <NAME>, UVR KAIST @<EMAIL>
import os, sys
import json
import h5py
import numpy as np
import quaternion
import torch
from torch.utils.data import Dataset
BASE_DIR_1 = os.path.dirname(os.path.abspath(__file__)) # scan2cad
BASE_DIR = os.path.dirname(BASE_DIR_1) # dataset
ROOT_DIR = os.path.dirname(BASE_DI... | 1.789063 | 2 |
nappy/msd2diff.py | ryokbys/nap | 27 | 5528 | #!/usr/bin/env python
"""
Compute diffusion coefficient from MSD data.
Time interval, DT, is obtained from in.pmd in the same directory.
Usage:
msd2diff.py [options] MSD_FILE
Options:
-h, --help Show this message and exit.
-o, --offset OFFSET
Offset of given data. [default: 0]
--plot Plot ... | 2.609375 | 3 |
5/part2.py | jcsesznegi/advent-of-code-2017 | 1 | 5529 | <filename>5/part2.py<gh_stars>1-10
import os
f = open(os.path.join(os.path.dirname(__file__), '../input/5/part2.txt'), 'r')
class InstructionSet:
def __init__(self, instructions):
self.instructions = instructions
self.currentIndex = 0
self.numberSteps = 0
def _changeOffsetValue(self... | 3.328125 | 3 |
features/steps/basic_account_add_bdd.py | MhmdRyhn/behavior_test | 0 | 5530 | <reponame>MhmdRyhn/behavior_test
import behave
@behave.when('I add $1200 to my account')
def add_usd_1200(context):
context.account.add_cash(amount=1200)
@behave.then('It becomes $3200 in my account')
def check_for_increase_to_usd_1880(context):
assert context.account.current_cash == 3200
| 2.84375 | 3 |
tests/test_sync_module.py | naveengh6/blinkpy | 272 | 5531 | <reponame>naveengh6/blinkpy
"""Tests camera and system functions."""
import unittest
from unittest import mock
from blinkpy.blinkpy import Blink
from blinkpy.helpers.util import BlinkURLHandler
from blinkpy.sync_module import BlinkSyncModule, BlinkOwl
from blinkpy.camera import BlinkCamera, BlinkCameraMini
@mock.pat... | 2.578125 | 3 |
dymos/examples/min_time_climb/aero/aero.py | naylor-b/dymos | 0 | 5532 | from __future__ import absolute_import
import numpy as np
from openmdao.api import Group
from .dynamic_pressure_comp import DynamicPressureComp
from .lift_drag_force_comp import LiftDragForceComp
from .cd0_comp import CD0Comp
from .kappa_comp import KappaComp
from .cla_comp import CLaComp
from .cl_comp import CLComp... | 2.3125 | 2 |
stats.py | jakeb1996/SBS | 0 | 5533 | import matplotlib.pyplot as plt
import argparse, csv, numpy, time, os, re
def main(resultsFile, toolName):
filesToCalc = []
toolNames = []
if os.path.isfile(resultsFile):
# the user must have defined an exact file to plot
filesToCalc.append(resultsFile)
toolNames.appen... | 2.859375 | 3 |
callback_handlers.py | andrey18106/vocabulary_bot | 0 | 5534 | <filename>callback_handlers.py
# -*- coding: utf-8 -*-
# ===== Default imports =====
import asyncio
import logging
# ===== External libs imports =====
from aiogram import Bot, Dispatcher, types
from aiogram.dispatcher import FSMContext
# ===== Local imports =====
from analytics import BotAnalytics
from db_manager... | 2.09375 | 2 |
1-Python-Programming-Basics (Sep 2020)/Course-Exercises-and-Exams/06_Nested-Loops/02.Exercise-06-Special-Numbers.py | karolinanikolova/SoftUni-Software-Engineering | 0 | 5535 | # 6. Специални числа
# Да се напише програма, която чете едно цяло число N, въведено от потребителя, и генерира всички възможни "специални"
# числа от 1111 до 9999. За да бъде “специално” едно число, то трябва да отговаря на следното условие:
# • N да се дели на всяка една от неговите цифри без остатък.
# Пример: при N... | 3.953125 | 4 |
skopt/tests/test_transformers.py | sqbl/scikit-optimize | 0 | 5536 | import pytest
import numbers
import numpy as np
from numpy.testing import assert_raises
from numpy.testing import assert_array_equal
from numpy.testing import assert_equal
from numpy.testing import assert_raises_regex
from skopt.space import LogN, Normalize
@pytest.mark.fast_test
def test_logn2_integer():
transf... | 2.390625 | 2 |
tokenization_numerical.py | dspoka/mnm | 1 | 5537 | <gh_stars>1-10
# coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace 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 may obtain a copy of the License at
#
# http://www.apache.org... | 1.867188 | 2 |
dipole/splitting_dipole.py | wheelerMT/spin-1_BEC | 0 | 5538 | <gh_stars>0
import numpy as np
import multiprocessing as mp
import pyfftw
from numpy import pi, exp, sqrt, sin, cos, conj, arctan, tanh, tan
from numpy import heaviside as heav
from include import helper
import h5py
# ---------Spatial and potential parameters--------------
Mx = My = 64
Nx = Ny = 128 # Number of grid... | 1.890625 | 2 |
src/main/resources/scripts/crumbDiag.py | cam-laf/vectorcast-execution-plugin | 4 | 5539 | from __future__ import print_function
import requests
import sys
import os
verbose=True
try:
username=os.environ['USERNAME']
password=<PASSWORD>['PASSWORD']
except:
print("Crumb Diaganostic requires USERNAME/PASSWORD to be set as environment variables")
sys.exit(-1)
jenkins_url=os.environ['JENKINS_URL'... | 2.515625 | 3 |
URI/1-Beginner/1099.py | vicenteneto/online-judge-solutions | 0 | 5540 | # -*- coding: utf-8 -*-
for i in range(int(raw_input())):
x, y = [int(x) for x in raw_input().split()]
if x > y:
x, y = y, x
x += 1 if x % 2 == 0 else 2
print sum([j for j in range(x, y, 2)])
| 3.453125 | 3 |
mock_file.py | MahirGulzar/fpointnet-tiny | 0 | 5541 | import tensorflow as tf
FLIPPING_TENSOR = tf.constant([1.0, -1.0, 1.0])
@tf.function
def sample_data(points, labels, num_point):
if tf.random.uniform(shape=()) >= 0.5:
return points * FLIPPING_TENSOR, labels
return points, labels
mock_data = tf.constant([
[1., 2., 3.],
[4., 5., 6.],
[7.... | 2.71875 | 3 |
myapp.py | dataholiks/flask_heroku_scheduler | 7 | 5542 | from flask import Flask
app = Flask(__name__)
@app.route('/')
def index():
return 'This is the app index page.'
| 2.265625 | 2 |
day_ok/schedule/migrations/0027_auto_20210216_1337.py | bostud/day_ok | 0 | 5543 | # Generated by Django 3.1.6 on 2021-02-16 11:37
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('schedule', '0026_event'),
]
operations = [
migrations.AlterField(
model_name='group',
name='students',
f... | 1.523438 | 2 |
Blog.py | OliverChao/PyWhoAmI | 0 | 5544 | <gh_stars>0
import aiohttp
import asyncio
import time
import time
import argparse
import glob
import os
import shutil
import random
import re
import requests
import sys
from concurrent import futures
import pdfkit
import time
from retrying import retry
from pygments import highlight
from pygments.l... | 2.125 | 2 |
corehq/apps/app_manager/tests/test_xml_parsing.py | dslowikowski/commcare-hq | 1 | 5545 | from django.test import SimpleTestCase as TestCase
from corehq.apps.app_manager.models import _parse_xml
import os
class XMLParsingTest(TestCase):
def testUnicodeError(self):
"""Tests a bug found in Unicode processing of a form"""
file_path = os.path.join(os.path.dirname(__file__), "data", "un... | 2.75 | 3 |
dynamic_programming/01/01-06.py | fumiyanll23/algo-method | 0 | 5546 | # input
N, M = map(int, input().split())
Ds = [*map(int, input().split())]
# compute
dp = [False] * (N+1)
for ni in range(N+1):
if ni == 0:
dp[ni] = True
for D in Ds:
if ni >= D:
dp[ni] = dp[ni] or dp[ni-D]
# output
print("Yes" if dp[-1] else "No")
| 2.875 | 3 |
swapsort.py | ArshSood/sorting | 0 | 5547 | # sorting
n=int(input())
array=list(map(int,input().split()))
i=0
count=[]
counter=0
while i<len(array):
min=i
start=i+1
while(start<len(array)):
if array[start]<array[min]:
min=start
start+=1
if i!=min:
array[i],array[min]=array[min],array[i]
count.append(i)
... | 3.3125 | 3 |
tests/news_test.py | mucciz/News | 0 | 5548 | import unittest
from app.models import News
# News = news.News
class NewsTest(unittest.TestCase):
'''
Test Class to test the behaviour of the Movie class
'''
def setUp(self):
'''
Set up method that will run before every Test
'''
self.new_news = News('abc-news','ABC NEWS... | 3.75 | 4 |
test/get-gh-comment-info.py | MQasimSarfraz/cilium | 1 | 5549 | <gh_stars>1-10
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('ghcomment', type=str) # this is for test-me-please phrases
parser.add_argument('--focus', type=str, default="")
parser.add_argument('--version', type=str, default="")
parser.add_argument('--retrieve', type=str, default="focus")
arg... | 2.5625 | 3 |
preprocessing/booking.py | madcat1991/clustered_cars | 0 | 5550 | <gh_stars>0
"""
This script cleans and prepares the data set of bookings for the future usage
"""
import argparse
import logging
import sys
import pandas as pd
from preprocessing.common import canonize_datetime, raw_data_to_df, check_processed_columns, check_data
OLD_BREAKPOINT_MATCHER = {
2001: [
(1, 1... | 2.390625 | 2 |
src/api/wish.py | PKU-GeekGame/gs-backend | 7 | 5551 | from sanic import Blueprint, Request, HTTPResponse, response
from sanic.models.handler_types import RouteHandler
from functools import wraps
from inspect import isawaitable
from typing import Callable, Dict, Any, Union, Awaitable, List, Optional
ACCEPTED_WISH_VERS = ['wish.alpha.v1']
WishHandler = Callable[..., Union... | 2.078125 | 2 |
scripts/venv/lib/python2.7/site-packages/cogent/maths/function_optimisation.py | sauloal/cnidaria | 3 | 5552 | #!/usr/bin/env python
"""Algorthims for function optimisation
great_deluge() is a hillclimbing algorithm based on:
Gunter Dueck: New Optimization Heuristics, The Great Deluge Algorithm
and the Record-to-Record Travel. Journal of Computational Physics, Vol.
104, 1993, pp. 86 - 92
ga_evolve(... | 3.140625 | 3 |
collect_policies.py | jonathanbglass/parallel_prowler | 3 | 5553 | import argparse
import boto3
import json
import logging
import os
from progressbar import ProgressBar
import sys
"""
Collects IAM Policies
Evaluates policies looking for badness (*.*, Effect:Allow + NotAction)
Need to add more tests/use cases
"""
def get_policies(profile):
session = boto3.session.Session(profi... | 2.296875 | 2 |
test/molecule-role/molecule/integrations/tests/test_nagios.py | StackVista/stackstate-agent | 2 | 5554 | import json
import os
import re
from testinfra.utils.ansible_runner import AnsibleRunner
import util
testinfra_hosts = AnsibleRunner(os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('agent-integrations')
def _get_key_value(tag_list):
for key, value in (pair.split(':', 1) for pair in tag_list):
yield ke... | 2.25 | 2 |
erudition/util.py | papsebestyen/erudition | 0 | 5555 | import os
import sys
from contextlib import contextmanager
from invoke import UnexpectedExit
def git_commit(c, addstr, msg):
try:
c.run("git config --get user.email")
c.run("git config --get user.name")
except UnexpectedExit:
c.run('git config --local user.email "<EMAIL>"')
c.... | 2.28125 | 2 |
python3/distortion_correct_aksk_demo.py | MeekoI/ais-sdk | 0 | 5556 | <filename>python3/distortion_correct_aksk_demo.py
# -*- coding:utf-8 -*-
from ais_sdk.utils import encode_to_base64
from ais_sdk.utils import decode_to_wave_file
from ais_sdk.distortion_correct import distortion_correct_aksk
from ais_sdk.utils import init_global_env
import json
if __name__ == '__main__':
#
# a... | 2.5 | 2 |
exercise/migrations/0016_auto_20191025_1624.py | Arpit8081/Phishtray_Edited_Version | 2 | 5557 | <filename>exercise/migrations/0016_auto_20191025_1624.py
# Generated by Django 2.2.6 on 2019-10-25 16:24
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('exercise', '0015_exerciseemailproperties_date_received'),
]
... | 1.3125 | 1 |
release/stubs.min/Autodesk/Revit/DB/__init___parts/GeomCombinationSet.py | YKato521/ironpython-stubs | 0 | 5558 | class GeomCombinationSet(APIObject, IDisposable, IEnumerable):
"""
A set that contains GeomCombination objects.
GeomCombinationSet()
"""
def Clear(self):
"""
Clear(self: GeomCombinationSet)
Removes every item GeomCombination the set,rendering it empty.
"""
pass
... | 2.75 | 3 |
rainbow/datasources/cfn_datasource.py | omribahumi/rainbow | 35 | 5559 | <reponame>omribahumi/rainbow<filename>rainbow/datasources/cfn_datasource.py
from rainbow.cloudformation import Cloudformation
from base import DataSourceBase
__all__ = ['CfnOutputsDataSource', 'CfnResourcesDataSource', 'CfnParametersDataSource']
class CfnDataSourceBase(DataSourceBase):
def __init__(self, data_so... | 2.234375 | 2 |
epio_commands/management/commands/epio_flush_redis.py | idan/pypostbin | 2 | 5560 | import redis
from bundle_config import config
from django.core.management.base import NoArgsCommand
class Command(NoArgsCommand):
help = 'Flushes all keys in redis.'
def handle_noargs(self, **options):
r = redis.Redis(host=config['redis']['host'], port=int(config['redis']['port']), password=config['r... | 2.171875 | 2 |
python/flexflow_cffi_build.py | zmxdream/FlexFlow | 455 | 5561 | <filename>python/flexflow_cffi_build.py
#!/usr/bin/env python
# Copyright 2020 Stanford University, Los Alamos National 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
#
# htt... | 2.1875 | 2 |
gaphor/plugins/xmiexport/__init__.py | tuxcell/gaphor | 0 | 5562 | <filename>gaphor/plugins/xmiexport/__init__.py
"""This plugin extends Gaphor with XMI export functionality."""
import logging
from gaphor.abc import ActionProvider, Service
from gaphor.core import action, gettext
from gaphor.plugins.xmiexport import exportmodel
from gaphor.ui.filedialog import FileDialog
logger = lo... | 2.21875 | 2 |
tests/utils.py | btk15049/online-judge-tools | 0 | 5563 | <gh_stars>0
import contextlib
import os
import pathlib
import subprocess
import sys
import tempfile
@contextlib.contextmanager
def chdir(path):
cwd = os.getcwd()
try:
os.chdir(path)
yield
finally:
os.chdir(cwd)
def prepare_files(files):
for f in files:
path = pathlib.... | 2.375 | 2 |
git_operation.py | zerzerzerz/Computer-Virus | 0 | 5564 | <gh_stars>0
import os
commit_string = "选择data的前多少个维度参与训练"
not_add = ['results', 'data', 'weights']
for item in os.listdir():
if item in not_add:
# print(item)
continue
else:
os.system(f"git add {item}")
os.system(f'git commit -m "{commit_string}"')
os.system("git push origin main") | 2.546875 | 3 |
src/cool_grammar.py | peanut-butter-jellyyy/cool-compiler-2021 | 0 | 5565 | <gh_stars>0
from src.cmp.pycompiler import Grammar
from src.ast_nodes import (
ProgramNode,
ClassDeclarationNode,
FuncDeclarationNode,
AttrDeclarationNode,
IfNode,
WhileNode,
LetNode,
CaseNode,
IsvoidNode,
AssignNode,
VarDeclarationNode,
CaseItemNode,
No... | 2.5 | 2 |
userbot/plugins/selfdestruct.py | Aliensuniquebot/CatUserbot | 1 | 5566 | <gh_stars>1-10
# For @UniBorg
# courtesy <NAME>
"""Self Destruct Plugin
.sd <time in seconds> <text>
"""
import time
from userbot import CMD_HELP
from telethon.errors import rpcbaseerrors
from userbot.utils import admin_cmd
import importlib.util
@borg.on(admin_cmd(pattern="sdm", outgoing=True))
async def selfdestr... | 2.21875 | 2 |
snippets/basic_render_template_class.py | OSAMAMOHAMED1234/python_projects | 0 | 5567 | <reponame>OSAMAMOHAMED1234/python_projects
import os
class Template:
template_name = ''
context = None
def __init__(self, template_name='', context=None, *args, **kwargs):
self.template_name = template_name
self.context = context
def get_template(self):
template_path = os.path.join(os.path.join(os... | 3.078125 | 3 |
level_one/strings.py | jameskzhao/python36 | 0 | 5568 | <reponame>jameskzhao/python36
#Basics
a = "hello"
a += " I'm a dog"
print(a)
print(len(a))
print(a[1:]) #Output: ello I'm a dog
print(a[:5]) #Output: hello(index 5 is not included)
print(a[2:5])#Output: llo(index 2 is included)
print(a[::2])#Step size
#string is immutable so you can't assign a[1]= b
x = a.upper()
pr... | 4.09375 | 4 |
tests/test_01_accept_time_get_headers.py | glushkovvv/test_2gis | 0 | 5569 | <filename>tests/test_01_accept_time_get_headers.py
# -*- coding: utf-8 -*-
"""
test_01_accept_time_get_headers
~~~~~~~~~~~~~~
The 2GIS API Test
Check time get headers
:author: <NAME>
:copyright: Copyright 2019, The2GIS API Test"
:license: MIT
:version: 1.0.0
:maintainer: <NAME>
:email: <EMAIL>
:status: Development
""... | 2.0625 | 2 |
transformers/string/strlen_transformer.py | ucds-sg/h2oai | 0 | 5570 | <gh_stars>0
"""Returns the string length of categorical values"""
from h2oaicore.transformer_utils import CustomTransformer
import datatable as dt
import numpy as np
class MyStrLenEncoderTransformer(CustomTransformer):
@staticmethod
def get_default_properties():
return dict(col_type="any", min_cols=1,... | 2.953125 | 3 |
geometry/eolearn/geometry/__init__.py | eerzin/eo-learn | 1 | 5571 | <filename>geometry/eolearn/geometry/__init__.py
"""
Subpackage containing EOTasks for geometrical transformations
"""
from .utilities import ErosionTask, VectorToRaster, RasterToVector
from .sampling import PointSamplingTask, PointSampler, PointRasterSampler
__version__ = '0.4.2'
| 1.210938 | 1 |
api/models/users.py | felipebarraza6/startup_comedy | 0 | 5572 | <reponame>felipebarraza6/startup_comedy
"""User Model."""
# Django
from django.db import models
from django.contrib.auth.models import AbstractUser
# Utilities
from .utils import ApiModel
class User(ApiModel, AbstractUser):
email = models.EmailField(
'email',
unique = True,
)
USERNAME... | 2.5 | 2 |
tests/test_server.py | m-bo-one/ethereumd-proxy | 21 | 5573 | <reponame>m-bo-one/ethereumd-proxy
from collections import namedtuple
import json
from asynctest.mock import patch
import pytest
from ethereumd.server import RPCServer
from ethereumd.proxy import EthereumProxy
from aioethereum.errors import BadResponseError
from .base import BaseTestRunner
Request = namedtuple('Re... | 2.078125 | 2 |
neorl/rl/baselines/readme.py | evdcush/neorl | 20 | 5574 | <filename>neorl/rl/baselines/readme.py
# This file is part of NEORL.
# Copyright (c) 2021 Exelon Corporation and MIT Nuclear Science and Engineering
# NEORL is free software: you can redistribute it and/or modify
# it under the terms of the MIT LICENSE
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT ... | 1.296875 | 1 |
Compare.py | sushantPatrikar/WaveCompartor | 3 | 5575 | from scipy.io import wavfile
import numpy as np
import pingouin as pg
import pandas as pd
_,data = wavfile.read('wav//ed//mp3baked.wav')
_,data1 = wavfile.read('wav//ing//ingeating.wav')
i= data.shape[0]-1
j = data1.shape[0]-1
index_1 = -1
index_2 = -1
try:
data.shape[1]
except IndexError:
... | 2.421875 | 2 |
tests/comments/test_only_block_comment.py | sco1/pylox | 2 | 5576 | <reponame>sco1/pylox<filename>tests/comments/test_only_block_comment.py<gh_stars>1-10
from textwrap import dedent
import pytest
from pylox.lox import Lox
TEST_SRC = dedent(
"""\
/*
This is a multiline block comment
*/
"""
)
EXPECTED_STDOUTS: list[str] = []
def test_block_comment_at_eof(capsys:... | 2.46875 | 2 |
mlbase/lazy.py | n-kats/mlbase | 0 | 5577 | <reponame>n-kats/mlbase<filename>mlbase/lazy.py<gh_stars>0
from mlbase.utils.misc import lazy
tensorflow = lazy("tensorflow")
numpy = lazy("numpy")
gensim = lazy("gensim")
| 1.4375 | 1 |
setup.py | sturmianseq/observed | 33 | 5578 | import re
import setuptools
README_FILENAME = "README.md"
VERSION_FILENAME = "observed.py"
VERSION_RE = r"^__version__ = ['\"]([^'\"]*)['\"]"
# Get version information
with open(VERSION_FILENAME, "r") as version_file:
mo = re.search(VERSION_RE, version_file.read(), re.M)
if mo:
version = mo.group(1)
else:
... | 1.890625 | 2 |
src/coco.py | catalyst-team/detector | 15 | 5579 | import os
import json
import numpy as np
import pickle
from typing import Any
from pycocotools.coco import COCO
from torch.utils.data import Dataset
class DetectionMSCOCODataset(Dataset):
def __init__(self, annotation_file: str, image_dir: str):
self._annotation_file = annotation_file
self._imag... | 2.453125 | 2 |
UVa 10105 polynomial coefficients/sample/main.py | tadvi/uva | 1 | 5580 | import sys
import operator
sys.stdin = open('input.txt')
fact = [1, 1]
for i in range(2, 15):
fact.append(fact[-1] * i)
while True:
try:
n, k = map(int, raw_input().split())
coef = map(int, raw_input().split())
except:
break
print fact[n] / reduce(operator.mul, [fact[c] for c in... | 2.84375 | 3 |
pynotes/note/models.py | wallaceleonel/Flash-Cards | 2 | 5581 | <gh_stars>1-10
from django.contrib.auth.models import User
from django.db import models
from django.urls import reverse
# Create your models here.
class Post(models.Model):
title = models.CharField(max_length=255)
slug = models.SlugField(max_length=255,unique=True)
#meusite.com/blog;introducao-ao-django
... | 2.53125 | 3 |
infrastructure-provisioning/src/general/scripts/azure/common_notebook_configure_dataengine.py | DmytroLiaskovskyi/incubator-dlab | 0 | 5582 | #!/usr/bin/python
# *****************************************************************************
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The A... | 1.554688 | 2 |
pyACA/ToolFreq2Bark.py | ruohoruotsi/pyACA | 81 | 5583 | <reponame>ruohoruotsi/pyACA<filename>pyACA/ToolFreq2Bark.py<gh_stars>10-100
# -*- coding: utf-8 -*-
"""
helper function: convert Hz to Bark scale
Args:
fInHz: The frequency to be converted, can be scalar or vector
cModel: The name of the model ('Schroeder' [default], 'Terhardt', 'Zwicker', 'Traunmuller')
... | 2.578125 | 3 |
magenta/models/sketch_rnn/rnn.py | laurens-in/magenta | 1 | 5584 | <reponame>laurens-in/magenta
# Copyright 2019 The Magenta 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 ap... | 2.21875 | 2 |
src/cogent3/cluster/UPGMA.py | u6052029/cogent3 | 0 | 5585 | # usr/bin/env python
"""Functions to cluster using UPGMA
upgma takes an dictionary of pair tuples mapped to distances as input.
UPGMA_cluster takes an array and a list of PhyloNode objects corresponding
to the array as input. Can also generate this type of input from a DictArray using
inputs_from_dict_array function.... | 3.140625 | 3 |
src/python/make_store_entry.py | kf7lsu/RegfileCompiler-public | 0 | 5586 | #this code will generate the structural verilog for a single entry in the register file
#takes in the output file manager, the entry number, the number of bits, the number of reads, and the width of the
#tristate buffers on the read outputs
#expects the same things as make_store_cell, ensure code is valid there
#<NAM... | 2.953125 | 3 |
module1/api.py | oceandelee/tac | 0 | 5587 | """API for AVB"""
import json
import sys
import requests
def actualite_found ():
osm = "https://opendata.bruxelles.be/api/datasets/1.0/search/?q="
data = {
"nhits":0,
"parameters":{
"dataset":"actualites-ville-de-bruxelles",
"timezone":"UTC",
"q":"actualite",
"langu... | 3.09375 | 3 |
improver/cli/nbhood.py | cpelley/improver | 77 | 5588 | <reponame>cpelley/improver
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# (C) British Crown Copyright 2017-2021 Met Office.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are p... | 1.382813 | 1 |
bonsai/model.py | ipa-mirb/bonsai | 0 | 5589 | <gh_stars>0
#Copyright (c) 2017 <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, merge, publish, dist... | 1.765625 | 2 |
api/views/todo_views.py | felipe-menelau/todo-list-web | 0 | 5590 | from django.contrib.auth.models import User
from rest_framework import viewsets, status
from rest_framework.response import Response
from rest_framework.permissions import IsAuthenticated, IsAdminUser
from api.serializers import TODOListSerializer
from api.models import TODOList
class TODOListViewSet(viewsets.ModelVi... | 2.015625 | 2 |
Python/Tests/TestData/ProjectHomeProjects/Subfolder/ProgramB.py | techkey/PTVS | 404 | 5591 | # ProgramB.py
print('Hello World')
| 1.171875 | 1 |
donation/migrations/0043_auto_20180109_0012.py | effective-altruism-australia/donation-portal | 1 | 5592 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
def copy_existing_referrals_into_new_field(apps, schema_editor):
Pledge = apps.get_model('donation', 'Pledge')
Referral = apps.get_model('donation', 'Referral')
reason... | 1.867188 | 2 |
python/is_even.py | c1m50c/twitter-examples | 0 | 5593 | <reponame>c1m50c/twitter-examples<gh_stars>0
def is_even(i: int) -> bool:
if i == 1:
return False
elif i == 2:
return True
elif i == 3:
return False
elif i == 4:
return True
elif i == 5:
...
# Never do that! Use one of these instead...
is_even = lambda i : i... | 3.5 | 4 |
wordpress-brute.py | RandomRobbieBF/wordpress-bf | 1 | 5594 | <filename>wordpress-brute.py
#!/usr/bin/env python
#
# Wordpress Bruteforce Tool
#
# By @random_robbie
#
#
import requests
import json
import sys
import argparse
import re
import os.path
from requests.packages.urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3.disable_warnings(InsecureRequestW... | 2.5 | 2 |
graph_search/week2/assignment_dijkstra_shortest_paths.py | liaoaoyuan97/standford_algorithms_specialization | 0 | 5595 | import heapq
import time
from os import path
from math import floor
class Heap:
def __init__(self):
self.size = 0
self.array = []
self.v2index_map = {}
def __get_parent_index(self, idx):
return int(floor((idx - 1) / 2))
def __get_left_child_index(self, idx):
retur... | 3.328125 | 3 |
ssod/utils/structure_utils.py | huimlight/SoftTeacher | 604 | 5596 | <reponame>huimlight/SoftTeacher<gh_stars>100-1000
import warnings
from collections import Counter, Mapping, Sequence
from numbers import Number
from typing import Dict, List
import numpy as np
import torch
from mmdet.core.mask.structures import BitmapMasks
from torch.nn import functional as F
_step_counter = Counter(... | 2.171875 | 2 |
tests/tabular_output/test_terminaltables_adapter.py | zzl0/cli_helpers | 0 | 5597 | # -*- coding: utf-8 -*-
"""Test the terminaltables output adapter."""
from __future__ import unicode_literals
from textwrap import dedent
import pytest
from cli_helpers.compat import HAS_PYGMENTS
from cli_helpers.tabular_output import terminaltables_adapter
if HAS_PYGMENTS:
from pygments.style import Style
... | 2.5625 | 3 |
dev/Tools/build/waf-1.7.13/waflib/extras/fc_xlf.py | jeikabu/lumberyard | 1,738 | 5598 | <gh_stars>1000+
#! /usr/bin/env python
# encoding: utf-8
# harald at klimachs.de
import re
from waflib import Utils,Errors
from waflib.Tools import fc,fc_config,fc_scan
from waflib.Configure import conf
from waflib.Tools.compiler_fc import fc_compiler
fc_compiler['aix'].insert(0, 'fc_xlf')
@conf
def find_xlf(conf):
... | 1.96875 | 2 |
tutorials/create_table/tests.py | MeGustas-5427/SQL_Tutorials | 13 | 5599 | #!/usr/bin/python3
# -*- coding:utf-8 -*-
# __author__ = '__MeGustas__'
from django.test import TestCase
from django.db import connection
from tutorials.create_table.models import *
# Create your tests here.
class TestHealthFile(TestCase):
def setUp(self):
cursor = connection.cursor()
# Popul... | 2.4375 | 2 |