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 |
|---|---|---|---|---|---|---|
kl_modes.py | aasensio/unsupervisedMFBD | 5 | 26000 | <gh_stars>1-10
import numpy as np
import zern
import matplotlib.pyplot as pl
from tqdm import tqdm
import scipy.special as sp
def _even(x):
return x%2 == 0
def _zernike_parity( j, jp):
return _even(j-jp)
class KL(object):
def __init__(self):
pass
# tmp = np.load('kl/kl_data.npy')
# s... | 2.296875 | 2 |
tf_models/train.py | edding/socal-2019-nlp-complete | 2 | 26001 | from tf_models.utils import train, save_model
def train_and_save(name: str, corpus: str, pos_label: str, root: str = ""):
print("Start training {}...".format(name))
mlp_model, _, vec = train(corpus, pos_label, root)
save_model(mlp_model, vec, name, root)
if __name__ == "__main__":
# Train intent mo... | 2.765625 | 3 |
docs/conf.py | j-i-l/SoSpCATpy | 2 | 26002 | <gh_stars>1-10
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------... | 1.492188 | 1 |
migrations/versions/f1896d92dddc_.py | akelshareif/fiscally | 1 | 26003 | """empty message
Revision ID: f1896d92dddc
Revises: <PASSWORD>
Create Date: 2020-08-21 22:08:42.863607
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = '<PASSWORD>'
branch_labels = None
depends_on = None
def upgrade():
# ### command... | 1.648438 | 2 |
test/territories_test.py | AColocho/us-states | 3 | 26004 | <reponame>AColocho/us-states<gh_stars>1-10
from states import Territories_Abbreviated
from states import Territories_Full_Name
from states import Uninhabited_Territories
from states import Associated_States
from states import Territories
import unittest
class Abbreviated_Test(unittest.TestCase):
def check_lenght(s... | 3.53125 | 4 |
DataStructures/BinarySerachTree_def/Program.py | luiscarm9/Data-Structures-in-Python | 0 | 26005 | <gh_stars>0
from BinarySerachTree_def.BinaryTree import BinaryTreeS
binarytree=BinaryTreeS()
#create a binary tree with fibonnaci
binarytree.insert(0)
binarytree.insert(1)
binarytree.insert(1)
binarytree.insert(2)
binarytree.insert(3)
binarytree.insert(5)
binarytree.insert(8)
binarytree.insert(13)
binarytree.getTra... | 3.53125 | 4 |
generative_model/generator_test.py | LamUong/Generate-novel-molecules-with-LSTM | 19 | 26006 | <filename>generative_model/generator_test.py
import torch
import torch.nn as nn
from torch.autograd import Variable
from data_loading import *
from rdkit import Chem
'''
the model
'''
class generative_model(nn.Module):
def __init__(self, vocabs_size, hidden_size, output_size, embedding_dimension, n_layers):
... | 2.859375 | 3 |
lib/jnpr/healthbot/swagger/models/hb_graphs_query.py | Juniper/healthbot-py-client | 10 | 26007 | <reponame>Juniper/healthbot-py-client
# coding: utf-8
"""
Paragon Insights APIs
API interface for PI application # noqa: E501
OpenAPI spec version: 4.0.0
Contact: <EMAIL>
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
cl... | 1.34375 | 1 |
unn/models/attentions/factorized_attention.py | zongdaoming/TinyTransformer | 2 | 26008 | <gh_stars>1-10
import torch
import torch.nn as nn
import torch.nn.functional as F
from .position import LearnedEmbedding
class FactorizedAttentionBlock(nn.Module):
def __init__(self, inplanes, feat_planes, out_planes=None, kernel_size=1, stride=1, position_embedding=None,
**kwargs):
sup... | 2.296875 | 2 |
scripts/py_shell.py | sjl3110/TF-M | 0 | 26009 | import subprocess
commit_sha_base = 'c855573fd1acadf2dd3b1cdc1e4581cd49c77f05'
cmake_command = 'cmake -S . -B cmake_build -DTFM_PLATFORM=arm/mps2/an521 \
-DTFM_TOOLCHAIN_FILE=toolchain_GNUARM.cmake \
-DCMAKE_BUILD_TYPE=Release \
-DTFM_PROFILE=profile_small'... | 2.109375 | 2 |
Python 2 & 3/class example/sparse_matrix.py | sasasagagaga/Code-examples | 0 | 26010 | from collections import defaultdict
import copy
class CooSparseMatrix:
def _prepare_coords(self, coords):
i, j = tuple(map(int, coords))
if 0 > i or i >= self.Shape[0] or 0 > j or j >= self.Shape[1]:
raise TypeError
return i, j
def __get_copy(self):
return copy.dee... | 2.609375 | 3 |
src/stitcher.py | ahelsing/geni-tools | 3 | 26011 | <filename>src/stitcher.py<gh_stars>1-10
#!/usr/bin/env python
#----------------------------------------------------------------------
# Copyright (c) 2013-2016 Raytheon BBN Technologies
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and/or hardware specification (th... | 1.65625 | 2 |
check_db_connection.py | sernote/python_training | 0 | 26012 | <reponame>sernote/python_training
from fixture.orm import ORMFixture
from model.group import Group
from fixture.contact import Contacthelper
db = ORMFixture(host='localhost', name='addressbook', user='root', password='')
try:
l = db.get_contact_list()
for item in l:
print(item.all_phones_from_page)
... | 2.09375 | 2 |
csrf/api/v1/urls.py | CredoEducation/edx-drf-extensions | 13 | 26013 | <gh_stars>10-100
"""
URL definitions for version 1 of the CSRF API.
"""
from django.conf.urls import url
from .views import CsrfTokenView
urlpatterns = [
url(r'^token$', CsrfTokenView.as_view(), name='csrf_token'),
]
| 1.601563 | 2 |
src/zenmake/zm/buildconf/types.py | pustotnik/raven | 0 | 26014 | # coding=utf-8
#
"""
Copyright (c) 2020, <NAME>. All rights reserved.
license: BSD 3-Clause License, see LICENSE for more details.
"""
from zm.pyutils import struct
class AnyStrKey(object):
""" Any amount of string keys"""
__slots__ = ()
def __eq__(self, other):
if not isinstance(other, AnyStr... | 2.375 | 2 |
bokeh/protocol/messages/ok.py | kinghows/bokeh | 4 | 26015 | from __future__ import absolute_import
import logging
log = logging.getLogger(__name__)
from ..message import Message
from . import register
@register
class ok_1(Message):
''' Define the ``OK`` message (revision 1) for acknowledging successful
handling of a previous message.
The ``content`` fragment of ... | 2.734375 | 3 |
ranking-jaccardian.py | bharathbs93/Article-Similarity-Search | 0 | 26016 | <reponame>bharathbs93/Article-Similarity-Search
#Importing libraries that are needed for processing
import pandas as pd
from sklearn import preprocessing
import numpy as np
from sklearn.metrics.pairwise import pairwise_distances
# Reading the csv file of term document frequency generated in R
input_data = pd.read_cs... | 3.40625 | 3 |
1-Machine-Learning/1-Generative-Models/2D Representation & Reconstruction/2-Encoder-Decoder/Auto-Encoder/AE.py | yzy1996/Artificial-Intelligence | 7 | 26017 | <filename>1-Machine-Learning/1-Generative-Models/2D Representation & Reconstruction/2-Encoder-Decoder/Auto-Encoder/AE.py<gh_stars>1-10
import numpy as np
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
import matplotlib.pyplot as plt
# load data
(x_train, _), _ = keras.datase... | 2.953125 | 3 |
third_party/liblouis/copy_tables.py | google-ar/chromium | 2,151 | 26018 | #!/usr/bin/env python
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
'''Copies the liblouis braille translation tables to a destination.'''
import liblouis_list_tables
import optparse
import os
import sh... | 2.109375 | 2 |
tools/embed_resource.py | hunamizawa/ESP8266Clock | 1 | 26019 | <filename>tools/embed_resource.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
data_dir ディレクトリ内のすべてのファイルを、PGM_P ( = const char * ) として埋め込むスクリプト。
Build/Upload の前に、自動的に実行される。
"""
Import("env", "projenv")
import os, glob, re, hashlib
header_file_header = """// auto-generated by script tools/embed_resource.py
// D... | 2.484375 | 2 |
rest/migrations/0032_auto_20200819_2057.py | narcotis/Welbot-V2 | 1 | 26020 | <reponame>narcotis/Welbot-V2
# Generated by Django 3.0.8 on 2020-08-19 11:57
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('rest', '0031_auto_20200819_2056'),
]
operations = [
migrations.AlterField(
model_name='culture_even... | 1.5 | 2 |
src/utils/pythonSrc/watchFaceParser/elements/weatherElements/icon.py | chm-dev/amazfitGTSwatchfaceBundle | 49 | 26021 | from watchFaceParser.elements.basicElements.imageSet import ImageSet
class Icon:
definitions = {
1: { 'Name': 'Images', 'Type': ImageSet},
2: { 'Name': 'NoWeatherImageIndex', 'Type': 'long'},
}
| 1.539063 | 2 |
netbox/dcim/migrations/0133_port_colors.py | TheFlyingCorpse/netbox | 4,994 | 26022 | <reponame>TheFlyingCorpse/netbox
from django.db import migrations
import utilities.fields
class Migration(migrations.Migration):
dependencies = [
('dcim', '0132_cable_length'),
]
operations = [
migrations.AddField(
model_name='frontport',
name='color',
... | 2 | 2 |
main.py | victorsevero/sevs-move | 0 | 26023 | <filename>main.py
import cv2
import numpy as np
import os
import shutil
import image_slicer
import PIL.Image
from pynput.keyboard import Key, Controller
import subprocess
import pandas as pd
from tkinter import *
import time
# from IPython import embed
PATH_BG = 'icons_with_bg\\'
PATH_SLICES = 'slices\\'
# def inter... | 2.65625 | 3 |
helpers/__init__.py | sspbft/odin | 0 | 26024 | <filename>helpers/__init__.py
"""Package containing various helpers."""
| 1.25 | 1 |
ch04/ex05.py | lee-hyeonseung/lab_dl | 1 | 26025 | <gh_stars>1-10
import numpy as np
def numerical_diff(fn, x):
""" Numerical Differential
함수 fn과 점 x가 주어졌을 때, x에서의 함수 fn의 미분(도함수) 값"""
h = 1e-4 # 0.0001
return (fn(x + h) - fn(x - h)) / (2 * h)
def f1(x):
return 0.001 * x **2 + 0.01 * x
def f1_prime(x):
"""근사값을 사용하지 않은 함수 f1의 도함수"""
retur... | 3.15625 | 3 |
pureport_client/commands/accounts/audit_log.py | ellievaughn/pureport-python-client | 4 | 26026 | # -*- coding: utf-8 -*_
#
# Copyright (c) 2020, Pureport, Inc.
# All Rights Reserved
from __future__ import absolute_import
from click import (
option,
Choice
)
from pureport_client.helpers import format_date
from pureport_client.commands import (
CommandBase,
AccountsMixin
)
EVENT_TYPES = ('USER_L... | 1.570313 | 2 |
extras.py | pyaf/severstal-steel-defect-detection | 0 | 26027 | import os
from tqdm import tqdm
import numpy as np
import pandas as pd
import os
import pdb
import cv2
import time
import json
import torch
import random
import scipy
import logging
import traceback
import numpy as np
from datetime import datetime
# from config import HOME
from tensorboard_logger import log_value, log... | 2.109375 | 2 |
polling_stations/apps/data_importers/management/commands/import_scarborough.py | DemocracyClub/UK-Polling-Stations | 29 | 26028 | from data_importers.management.commands import BaseHalaroseCsvImporter
class Command(BaseHalaroseCsvImporter):
council_id = "SCE"
addresses_name = "2021-11-10T10:12:49.277177/polling_station_export-2021-11-10.csv"
stations_name = "2021-11-10T10:12:49.277177/polling_station_export-2021-11-10.csv"
elect... | 2.5 | 2 |
ccfx/scripts/testthreadingutil.py | ytetsuwo/ccfinder-core | 2 | 26029 | <reponame>ytetsuwo/ccfinder-core<gh_stars>1-10
import threadingutil
import sys
import random
import time
random.seed(0)
def f(v): # this function must be declared at global scope, in order to make it visible to subprocess.
time.sleep(random.random() * 2.0)
return v * v
if __name__ == '__main__':
usage ... | 2.46875 | 2 |
src/server.py | openbrisk/brisk-runtime-python | 0 | 26030 | #!/usr/bin/env python
import logging
import sys
import imp
import os
from flask import Flask, request, abort, g
app = Flask(__name__)
@app.route('/healthz', methods=['GET'])
def healthz():
return "", 200, { 'Content-Type': 'text/plain' }
def configure_logging(logLevel):
global app
root = logging.getLog... | 2.484375 | 2 |
slybot/slybot/utils.py | rmcwilliams2004/mapping | 8 | 26031 | <gh_stars>1-10
from urlparse import urlparse
import os
import json
from scrapely.htmlpage import HtmlPage
def iter_unique_scheme_hostname(urls):
"""Return an iterator of tuples (scheme, hostname) over the given urls,
filtering dupes
"""
scheme_hostname = set()
for x in urls:
p = urlparse(x... | 2.96875 | 3 |
reppy/util.py | PLPeeters/reppy | 137 | 26032 | <reponame>PLPeeters/reppy
'''Utility functions.'''
import email
def parse_date(string):
'''Return a timestamp for the provided datestring, described by RFC 7231.'''
parsed = email.utils.parsedate_tz(string)
if parsed is None:
raise ValueError("Invalid time.")
parsed = list(parsed)
# Defau... | 3.296875 | 3 |
bin/design.py | broadinstitute/catch | 58 | 26033 | #!/usr/bin/env python3
"""Design probes for genome capture.
This is the main executable of CATCH for probe design.
"""
import argparse
import importlib
import logging
import os
import random
from catch import coverage_analysis
from catch import probe
from catch.filter import adapter_filter
from catch.filter import d... | 2.390625 | 2 |
autograd/__init__.py | mattjj/autograd_tutorial | 704 | 26034 | <gh_stars>100-1000
from .differential_operators import make_vjp, grad
| 0.992188 | 1 |
propara/utils/prostruct_predicted_json_to_tsv_grid.py | keisks/propara | 84 | 26035 | <filename>propara/utils/prostruct_predicted_json_to_tsv_grid.py
import json
import sys
from pprint import pprint
from processes.data.propara_dataset_reader import Action
# Input: json format generated by ProparaPredictor
# paraid": "1114",
# "sentence_texts": ["Rainwater falls onto the soil.", "The rainwater seeps ... | 2.5625 | 3 |
impede-app/server/py/filter_library.py | ThatSnail/impede | 1 | 26036 |
""" Module that contains some example filters """
import numpy as np
import matplotlib.pyplot as plt
from graph import Node, Edge, Graph
from resistor import Resistor
from capacitor import Capacitor
from diode import Diode
from opamp import Opamp
from wire import Wire
from units import Units
from filter import Filte... | 2.984375 | 3 |
main_rpi.py | adadesions/AutoWestBin | 0 | 26037 | from imageai.Prediction import ImagePrediction
import cv2
import os
import time
import RPi.GPIO as gpio
def my_prediction(img_path, prob):
result = {}
execution_path = os.getcwd()
prediction = ImagePrediction()
prediction.setModelTypeAsResNet()
prediction.setModelPath(os.path.join(execution_path, "... | 3.078125 | 3 |
example/mini_mnist/rename_nodes.py | ciandt-d1/tf_image_classification | 0 | 26038 | <gh_stars>0
# -*- coding: utf-8 -*-
import numpy as np
import sys
import os
import argparse
import logging
import tensorflow as tf
from cnn_architecture_inception_v4 import cnn_architecture
tf.logging.set_verbosity(tf.logging.INFO)
# Set default flags for the output directories
FLAGS = tf.app.flags.FLAGS
tf.app.fl... | 2.1875 | 2 |
pyopentsdb/put.py | mikecokina/pyopentsdb | 2 | 26039 | <reponame>mikecokina/pyopentsdb
from pyopentsdb.utils import request_post
from pyopentsdb import errors
def validate_put_data(data):
if isinstance(data, dict):
data = [data]
for d in data:
if not d.get('metric') or not d.get('timestamp') or not d.get('value') or not d.get('tags'):
... | 2.890625 | 3 |
preprocessing/twitterData.py | aldifahrezi/NLP_3A | 0 | 26040 | import re
import csv
import nltk
"""docstring for twitterClean"""
def __init__(self):
super(twitterClean, self).__init__()
def renameUser(corpus):
_new = []
for _temp in corpus:
_temp = re.sub( r'(^|[^@\w])@(\w{1,15})\b','',_temp)
_new.append(_temp)
retu... | 3.140625 | 3 |
wwwroot/cgi-bin/NetDict/format_conversion.py | fenshitianyue/WebDict | 1 | 26041 | <reponame>fenshitianyue/WebDict<gh_stars>1-10
#!/usr/bin/python
# -*- coding: utf-8 -*-
import pymysql
import sys
reload(sys)
sys.setdefaultencoding('utf8')
base = {}
def write_file():
fp = open("/home/zanda/Desktop/PythonCode/new_formatted_data", "w+")
for word, meaning in base.items():
fp.write(wor... | 2.859375 | 3 |
app/old/results_to_csv-mo.py | jpenney78/usabmx_results | 0 | 26042 | #!/usr/bin/env python
from bs4 import BeautifulSoup
import urllib2
import re
import sys
import collections
#with open('grands.html') as f:
# soup = BeautifulSoup(f, 'html.parser')
url = sys.argv[-1]
page = urllib2.urlopen(url)
soup = BeautifulSoup(page, 'html.parser')
groups = soup.findAll('h4', class_='race-resul... | 2.984375 | 3 |
bmcs_beam/mxn/scripts/__init__.py | bmcs-group/bmcs_beam | 1 | 26043 | '''
Created on Dec 18, 2016
@author: rch
'''
| 1.21875 | 1 |
upvote_post_comments_timebased.py | YuurinBee/steemrewarding | 13 | 26044 | from beem.utils import formatTimeString, resolve_authorperm, construct_authorperm, addTzInfo
from beem.nodelist import NodeList
from beem.comment import Comment
from beem import Steem
from beem.account import Account
from beem.instance import set_shared_steem_instance
from beem.blockchain import Blockchain
import time ... | 1.65625 | 2 |
main.py | Gaurav3009/SoftCoputingpROJECT | 0 | 26045 | <filename>main.py
import pygame
import random
import math
import numpy as np
from pygame import mixer
x = np.array(([723, 123.4000000000003], [121, 133.40000000000038], [586, 125.40000000000032]), dtype=float )
y = np.array(([99], [86], [89]), dtype=float )
# Scaled Units
x = x / np.amax ( x, axis=0 )
y = ... | 3.109375 | 3 |
include/fetchfile.py | dongniu/cadnano2 | 17 | 26046 | #!/usr/bin/env python
# encoding: utf-8
# The MIT License
#
# Copyright (c) 2011 Wyss Institute at Harvard University
#
# 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, i... | 2.140625 | 2 |
core/exception.py | simyy/flask_app | 0 | 26047 | <filename>core/exception.py
#!/usr/bin/env python
# coding=utf-8
class BaseException(Exception):
def __init__(self, code, msg):
self.code = code
self.msg = msg
def __str__(self):
return '<%s %s>' % (self.__class__.__name__, self.code)
| 2.71875 | 3 |
pyjs/tests/test-report.py | allbuttonspressed/pyjs | 1 | 26048 | <filename>pyjs/tests/test-report.py
#!/usr/bin/env python
import sys
import difflib
differ = difflib.HtmlDiff()
class Coverage:
def __init__(self, testset_name):
self.testset_name = testset_name
self.lines = {}
def tracer(self, frame, event, arg):
lineno = frame.f_lineno
fil... | 2.328125 | 2 |
datasets/pytorch_provider.py | ikhlestov/XNOR-Net | 13 | 26049 | <gh_stars>10-100
import torch
import torchvision
import torchvision.transforms as transforms
transform = transforms.Compose(
[transforms.ToTensor(),
transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))])
def get_loaders(batch_size):
trainset = torchvision.datasets.CIFAR10(
root='/tmp/cifar10'... | 2.359375 | 2 |
pymilvus_orm/__init__.py | PahudPlus/pymilvus-orm | 0 | 26050 | <filename>pymilvus_orm/__init__.py
# Copyright (C) 2019-2020 Zilliz. 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
#
# Unle... | 1.507813 | 2 |
test/python/test_preemptive.py | plandes/util | 0 | 26051 | from typing import Iterable, Any
import unittest
from zensols.persist import ReadOnlyStash, PreemptiveStash
class RangeStash(ReadOnlyStash):
def __init__(self, n: int, end: int = None):
super().__init__()
self.n = n
self.end = end
self.keyed = False
self.loaded = False
... | 2.78125 | 3 |
scripts/tokenize_corpora.py | Mrpatekful/Pytorch-MT | 7 | 26052 | <reponame>Mrpatekful/Pytorch-MT<gh_stars>1-10
"""
"""
import tqdm
import argparse
DEFAULT_INPUT = '/media/patrik/1EDB65B8599DD93E/data/eng/test'
DEFAULT_OUTPUT = '/media/patrik/1EDB65B8599DD93E/data/eng/test_tok'
DEFAULT_MIN = 3
DEFAULT_MAX = 60
def tokenize(word):
sub_words = []
sub_word = ''
for in... | 2.671875 | 3 |
linux/lib/python2.7/dist-packages/samba/tests/ntacls.py | nmercier/linux-cross-gcc | 3 | 26053 | <filename>linux/lib/python2.7/dist-packages/samba/tests/ntacls.py
# Unix SMB/CIFS implementation. Tests for ntacls manipulation
# Copyright (C) <NAME> <<EMAIL>> 2009-2010
# Copyright (C) <NAME> 2012
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public L... | 2.265625 | 2 |
data_filter_azure/data_filter_azure/documentdb_server.py | abhushansahu/contrib | 238 | 26054 | <filename>data_filter_azure/data_filter_azure/documentdb_server.py
#!/usr/bin/env python
import requests
import base64
import json
from flask import Flask,redirect, jsonify, abort, make_response, g
import config
from flask_bootstrap import Bootstrap
import azure.common
from data_filter_azure import opa
import azure.cos... | 2.171875 | 2 |
Database_Development/RunningSQLBackEnd/training.py | data-intelligence-analysis/dataworks_scripts | 3 | 26055 | from sqlite3 import connect
##<NAME>
def show_menu():
print("\n------")
print ("MENU:")
print ("_____")
print ("1. Add a student")
print ("2. Find a student")
print ("3. Add a course")
print ("4. Find a course")
print ("5. Enroll a student")
print ("6. Find Course(s) of a Student")
... | 4.0625 | 4 |
res_mods/mods/packages/xvm_battle/python/battleloading.py | peterbartha/ImmunoMod | 0 | 26056 | <reponame>peterbartha/ImmunoMod
""" XVM (c) www.modxvm.com 2013-2017 """
#####################################################################
# imports
import cgi
import re
import traceback
import BigWorld
from gui.Scaleform.daapi.view.battle.shared.battle_loading import BattleLoading
from xfw import *
from xvm_m... | 2.15625 | 2 |
CV1_assignment3/problem1_Loesung.py | cjy513203427/CV_Assignment | 0 | 26057 | import numpy as np
from scipy.ndimage import convolve, maximum_filter
def gauss2d(sigma, fsize):
""" Create a 2D Gaussian filter
Args:
sigma: width of the Gaussian filter
fsize: (w, h) dimensions of the filter
Returns:
*normalized* Gaussian filter as (h, w) np.array
"""
m,... | 3.34375 | 3 |
assignment2/comp411/classifiers/fc_net.py | kukalbriiwa7/COMP511_CS231n | 1 | 26058 | from builtins import range
from builtins import object
import numpy as np
from comp411.layers import *
from comp411.layer_utils import *
class ThreeLayerNet(object):
"""
A three-layer fully-connected neural network with Leaky ReLU nonlinearity and
softmax loss that uses a modular layer design. We assume ... | 3.640625 | 4 |
py/cloud_server_del.py | AlohaPoster/MyActilife_win | 0 | 26059 | import os
from socket import *
from time import ctime
HOST = ''
PORT = 9733
BUFSIZ = 1024
ADDR = (HOST, PORT)
tcpSerSock = socket(AF_INET, SOCK_STREAM)
tcpSerSock.bind(ADDR)
tcpSerSock.listen(32)
while True:
print('waiting for connection...')
tcpCliSock, addr = tcpSerSock.accept()
print ('... | 2.96875 | 3 |
setup.py | PureTryOut/pico-wizard | 11 | 26060 | # SPDX-FileCopyrightText: 2021 <NAME> <<EMAIL>>
#
# SPDX-License-Identifier: MIT
import setuptools
setuptools.setup(
name="pico-wizard",
version="0.1.0",
author="<NAME>",
author_email="<EMAIL>",
description="A Post Installation COnfiguration tool",
long_description="A Post Installation COnfigu... | 1.617188 | 2 |
modules/weather_forecast_manager.py | algon-320/tenki.py | 0 | 26061 | <reponame>algon-320/tenki.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os
import datetime
import pickle
import lxml.html
import urllib.request, urllib.error
import re
from modules.weather import Weather
from modules.print_util import String
class WeatherForecastManager:
PICKLE_DUMP_FILE = '... | 2.3125 | 2 |
app/fiftycents/entities/player.py | Cinquiom/fifty-cents-frontend | 0 | 26062 | <reponame>Cinquiom/fifty-cents-frontend
import math
from collections import Counter
from itertools import dropwhile
class NoCoinsRemainingError(Exception): pass
class CardNotInHandError(Exception): pass
class Player():
def __init__(self):
self.hand = []
self.played_cards = []
self.dow... | 3.125 | 3 |
day03.py | dylanbrodiefafard/aoc2019 | 0 | 26063 | <reponame>dylanbrodiefafard/aoc2019
from util import get_lines
def make_lines(path):
lines = []
previous_point = (0, 0)
for segment in path:
direction = segment[0]
distance = int(segment[1:])
if direction == 'U':
point = (previous_point[0], previous_point[1] + distance)... | 3.484375 | 3 |
ezflow/models/pwcnet.py | NeelayS/ezflow | 94 | 26064 | import torch
import torch.nn as nn
import torch.nn.functional as F
from ..decoder import ConvDecoder
from ..encoder import build_encoder
from ..modules import conv, deconv
from ..similarity import CorrelationLayer
from ..utils import warp
from .build import MODEL_REGISTRY
@MODEL_REGISTRY.register()
class PWCNet(nn.M... | 2.296875 | 2 |
setup.py | hackebrot/cibopath | 11 | 26065 | # -*- coding: utf-8 -*-
import pathlib
from setuptools import setup
def read(file_name):
file_path = pathlib.Path(__file__).parent / file_name
return file_path.read_text('utf-8')
setup(
name='cibopath',
version='0.1.0',
author='<NAME>',
author_email='<EMAIL>',
maintainer='<NAME>',
... | 1.648438 | 2 |
core/tests/test_models.py | maneeshbabu/recipe | 0 | 26066 | from django.test import TestCase
from django.contrib.auth import get_user_model
class ModelTestCase(TestCase):
def test_create_user_with_email_successful(self):
"""Test creating a new user with email is successful"""
email = "<EMAIL>"
password = "<PASSWORD>"
user = get_user_model... | 3.15625 | 3 |
CIF_Assembly_Entry_debug.py | cschlick/cif-assembly | 0 | 26067 | <reponame>cschlick/cif-assembly<filename>CIF_Assembly_Entry_debug.py
#!/usr/bin/env python
# coding: utf-8
from mmtbx.ncs.ncs import ncs
from phenix.programs import map_symmetry as map_symmetry_program
from cctbx.maptbx.segment_and_split_map import run_get_ncs_from_map
from iotbx import phil
from iotbx.data_manager im... | 1.820313 | 2 |
SanGuoSha/SGS-Official/assets/images/plotters.py | fyabc/GamesDiy | 0 | 26068 | # coding: utf-8
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.ticker as mticker
import numpy as np
def card_num_distribution():
"""Plot `Std-CardNumDistribution.png`."""
total = np.fromstring('12 14 12 12 13 12 12 12 12 12 12 14 12', sep=' ')
jb = np.fromstring('0 6 6 6 6 8 9 11 11 ... | 2.734375 | 3 |
tests/test_model/test_tasks/test_tuning.py | ak-gupta/nbaspa | 1 | 26069 | """Test hyperparameter tuning."""
import pytest
from nbaspa.model.tasks import (
LifelinesTuning,
SegmentData,
SurvivalData,
XGBoostTuning,
)
@pytest.fixture(scope="module")
def survivaldata(data):
"""Create survival data for the hyperparameter tuning."""
pre = SurvivalData()
df = pre.run... | 2.484375 | 2 |
trace_feature/models/simple_scenario.py | trace-features-bdd/trace_feature | 0 | 26070 | <filename>trace_feature/models/simple_scenario.py
from trace_feature.models.scenario import Scenario
class SimpleScenario(Scenario):
def __init__(self):
self.steps = []
self.scenario_title = ""
self.line = None
self.executed_methods = []
def execute(self):
pass
de... | 2.546875 | 3 |
EMLABPY/modules/makefinancialreports.py | TradeRES/toolbox-amiris-emlab | 0 | 26071 | from domain.import_object import *
from modules.defaultmodule import DefaultModule
from domain.financialReports import FinancialPowerPlantReport
from domain.powerplant import PowerPlant
from domain.cashflow import CashFlow
from domain.technologies import *
import logging
class CreatingFinancialReports(DefaultModule):
... | 2.28125 | 2 |
guess_number.py | redlinger/Guess_Number | 0 | 26072 | <filename>guess_number.py<gh_stars>0
# -*- coding: utf-8 -*-
"""
Guess a Number between 1 and 100
Setup: The computer generates a random number between 1 and 100. The human's
goal is to guess that number in 5 or fewer guesses.
"""
import random
import time
# human number guess
hum_num = 0
# 5 trys... | 4.0625 | 4 |
3_drop_additional_road_usages_measurements.py | IntroDS2017/SteamingPlayers | 0 | 26073 | import pandas as pd
def main():
load_path = "data/2_road_usages.csv"
save_path = "data/3_road_usages.csv"
df = pd.read_csv(load_path)
street_names = df.nimi.unique()
points_to_drop = []
for street in street_names:
points = df[df['nimi'] == street].piste.unique()
if len(poin... | 3.625 | 4 |
tests/application/files/parsers/test_dsv.py | alphagov-mirror/performanceplatform-admin | 1 | 26074 | # -*- coding: utf-8 -*-
from application.files.parsers.dsv import parse_csv, lines
from application.files.parsers import ParseError
import unittest
from cStringIO import StringIO
from hamcrest import assert_that, only_contains, is_, contains
class ParseCsvTestCase(unittest.TestCase):
def test_parse_csv(self):... | 2.921875 | 3 |
sdk/python/pulumi_azure/waf/policy.py | pulumi-bot/pulumi-azure | 0 | 26075 | # 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 json
import warnings
import pulumi
import pulumi.runtime
from typing import Union
from .. import utilities, tables
class Policy... | 1.664063 | 2 |
tests/test__file_importer.py | johnmdelgado/SRE-Project | 0 | 26076 | <gh_stars>0
#!/usr/bin/python3
'''
FileName: test__file_importer.py
Author: <NAME>
Created Date: 8/7/2020
Version: 1.0 Initial Development
This is the testing file for the file_importer script
'''
import os
import sys
import inspect
functions_dir = os.path.dirname(os.path.dirname(os.path.abspath(inspect.getfile(inspec... | 2.46875 | 2 |
ProjectEuler/p049.py | TISparta/competitive-programming-solutions | 1 | 26077 |
# Execution time : 0.440223 seconds
# Solution Explanation
# We can simplily iterate through all the 4-digits numbers
# Then generate all the permutation of this number and check
# if the desirable sequence, distinct from the given one, is found
import time
width = 40
import itertools
import math
def solution():
... | 3.140625 | 3 |
session7/Keypad.py | rezafari/raspberry | 19 | 26078 | <reponame>rezafari/raspberry
######################################################################
# Keypad.py
#
# This program read matrix keypad and print label of pressed button
######################################################################
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
... | 3.421875 | 3 |
apps.py | qcoumes/django-dummy-app | 0 | 26079 | <filename>apps.py
from django.apps import AppConfig
class DummyAppConfigConfig(AppConfig):
name = 'django_dummy_app'
| 1.359375 | 1 |
src/VulnSituation/DownloadLinuxKernel.py | LeoneChen/VulnSituation | 0 | 26080 | <reponame>LeoneChen/VulnSituation
# Author: 14281055 <NAME>
# File Name: DownloadLinuxKernel.py
import Repository
import random
import bs4
import os
import re
def download_certain_version_number_linux_kernel(hyperlink, save_dir):
content = Repository.requests_get_content(hyperlink, timeout=10,
... | 2.546875 | 3 |
v7/upgrade_metadata/upgrade_metadata.py | MattiooFR/plugins | 53 | 26081 | <gh_stars>10-100
# -*- coding: utf-8 -*-
# Copyright © 2014–2015, <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... | 1.554688 | 2 |
code/visualization/visualizer.py | JRMfer/GangRivalry | 0 | 26082 | <filename>code/visualization/visualizer.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This script contains functions to visualize the development of the statistics
over the total iterations per simulation and it contains functions to plot an
arbitrary graph and all the graphs generated by all the simulations ... | 3.453125 | 3 |
numpytorch/losses.py | Samyak2/numpytorch | 2 | 26083 | <reponame>Samyak2/numpytorch
import numpy as np
EPS = 1e-06
class Loss:
"""Generic class to define a loss function"""
def __init__(self):
pass
def __call__(self, y_real: np.ndarray, y_pred: np.ndarray) -> np.ndarray:
return self.forward(y_real, y_pred)
def forward(self, y_real: np.... | 3.359375 | 3 |
appengine/monorail/features/test/hotlistcreate_test.py | allaparthi/monorail | 2 | 26084 | # Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file or at
# https://developers.google.com/open-source/licenses/bsd
"""Unit test for Hotlist creation servlet."""
from __future__ import print_function
from __futu... | 1.992188 | 2 |
PocketBeagle/Grove/Start_the_Party.py | zhanglongqi/cloud9-examples | 37 | 26085 | #!/usr/bin/env python3
# -*- coding: UTF-8 -*-
# [Grove - 12 Key Capacitive I2C Touch Sensor V2]
# (http://wiki.seeedstudio.com/Grove-12_Key_Capacitive_I2C_Touch_Sensor_V2-MPR121/) on I2C2
# [Grove – Speaker](http://wiki.seeedstudio.com/Grove-Speaker/)
# on UART2
# [Grove - Chainable RGB LED X 2](http://wiki.seeedstud... | 2.875 | 3 |
host/rdmem.py | flowswitch/phison | 0 | 26086 | <reponame>flowswitch/phison<filename>host/rdmem.py
"""read XDATA memory"""
import sys
import PyScsi as drv
import Phison as ph
from util import BinFile
if len(sys.argv)!=4:
sys.exit("Read chip internal memory\nUsage: %s <file> <addr> <size>\nExample: %s ram.bin 0 0x10000" % (sys.argv[0], sys.argv[0]))
addr = int(sys... | 2.328125 | 2 |
zapper/context.py | alfuananzo/zapper | 1 | 26087 | <gh_stars>1-10
#TODO: Kill scans if overwrite is set.
from zapper.helpers import report_to_cli
class context:
def __init__(self, target, scope, api, force=False):
"""
Control one Context entry of ZAP. A context has the following properties:
Attributes:
target: The target of th... | 2.3125 | 2 |
src/280. Wiggle Sort.py | rajshrivastava/LeetCode | 1 | 26088 | class Solution:
def wiggleSort(self, nums: List[int]) -> None:
"""
Do not return anything, modify nums in-place instead.
"""
'''
[3,5,2,1,6,4]
[3,5,1,6,2,4]
[4,3,2,1]
[3,4,2,1]
[6,6,5,6,3,8]
'''
def is_correct_order(x, ... | 3.796875 | 4 |
absl/flags/tests/argparse_flags_test_helper.py | alexhagen/abseil-py | 1,969 | 26089 | <reponame>alexhagen/abseil-py
# Copyright 2018 The Abseil 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 a... | 2.703125 | 3 |
utf8.py | softarts/oj | 3 | 26090 | import glob, codecs
#configfiles = glob.glob(r'C:\Users\sam\Desktop\**\*.txt', recursive=True)
#fn="ojcpp/company/amazon_memo.txt"
for fn in glob.glob("ojcpp/company/*.cpp",recursive=True):
print(fn)
ret=True
try:
data = open(fn, "r", encoding="gbk").read()
open(fn, "w", encoding... | 2.671875 | 3 |
setup.py | Emrys-Merlin/monitor_airquality | 0 | 26091 | <reponame>Emrys-Merlin/monitor_airquality<filename>setup.py
from importlib.metadata import entry_points
from setuptools import find_packages, setup
setup(
name='monitor_airquality',
version='0.1',
url='',
author='<NAME>',
author_email='<EMAIL>',
description='Measure airquality using some senso... | 1.34375 | 1 |
os_migrate/plugins/module_utils/reference.py | mrnold/os-migrate | 0 | 26092 | <reponame>mrnold/os-migrate
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
def network_name(conn, id_, required=True):
"""Fetch name of Network identified by ID `id_`. Use OpenStack
SDK connection `conn` to fetch the info. If `required`, ensure the
fetch is success... | 2.390625 | 2 |
Task1E.py | dan7267/1a-flood-risk-project-93 | 0 | 26093 | <reponame>dan7267/1a-flood-risk-project-93
from floodsystem.stationdata import MonitoringStation
from floodsystem.geo import rivers_by_station_number
def run():
"""Requirements for Task1E"""
rivers_station_number = rivers_by_station_number(MonitoringStation, 9)
print(rivers_station_number)
if __name__ ==... | 2.640625 | 3 |
test/test_util.py | konfiger/konfiger-python | 4 | 26094 | <filename>test/test_util.py<gh_stars>1-10
#!python
import unittest
import os
import sys
sys.path.insert(0, os.getcwd())
from src import escape_string, un_escape_string
class TestKonfigerUtil(unittest.TestCase):
def test_check_escape_and_unescape_separator(self):
actual_str = "\\,Hello¬W\n-... | 3.109375 | 3 |
src/insulaudit/devices/clmm/proto.py | kakoni/insulaudit | 1 | 26095 | <filename>src/insulaudit/devices/clmm/proto.py
import struct
import sys
import serial
import time
import logging
from pprint import pprint, pformat
import doctest
from insulaudit.core import Command
from insulaudit.clmm.usbstick import *
from insulaudit import lib
#logging.basicConfig( stream=sys.stdout )
log = loggi... | 2.28125 | 2 |
examples/interrupts.py | nodesign/electripy | 3 | 26096 | <reponame>nodesign/electripy
from lib.electripy import *
print "Board name : ", getBoardName()
print "INTERRUPTS TEST **************************"
def hello(data):
print "interrupt ", INTERRUPT_TYPE[data]
attachInterrupt(25, CHANGE, hello)
for a in range(0,15):
delay(1000)
print a
detachInterrupt(2... | 2.75 | 3 |
Contents/Code/interface/menu.py | tomerblecher/Sub-Zero.bundle | 2 | 26097 | # coding=utf-8
import locale
import logging
import os
import platform
import traceback
import logger
import copy
from requests import HTTPError
from item_details import ItemDetailsMenu
from refresh_item import RefreshItem
from menu_helpers import add_incl_excl_options, dig_tree, set_refresh_menu_state, \
default_... | 2.078125 | 2 |
gsicrawler_pipeline.py | antoniofll/sefarad4.0-testing | 0 | 26098 | <reponame>antoniofll/sefarad4.0-testing<filename>gsicrawler_pipeline.py<gh_stars>0
import luigi
from luigi import configuration
from luigi.s3 import S3Target, S3PathTask
import threading
from time import sleep
import os
import json
import imp
import random
import datetime
import uuid
from bottle import route, run, tem... | 2.1875 | 2 |
farnsworth/peewee_extensions.py | mechaphish/farnsworth | 6 | 26099 | <gh_stars>1-10
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from peewee import Field, SQL
import itertools
"""Extend Peewee basic types."""
class EnumField(Field):
"""Define a EnumField type"""
db_field = "enum"
def __init__(self, *args, **kw... | 2.5625 | 3 |