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 |
|---|---|---|---|---|---|---|
drink_partners/partners/tests/views/test_search_partner_view.py | henriquebraga/drink-partners | 0 | 6000 | from drink_partners.contrib.samples import partner_bar_legal
class TestSearchPartner:
async def test_should_return_bad_request_for_str_coordinates(
self,
client,
partner_search_with_str_coordinates_url
):
async with client.get(partner_search_with_str_coordinates_url) as respon... | 2.71875 | 3 |
Titanic/class_create_model_of_logistic_regression.py | ysh329/Titanic-Machine-Learning-from-Disaster | 1 | 6001 | <filename>Titanic/class_create_model_of_logistic_regression.py<gh_stars>1-10
# -*- coding: utf-8 -*-
# !/usr/bin/python
################################### PART0 DESCRIPTION #################################
# Filename: class_create_model_of_logistic_regression.py
# Description:
#
# Author: <NAME>
# E-mail: <EMAIL>
#... | 2.578125 | 3 |
mjecv/io/base.py | mje-nz/mjecv | 0 | 6002 | import multiprocessing
from typing import List, Optional
import numpy as np
from ..util import dill_for_apply
class ImageSequenceWriter:
def __init__(self, pattern, writer, *, max_index=None):
if type(pattern) is not str:
raise ValueError("Pattern must be string")
if pattern.format(1... | 3.046875 | 3 |
377_combination_sum_iv.py | gengwg/leetcode | 2 | 6003 | # 377 Combination Sum IV
# Given an integer array with all positive numbers and no duplicates,
# find the number of possible combinations that add up to a positive integer target.
#
# Example:
#
# nums = [1, 2, 3]
# target = 4
#
# The possible combination ways are:
# (1, 1, 1, 1)
# (1, 1, 2)
# (1, 2, 1)
# (1, 3)
# (2,... | 3.546875 | 4 |
nvidia-texture-tools/conanfile.py | koeleck/conan-packages | 0 | 6004 | <reponame>koeleck/conan-packages<gh_stars>0
from conans import ConanFile, CMake, tools
import os
STATIC_LIBS = ["nvtt", "squish", "rg_etc1", "nvimage", "bc6h", "posh",
"bc7", "nvmath", "nvthread", "nvcore"]
SHARED_LIBS = ["nvtt", "nvimage", "nvthread", "nvmath", "nvcore"]
class NvidiatexturetoolsConan(... | 1.648438 | 2 |
train_args.py | MyWay/Create-Your-Own-Image-Classifier | 0 | 6005 | <reponame>MyWay/Create-Your-Own-Image-Classifier
#!/usr/bin/env python3
""" train_args.py
train_args.py command-line args.
"""
import argparse
def get_args():
"""
"""
parser = argparse.ArgumentParser(
description="This script lets you train and save your model.",
usage="python3 train.py f... | 3.015625 | 3 |
apps/payment/views.py | canadiyaman/thetask | 0 | 6006 | <reponame>canadiyaman/thetask<filename>apps/payment/views.py<gh_stars>0
from django.http import HttpResponseRedirect
from django.conf import settings
from django.views.generic import TemplateView
from apps.payment.models import PaymentLog
from apps.payment.stripe import get_token, get_payment_charge
from apps.subscrip... | 2 | 2 |
users/apps.py | srinidhibhat/booknotes | 0 | 6007 | from django.apps import AppConfig
class UsersConfig(AppConfig):
name = 'users'
# below piece of code is needed for automatic profile creation for user
def ready(self):
import users.signals
| 1.921875 | 2 |
secure_data_store/cli.py | HumanBrainProject/secure-data-store | 1 | 6008 | <reponame>HumanBrainProject/secure-data-store
# -*- coding: utf-8 -*-
"""Console script for secure_data_store."""
import click
from . import secure_data_store as sds
CONFIG='~/.sdsrc'
@click.group()
def main():
"""Wrapper for GoCryptFS"""
@main.command()
@click.argument('name')
@click.option('--config', help='Pa... | 2.234375 | 2 |
Support/Fuego/Pythia/pythia-0.4/packages/pyre/pyre/graph/Node.py | marient/PelePhysics | 1 | 6009 | #!/usr/bin/env python
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# <NAME>
# California Institute of Technology
# (C) 1998-2003 All Rights Reserved
#
# <LicenseText>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~... | 2.28125 | 2 |
cairis/gui/RiskScatterPanel.py | RachelLar/cairis_update | 0 | 6010 | # 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... | 1.695313 | 2 |
sdk/python/pulumi_azure/containerservice/get_registry.py | aangelisc/pulumi-azure | 0 | 6011 | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import... | 1.867188 | 2 |
contrib/memcache_whisper.py | TimWhalen/graphite-web | 1 | 6012 | <filename>contrib/memcache_whisper.py
#!/usr/bin/env python
# Copyright 2008 Orbitz WorldWide
#
# 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
... | 2.015625 | 2 |
main.py | showtimesynergy/mojify | 0 | 6013 | <gh_stars>0
from PIL import Image
import csv
from ast import literal_eval as make_tuple
from math import sqrt
import argparse
import os.path
def load_img(image):
# load an image as a PIL object
im = Image.open(image).convert('RGBA')
return im
def color_distance(c_tuple1, c_tuple2):
# calculate the c... | 3.015625 | 3 |
venv/lib/python3.7/site-packages/Xlib/ext/xinput.py | umr-bot/sliding-puzzle-solver-bot | 0 | 6014 | # Xlib.ext.xinput -- XInput extension module
#
# Copyright (C) 2012 Outpost Embedded, LLC
# <NAME> <<EMAIL>>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation; either versio... | 1.523438 | 2 |
vel/notebook/__init__.py | tigerwlin/vel | 273 | 6015 | from .loader import load | 1.125 | 1 |
YourJobAidApi/migrations/0019_remove_category_count_post.py | rayhanrock/django-yourjobaid-api | 1 | 6016 | <reponame>rayhanrock/django-yourjobaid-api
# Generated by Django 3.0.4 on 2020-04-16 23:10
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('YourJobAidApi', '0018_category_count_post'),
]
operations = [
migrations.RemoveField(
model_na... | 1.460938 | 1 |
easyquant/login/__init__.py | CharlieZhao95/easy-quant | 0 | 6017 | # @Time : 2022/1/26 23:07
# @Author : zhaoyu
# @Site :
# @File : __init__.py.py
# @Software: PyCharm
# @Note : xx | 1.054688 | 1 |
tests/api/test_attributes.py | DowneyTung/saleor | 19 | 6018 | from typing import Union
from unittest import mock
import graphene
import pytest
from django.core.exceptions import ValidationError
from django.db.models import Q
from django.template.defaultfilters import slugify
from graphene.utils.str_converters import to_camel_case
from saleor.core.taxes import zero_money
from sa... | 1.984375 | 2 |
3-photos/1-chromakey/app.py | rafacm/aws-serverless-workshop-innovator-island | 1 | 6019 | <gh_stars>1-10
import os
import json
import cv2
import logging
import boto3
import botocore
s3 = boto3.client('s3')
logger = logging.getLogger()
logger.setLevel(logging.INFO)
def upload_file(file_name, bucket, object_name=None):
"""Upload a file to an S3 bucket
:param file_name: File to upload
:param buc... | 2.5625 | 3 |
metrics/overflow.py | DEKHTIARJonathan/pyinstrument | 1 | 6020 | from pyinstrument import Profiler
p = Profiler(use_signal=False)
p.start()
def func(num):
if num == 0:
return
b = 0
for x in range(1,100000):
b += x
return func(num - 1)
func(900)
p.stop()
print(p.output_text())
with open('overflow_out.html', 'w') as f:
f.write(p.output_html(... | 2.859375 | 3 |
scripts/gen_tee_bin.py | wawang621/optee_os | 0 | 6021 | #!/usr/bin/env python3
# SPDX-License-Identifier: BSD-2-Clause
#
# Copyright (c) 2019, Linaro Limited
#
from __future__ import print_function
from __future__ import division
import argparse
import sys
import struct
import re
import hashlib
try:
from elftools.elf.elffile import ELFFile
from elftools.elf.consta... | 2.125 | 2 |
CircuitPython_JEplayer_mp3/repeat.py | gamblor21/Adafruit_Learning_System_Guides | 665 | 6022 | <gh_stars>100-1000
# The MIT License (MIT)
#
# Copyright (c) 2020 <NAME> for Adafruit Industries LLC
#
# 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 l... | 2.15625 | 2 |
Kapitel_1/_1_public_private.py | Geralonx/Classes_Tutorial | 1 | 6023 | <reponame>Geralonx/Classes_Tutorial
# --- Klassendeklaration mit Konstruktor --- #
class PC:
def __init__(self, cpu, gpu, ram):
self.cpu = cpu
self.gpu = gpu
self.__ram = ram
# --- Instanziierung einer Klasse ---#
# --- Ich bevorzuge die Initialisierung mit den Keywords --- #
pc_instanz = ... | 2.734375 | 3 |
algorithm/dynamic_programming/coin_change/solution.py | delaanthonio/hackerrank | 1 | 6024 | <gh_stars>1-10
#!/usr/bin/env python3
"""
The Coin Change Problem
:author: <NAME>
:hackerrank: https://hackerrank.com/delaanthonio
:problem: https://www.hackerrank.com/challenges/coin-change/problem
"""
from typing import List
def count_ways(amount: int, coins: List[int]) -> int:
"""Return the number of ways we... | 3.890625 | 4 |
climbproject/climbapp/admin.py | javawolfpack/ClimbProject | 0 | 6025 | from django.contrib import admin
#from .models import *
from . import models
# Register your models here.
admin.site.register(models.ClimbModel)
| 1.351563 | 1 |
setup.py | TheMagicNacho/artemis-nozzle | 0 | 6026 | <reponame>TheMagicNacho/artemis-nozzle<gh_stars>0
# coding: utf-8
from runpy import run_path
from setuptools import setup
# Get the version from the relevant file
d = run_path('skaero/version.py')
__version__ = d['__version__']
setup(
name="scikit-aero",
version=__version__,
description="Aeronautical engi... | 1.695313 | 2 |
appendix/AI.by.Search/backtracking.search/3-1.eight.queens.py | royqh1979/programming_with_python | 5 | 6027 | """
8皇后问题
使用栈实现回溯法
"""
def print_board(n,count):
print(f"------解.{count}------")
print(" ",end="")
for j in range(n):
print(f"{j:<2}" ,end="")
print()
for i in range(1,n+1):
print(f"{i:<2}",end="")
for j in range(1,n+1):
if queens[i] == j:
print("Q ",end="")
else:
print(" ",end="")
print... | 3.5 | 4 |
multimodal_affinities/evaluation/analysis/plots_producer.py | amzn/multimodal-affinities | 6 | 6028 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: CC-BY-4.0
import os
import cv2
from collections import namedtuple
import imageio
from PIL import Image
from random import randrange
import numpy as np
from sklearn.decomposition import PCA
from scipy.spatial.distance import... | 2.265625 | 2 |
openstates/openstates-master/openstates/de/legislators.py | Jgorsick/Advocacy_Angular | 0 | 6029 | import re
import lxml.html
from openstates.utils import LXMLMixin
from billy.scrape.legislators import LegislatorScraper, Legislator
class DELegislatorScraper(LegislatorScraper,LXMLMixin):
jurisdiction = 'de'
def scrape(self, chamber, term):
url = {
'upper': 'http://legis.delaware.gov/l... | 2.890625 | 3 |
simpleredial/dataloader/fine_grained_test_dataloader.py | gmftbyGMFTBY/SimpleReDial-v1 | 36 | 6030 | <gh_stars>10-100
from header import *
from .utils import *
from .util_func import *
'''Only for Testing'''
class FineGrainedTestDataset(Dataset):
def __init__(self, vocab, path, **args):
self.args = args
self.vocab = vocab
self.vocab.add_tokens(['[EOS]'])
self.pad = self.voca... | 2.28125 | 2 |
dabing/DABING-MIB.py | SvajkaJ/dabing | 0 | 6031 | <filename>dabing/DABING-MIB.py
#
# PySNMP MIB module DABING-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file://..\DABING-MIB.mib
# Produced by pysmi-0.3.4 at Tue Mar 22 12:53:47 2022
# On host ? platform ? version ? by user ?
# Using Python version 3.8.2 (tags/v3.8.2:7b3ab59, Feb 25 2020, 22:45:29) [MSC v.1916 32 bi... | 1.609375 | 2 |
parameter_setup/run_setup_extra_vis.py | kharris/allen-voxel-network | 7 | 6032 | import os
import numpy as np
save_stem='extra_vis_friday_harbor'
data_dir='../../data/sdk_new_100'
resolution=100
cre=False
source_acronyms=['VISal','VISam','VISl','VISp','VISpl','VISpm',
'VISli','VISpor','VISrl','VISa']
lambda_list = np.logspace(3,12,10)
scale_lambda=True
min_vox=0
# save_file_name='... | 1.75 | 2 |
examples/runall.py | GNiklas/MOSSEPy | 0 | 6033 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Nov 20 09:42:39 2020
@author: niklas
"""
from mossepy.mosse_tracker import MOSSE
# choose position of object in first frame
# that should be done by mouse click
objPos = [256, 256]
# choose tracker type
tracker = MOSSE()
# initialize object position ... | 2.734375 | 3 |
core/formulas.py | mike006322/PolynomialCalculator | 0 | 6034 | def solve(polynomial):
"""
input is polynomial
if more than one variable, returns 'too many variables'
looks for formula to apply to coefficients
returns solution or 'I cannot solve yet...'
"""
if len(polynomial.term_matrix[0]) > 2:
return 'too many variables'
elif len(polynomial... | 3.828125 | 4 |
manim/mobject/svg/style_utils.py | 5Points7Edges/manim | 0 | 6035 | <reponame>5Points7Edges/manim
"""Utility functions for parsing SVG styles."""
__all__ = ["cascade_element_style", "parse_style", "parse_color_string"]
from xml.dom.minidom import Element as MinidomElement
from colour import web2hex
from ...utils.color import rgb_to_hex
from typing import Dict, List
CASCADING_STYL... | 2.65625 | 3 |
iotrigger.py | mm011106/iotrigger | 0 | 6036 | #!/usr/bin/env python
#coding:utf-8
import os
import RPi.GPIO as GPIO #
import json
from time import sleep #
from twython import Twython
f=open("tw_config.json",'r')
config=json.load(f)
f.close()
CONSUMER_KEY =config['consumer_key']
CONSUMER_SECRET =config['consumer_secret']
ACCESS_TOKEN =config['access_token']
ACCE... | 2.578125 | 3 |
src/wheezy/template/tests/test_utils.py | nxsofsys/wheezy.template | 2 | 6037 |
""" Unit tests for ``wheezy.templates.utils``.
"""
import unittest
class FindAllBalancedTestCase(unittest.TestCase):
""" Test the ``find_all_balanced``.
"""
def test_start_out(self):
""" The start index is out of range.
"""
from wheezy.template.utils import find_all_balanced
... | 3.296875 | 3 |
akshare/economic/macro_constitute.py | peterrosetu/akshare | 1 | 6038 | <gh_stars>1-10
# -*- coding:utf-8 -*-
# /usr/bin/env python
"""
Date: 2019/10/21 12:08
Desc: 获取金十数据-数据中心-主要机构-宏观经济
"""
import json
import time
import pandas as pd
import requests
from tqdm import tqdm
from akshare.economic.cons import (
JS_CONS_GOLD_ETF_URL,
JS_CONS_SLIVER_ETF_URL,
JS_CONS_OPEC_URL,
)
... | 2.34375 | 2 |
test/testers/winforms/scrollbar/__init__.py | ABEMBARKA/monoUI | 1 | 6039 |
##############################################################################
# Written by: <NAME> <<EMAIL>>
# Date: 08/06/2008
# Description: Application wrapper for scrollbar.py
# Used by the scrollbar-*.py tests
##############################################################################$
'... | 2.34375 | 2 |
save_tweets.py | iglesiasmanu/data_analysis | 0 | 6040 | import json
from os import path
from tweepy import OAuthHandler, Stream
from tweepy.streaming import StreamListener
from sqlalchemy.orm.exc import NoResultFound
from database import session, Tweet, Hashtag, User
consumer_key = "0qFf4T2xPWVIycLmAwk3rDQ55"
consumer_secret = "<KEY>"
access_token = "<KEY>"
acces_token_... | 2.84375 | 3 |
app/views/main.py | chrisjws-harness/flaskSaaS | 0 | 6041 | from flask import render_template, jsonify
from app import app
import random
@app.route('/')
@app.route('/index')
def index():
# Feature flags init goes here!
#
# noinspection PyDictCreation
flags = {
"welcome_text": "welcome to my python FF tutorial!"
}
# Flag goes here!
#... | 2.734375 | 3 |
base_sample/numpy_mat.py | keepangry/ai_algorithm | 2 | 6042 | # encoding: utf-8
'''
@author: yangsen
@license:
@contact:
@software:
@file: numpy_mat.py
@time: 18-8-25 下午9:56
@desc:
'''
import numpy as np
a = np.arange(9).reshape(3,3)
# 行
a[1]
a[[1,2]]
a[np.array([1,2])]
# 列
a[:,1]
a[:,[1,2]]
a[:,np.array([1,2])] | 2.46875 | 2 |
ai_traineree/agents/rainbow.py | laszukdawid/ai-traineree | 22 | 6043 | import copy
from typing import Callable, Dict, List, Optional
import torch
import torch.nn as nn
import torch.optim as optim
from ai_traineree import DEVICE
from ai_traineree.agents import AgentBase
from ai_traineree.agents.agent_utils import soft_update
from ai_traineree.buffers import NStepBuffer, PERBuffer
from ai... | 2.28125 | 2 |
nvvm/core/nvvm.py | uchytilc/PyCu | 0 | 6044 | <filename>nvvm/core/nvvm.py
from pycu.nvvm import (get_libdevice, ir_version, version, add_module_to_program, compile_program,
create_program, destroy_program, get_compiled_result, get_compiled_result_size,
get_program_log, get_program_log_size, lazy_add_module_to_program, verify_program)
import os
imp... | 2.109375 | 2 |
fieldservice/fieldservice/doctype/fieldservice_settings/test_fieldservice_settings.py | itsdaveit/fieldservice | 0 | 6045 | <gh_stars>0
# Copyright (c) 2022, itsdve GmbH and Contributors
# See license.txt
# import frappe
import unittest
class TestFieldserviceSettings(unittest.TestCase):
pass
| 1.460938 | 1 |
Codes/Data Processing.py | BrickerP/Investment- | 0 | 6046 | <reponame>BrickerP/Investment-
# -*- coding: utf-8 -*-
"""
Created on Sun Nov 21 14:51:01 2021
@author: 75638
"""
import pandas as pd
import numpy as np
pd.set_option('display.max_columns', None)
pd.set_option('display.width', 10000)
def process_data(path1,path2):
'''
1.path1: file path of differen... | 2.75 | 3 |
tests/test_env.py | Majanao/pytorch-blender | 381 | 6047 | import pytest
from pathlib import Path
from blendtorch import btt
BLENDDIR = Path(__file__).parent/'blender'
class MyEnv(btt.env.OpenAIRemoteEnv):
def __init__(self, background=True, **kwargs):
super().__init__(version='1.0.0')
self.launch(scene=BLENDDIR/'env.blend', script=BLENDDIR /
... | 1.9375 | 2 |
sitetree/__init__.py | sitkatech/django-sitetree | 3 | 6048 | VERSION = (0, 9, 5)
| 1.195313 | 1 |
deepvariant/runtime_by_region_vis.py | tahashmi/deepvariant | 4 | 6049 | <filename>deepvariant/runtime_by_region_vis.py
# Copyright 2020 Google LLC.
#
# 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 list ... | 1.429688 | 1 |
pkgs/dynd-python-0.7.2-py27_0/lib/python2.7/site-packages/dynd/tests/test_nd_fields.py | wangyum/anaconda | 0 | 6050 | <filename>pkgs/dynd-python-0.7.2-py27_0/lib/python2.7/site-packages/dynd/tests/test_nd_fields.py
import sys
import unittest
from dynd import nd, ndt
"""
class TestFields(unittest.TestCase):
def test_simple(self):
a = nd.array([
(1, 2, 'a', 'b'),
(3, 4, 'ab', 'cd'),
... | 3.015625 | 3 |
xeofs/pandas/_transformer.py | nicrie/xeofs | 3 | 6051 | from typing import Union, Iterable, List
import numpy as np
import pandas as pd
from ..models._transformer import _ArrayTransformer, _MultiArrayTransformer
class _DataFrameTransformer(_ArrayTransformer):
'''`_ArrayTransformer` wrapper for `pandas.DataFrame`.
'''
def __init__(self):
super().__in... | 2.859375 | 3 |
tests/bogus_python_model.py | FossilizedContainers/fossilized-controller | 1 | 6052 | <filename>tests/bogus_python_model.py
import os
import sys
import lipd
# import pythonAdapter, assumes in ../python-adapter/
tests_dir = os.path.dirname(os.path.realpath(__file__))
fc_dir = os.path.dirname(tests_dir)
python_adapter_dir = os.path.join(fc_dir, "python-adapter")
sys.path.append(python_adapter_dir)
impor... | 2.46875 | 2 |
tello_control_ui.py | banne2266/UAV-autopilot-NCTU-2021 | 0 | 6053 | from PIL import Image
from PIL import ImageTk
import tkinter as tki
from tkinter import Toplevel, Scale
import threading
import datetime
import cv2
import os
import time
import platform
class TelloUI:
"""Wrapper class to enable the GUI."""
def __init__(self,tello,outputpath):
"""
Initial all t... | 2.9375 | 3 |
__temp/examples/rhino/mesh-stanford-dragon.py | robin-gdwl/examples_topop-desc | 0 | 6054 | <reponame>robin-gdwl/examples_topop-desc
import compas
import compas_rhino
from compas.datastructures import Mesh
mesh = Mesh.from_ply(compas.get('stanford_dragon.ply'))
compas_rhino.mesh_draw(mesh)
| 1.6875 | 2 |
Python/ML_DL/DL/Neural-Networks-Demystified-master/partOne.py | vbsteja/code | 3 | 6055 | # Neural Networks Demystified
# Part 1: Data + Architecture
#
# Supporting code for short YouTube series on artificial neural networks.
#
# <NAME>
# @stephencwelch
import numpy as np
# X = (hours sleeping, hours studying), y = Score on test
X = np.array(([3,5], [5,1], [10,2]), dtype=float)
y = np.array(([75], [82], [... | 3.78125 | 4 |
manubot/process/util.py | benstear/manubot | 0 | 6056 | <gh_stars>0
import json
import logging
import os
import pathlib
import re
import textwrap
import warnings
from typing import List, Optional
import jinja2
import pandas
import requests
import requests_cache
import yaml
from manubot.util import read_serialized_data, read_serialized_dict
from manubot.process.bibliograph... | 2.25 | 2 |
iba_scrape.py | wmwilcox/mix-mind | 1 | 6057 | <gh_stars>1-10
#! /usr/bin/env python
# scrape the IBA pages for cocktail lists
import sys
import xml.etree.ElementTree as ET
from lxml import html
import requests
from pprint import pprint
from collections import OrderedDict
import json
url = 'http://iba-world.com/new-era-drinks/'
jsonfile = 'IBA_new_era_drinks.jso... | 2.84375 | 3 |
Data Structures/Tree.py | Royals-Aeo-Gamer/MyPyMods | 0 | 6058 | class TreeNode:
def __init__(self, name, data, parent=None):
self.name = name
self.parent = parent
self.data = data
self.childs = {}
def add_child(self, name, data):
self.childs.update({name:(type(self))(name, data, self)})
def rm_branch(self, name, ansistors_n: lis... | 3.140625 | 3 |
config.py | ggiaquin16/GroupProject19 | 0 | 6059 | api_key = "<KEY>"
mongo_url = 'mongodb://localhost:27017'
mongo_db = 'CarPopularity'
mongo_collections = ['CarSalesByYear', 'PopularCarsByRegion']
years_data = ['2019', '2018', '2017', '2016', '2015']
test_mode = True | 1.710938 | 2 |
pytorch_ares/pytorch_ares/attack_torch/mim.py | thu-ml/realsafe | 107 | 6060 | <gh_stars>100-1000
import imp
import torch
import torch.nn as nn
import numpy as np
import torch.nn.functional as F
from pytorch_ares.attack_torch.utils import loss_adv
class MIM(object):
'''Projected Gradient Descent'''
def __init__(self, net, epsilon, p, stepsize, steps, decay_factor, data_name,target, loss... | 2.375 | 2 |
src/utils/templatetags/menubutton.py | pwelzel/bornhack-website | 0 | 6061 | from django import template
register = template.Library()
@register.simple_tag(takes_context=True)
def menubuttonclass(context, appname):
if appname == context['request'].resolver_match.func.view_class.__module__.split(".")[0]:
return "btn-primary"
else:
return "btn-default"
| 1.929688 | 2 |
wiki/tests.py | Prones94/Make_Wiki | 0 | 6062 | <reponame>Prones94/Make_Wiki
from django.test import TestCase
from django.contrib.auth.models import User
from wiki.models import Page
from django.utils.text import slugify
# Create your tests here.
class WikiPageTest(TestCase):
def test_edit(self):
user = User.objects.create_user(username='admin', passwo... | 2.734375 | 3 |
birdy/__init__.py | tkiapril/birdy | 1 | 6063 | __author__ = '<NAME> <<EMAIL>>'
__version__ = '0.2'
| 1.023438 | 1 |
ares/defense/randomization.py | KuanKuanQAQ/ares | 206 | 6064 | <reponame>KuanKuanQAQ/ares<gh_stars>100-1000
''' The randomization defense method, which applies random . '''
import tensorflow as tf
from ares.defense.input_transformation import input_transformation
def randomize(xs, scale_min=0.875, pad_value=0.0):
''' Apply random rescaling and padding to xs.
:param xs... | 2.921875 | 3 |
annotate/backend/admin.py | hopeogbons/image-annotation | 0 | 6065 | <gh_stars>0
from django.contrib import admin
from annotate.backend.models import Image, Annotation
admin.site.register(Image)
admin.site.register(Annotation)
| 1.367188 | 1 |
34. Find First and Last Position of Element in Sorted Array/main.py | Competitive-Programmers-Community/LeetCode | 2 | 6066 | class Solution:
def searchRange(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: List[int]
"""
if not nums:
return [-1, -1]
low = 0
high = len(nums) - 1
f = 0
while low<=high:
mid = (low+h... | 3.34375 | 3 |
c/create.py | LMS57/domato | 0 | 6067 | <gh_stars>0
data = open('./original').readlines()
alphabet = {
"<":"lt",
">":"gt",
"=":"=",
"-":'-',
"+":"+",
"-":"-",
"~":"~",
"!":"ex",
"%":"%",
"^":"^",
"&":"&",
"*":"*",
"(":"(",
")":"right_paran",
... | 2.984375 | 3 |
AppServer/google/appengine/api/memcache/memcache_distributed.py | isabella232/scale-safe | 3 | 6068 | #!/usr/bin/env python
#
# Copyright 2007 Google 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 o... | 1.984375 | 2 |
inflateutils/exportmesh.py | arpruss/inflatemesh | 8 | 6069 | <filename>inflateutils/exportmesh.py
from struct import pack
from .vector import *
from .formatdecimal import decimal
from numbers import Number
import os
import sys
try:
basestring
except:
basestring = str
def isColorTriangleList(polys):
return isinstance(polys[0][1][0][0], Number)
def toPolyhedra(... | 2.796875 | 3 |
Assignment1/Identification/match_module.py | arywatt/FDS_2020_2021 | 0 | 6070 | import numpy as np
from PIL import Image
import matplotlib.pyplot as plt
import histogram_module
import dist_module
def rgb2gray(rgb):
r, g, b = rgb[:, :, 0], rgb[:, :, 1], rgb[:, :, 2]
gray = 0.2989 * r + 0.5870 * g + 0.1140 * b
return gray
# model_images - list of file names of model images
# query_... | 2.984375 | 3 |
dycco/__main__.py | rojalator/dycco | 0 | 6071 | <reponame>rojalator/dycco<filename>dycco/__main__.py
import argparse
import logging
import sys
from .dycco import document
def main(paths, output_dir, use_ascii:bool, escape_html:bool, single_file:bool):
try:
document(paths, output_dir, use_ascii, escape_html, single_file)
except IOError as e:
... | 2.734375 | 3 |
jumpy/jumpy/ndarray.py | rghwer/testdocs | 13,006 | 6072 | ################################################################################
# Copyright (c) 2015-2018 Skymind, Inc.
#
# This program and the accompanying materials are made available under the
# terms of the Apache License, Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0.
#
# Unless... | 1.984375 | 2 |
Python/usec_mode.py | hanayik/StimSync | 6 | 6073 | import serial
ser = serial.Serial('/dev/tty.usbmodem7071', 115200, timeout=10)
ser.write("\xb1\xa3\xb5\xb5") #set usec mode 177,163,181,181
ser.flush()
ser.flushInput()
obs = ser.read(8)
if len(obs) != 8:
print('Error: no buttons presses detected')
print 'Observed data (as hex): '+ obs.encode('hex')
obsBin = [ord(... | 2.546875 | 3 |
torchaudio/datasets/libritts.py | hahaxun/audio | 1 | 6074 | import os
from typing import Tuple
import torchaudio
from torch import Tensor
from torch.utils.data import Dataset
from torchaudio.datasets.utils import (
download_url,
extract_archive,
walk_files,
)
URL = "train-clean-100"
FOLDER_IN_ARCHIVE = "LibriTTS"
_CHECKSUMS = {
"http://www.openslr.org/60/dev-c... | 2.34375 | 2 |
Others/Source/19/19.2/barh_test.py | silence0201/Learn-Python | 1 | 6075 | # coding: utf-8
#########################################################################
# 网站: <a href="http://www.crazyit.org">疯狂Java联盟</a> #
# author yeeku.H.lee <EMAIL> #
# #
# version 1.0 ... | 2.578125 | 3 |
03_docker_compose/03_c_simple_case_with_mongodb_orm/app/app.py | kendny/study_docker | 2 | 6076 | <gh_stars>1-10
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Dec 18 20:13:57 2018
@author: allen
"""
import random, os, json, datetime, time
from flask import Flask, Response
from pymongo import MongoClient
from bson import json_util
app = Flask(__name__)
MONGO_URI = "mongodb://mongodb:27017" ... | 3.203125 | 3 |
goethe/eval/analogy_space.py | HPI-DeepLearning/wort2vek | 4 | 6077 | #! /usr/bin/Python
from gensim.models.keyedvectors import KeyedVectors
from scipy import spatial
from numpy import linalg
import argparse
import sys
vector_file = sys.argv[1]
if len(sys.argv) != 6:
print('arguments wrong!')
print(len(sys.argv))
exit()
else:
words = [sys.argv[2], sys.argv[3], sys.arg... | 2.578125 | 3 |
localgraphclustering/algorithms/eig2_nL.py | vishalbelsare/LocalGraphClustering | 106 | 6078 | import numpy as np
import scipy as sp
import scipy.sparse.linalg as splinalg
def eig2_nL(g, tol_eigs = 1.0e-6, normalize:bool = True, dim:int=1):
"""
DESCRIPTION
-----------
Computes the eigenvector that corresponds to the second smallest eigenvalue
of the normalized Laplacian matrix ... | 2.6875 | 3 |
build/common/hex2carray.py | isabella232/nanos-nonsecure-firmware | 16 | 6079 | <gh_stars>10-100
"""
*******************************************************************************
* Ledger Blue
* (c) 2016 Ledger
*
* 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
*
*... | 2.484375 | 2 |
setup.py | xames3/vdoxa | 1 | 6080 | # Copyright 2020 XAMES3. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | 1.695313 | 2 |
application/modules/login.py | BaggerFast/Simple_votings | 0 | 6081 | <gh_stars>0
from django.contrib import messages
from django.contrib.auth import login, authenticate
from django.shortcuts import render, redirect
from django.urls import reverse
from django.views import View
from application.forms import AuthenticateForm
from application.views import get_navbar, Page
class LoginView... | 2.28125 | 2 |
little_questions/utils/log.py | HelloChatterbox/little_questions | 0 | 6082 | # Copyright 2017 Mycroft AI 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 writin... | 2.453125 | 2 |
alipay/aop/api/response/AlipayOpenMiniVersionAuditApplyResponse.py | antopen/alipay-sdk-python-all | 0 | 6083 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
class AlipayOpenMiniVersionAuditApplyResponse(AlipayResponse):
def __init__(self):
super(AlipayOpenMiniVersionAuditApplyResponse, self).__init__()
self._speed_up = None
... | 2.03125 | 2 |
cvstudio/view/widgets/loading_dialog/loading_dialog.py | haruiz/PytorchCvStudio | 32 | 6084 | <filename>cvstudio/view/widgets/loading_dialog/loading_dialog.py
import os
from PyQt5 import QtCore
from PyQt5.QtCore import QRect, QPoint
from PyQt5.QtGui import QMovie, QCloseEvent, QShowEvent
from PyQt5.QtWidgets import QDialog, QLabel, QVBoxLayout, QApplication, QWidget
class QLoadingDialog(QDialog):
def __i... | 2.34375 | 2 |
pysnmp-with-texts/MWORKS-MIB.py | agustinhenze/mibs.snmplabs.com | 8 | 6085 | #
# PySNMP MIB module MWORKS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/MWORKS-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:16:04 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:... | 1.546875 | 2 |
Assets/Editor/PostprocessBuildPlayer_MpireNxusMeasurementPostBuildiOS.py | mpire-nxus/nxus_unity_sdk | 1 | 6086 | #!/usr/bin/env python
import sys
import re
from subprocess import Popen, PIPE
import argparse
from pbxproj import XcodeProject, TreeType
from pbxproj import FileOptions
def main():
parser = argparse.ArgumentParser(description="MpireNxusMeasurement post build iOS script")
parser.add_argument('ios_project_path... | 2.1875 | 2 |
vars_in_python.py | klyusba/python-quiz | 0 | 6087 | <filename>vars_in_python.py<gh_stars>0
# == 1 ==
bar = [1, 2]
def foo(bar):
bar = sum(bar)
return bar
print(foo(bar))
# == 2 ==
bar = [1, 2]
def foo(bar):
bar[0] = 1
return sum(bar)
print(foo(bar))
# == 3 ==
bar = [1, 2]
def foo():
bar = sum(bar)
return bar
print(foo())
# == 4 =... | 3.625 | 4 |
hack/dev/gh-replay-events.py | sm43/pipelines-as-code | 0 | 6088 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# 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://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | 2.140625 | 2 |
nintendeals/noa/api/__init__.py | Pooroomoo/nintendeals | 37 | 6089 | <gh_stars>10-100
from .algolia import search_by_nsuid
from .algolia import search_by_platform
from .algolia import search_by_query
| 1.179688 | 1 |
076_Minimum_Window_Substring.py | joshlyman/Josh-LeetCode | 0 | 6090 |
# Other solution
# V2
def minWindow(s, t):
need = collections.Counter(t) #hash table to store char frequency
missing = len(t) #total number of chars we care
start, end = 0, 0
i = 0
for j, char in enumerate(s, 1): #index j from 1
if need[char] > 0... | 3.375 | 3 |
home/migrations/0002_auto_20171017_0412.py | Taywee/amberherbert.com | 0 | 6091 | <filename>home/migrations/0002_auto_20171017_0412.py
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-10-17 04:12
from __future__ import unicode_literals
from django.db import migrations
import wagtail.core.blocks
import wagtail.core.fields
class Migration(migrations.Migration):
dependencies = [
... | 1.757813 | 2 |
lib/adv_model.py | chawins/entangle-rep | 15 | 6092 | import torch
import torch.nn as nn
import torch.nn.functional as F
class PGDModel(nn.Module):
"""
code adapted from
https://github.com/karandwivedi42/adversarial/blob/master/main.py
"""
def __init__(self, basic_net, config):
super(PGDModel, self).__init__()
self.basic_net = basic_... | 2.734375 | 3 |
fs_image/rpm/storage/tests/storage_base_test.py | singhaditya28/fs_image | 0 | 6093 | <filename>fs_image/rpm/storage/tests/storage_base_test.py
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
from unittest.mock import patch, MagicMock
f... | 2.0625 | 2 |
sdk/python/pulumi_gcp/kms/get_kms_crypto_key_version.py | sisisin/pulumi-gcp | 0 | 6094 | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import... | 1.945313 | 2 |
lecture11/subsets.py | nd-cse-30872-fa20/cse-30872-fa20-examples | 0 | 6095 | #!/usr/bin/env python3
import itertools
# Constants
NUMBERS = range(0, 10)
# Main Execution
def main():
count = 0
for length in range(0, len(NUMBERS) + 1):
for subset in itertools.combinations(NUMBERS, length):
if sum(subset) % 3 == 0:
count += 1
print(count)
if __... | 3.71875 | 4 |
src/toil/batchSystems/abstractBatchSystem.py | Hexotical/toil | 348 | 6096 | <reponame>Hexotical/toil<gh_stars>100-1000
# Copyright (C) 2015-2021 Regents of the University of California
#
# 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/lice... | 1.859375 | 2 |
demo/other_demo.py | Heartfilia/lite_tools | 5 | 6097 | # -*- coding: utf-8 -*-
from lite_tools import get_md5, get_sha, get_sha3, get_b64e, get_b64d
# about hashlib ==> get_md5, get_sha, get_sha3 || default mode=256
s = "test_information" # 这里只能丢字符串
print(get_md5(s)) # 5414ffd88fcb58417e64ecec51bb3a6b
print(get_md5(s, upper=True)) # 5414FFD88FCB5841... | 1.71875 | 2 |
prereise/gather/solardata/tests/__init__.py | terrywqf/PreREISE | 0 | 6098 | __all__ = ["mock_pv_info", "test_pv_tracking"]
| 0.976563 | 1 |
arfit/cp_utils.py | farr/arfit | 5 | 6099 | <reponame>farr/arfit<filename>arfit/cp_utils.py
import carmcmc as cm
from gatspy.periodic import LombScargleFast
import matplotlib.pyplot as plt
import numpy as np
def csample_from_files(datafile, chainfile, p, q):
data = np.loadtxt(datafile)
times, tind = np.unique(data[:,0], return_index=True)
data = da... | 1.828125 | 2 |