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 |
|---|---|---|---|---|---|---|
src/ensae_teaching_cs/homeblog/filename_helper.py | Jerome-maker/ensae_teaching_cs | 73 | 12797651 | <filename>src/ensae_teaching_cs/homeblog/filename_helper.py
"""
@file
@brief Helpers around file names.
"""
import os
import re
from pyquickhelper.loghelper import noLOG
from pyquickhelper.filehelper import explore_folder
def get_file_per_folder(folder, deep=1):
"""
extract all folders in a folder and then al... | 2.953125 | 3 |
ifpd2/asserts.py | ggirelli/ifpd2 | 1 | 12797652 | """
@author: <NAME>
@contact: <EMAIL>
"""
import logging
import numpy as np # type: ignore
import sys
from typing import Callable
def ert_type(x, stype, label):
if not isinstance(x, stype):
raise AssertionError(f"{label} should be {stype}, {type(x)} instead")
def ert_multiTypes(x, types, label):
c... | 2.8125 | 3 |
common.py | lamhoangtung/densenet121-quickdraw-doodle-recognition-challenge | 3 | 12797653 | import ast
import os
import cv2
import numpy as np
import pandas as pd
import tensorflow as tf
from tensorflow import keras
from keras.applications.densenet import preprocess_input
from keras.metrics import (categorical_accuracy, top_k_categorical_accuracy)
from keras.models import Model, load_model
DP_DIR = './input... | 2.328125 | 2 |
misc/zip/Cura-master/cura/Machines/Models/QualityManagementModel.py | criscola/G-Gen | 1 | 12797654 | # Copyright (c) 2018 <NAME>.
# Cura is released under the terms of the LGPLv3 or higher.
from PyQt5.QtCore import Qt, pyqtSlot
from UM.Qt.ListModel import ListModel
from UM.Logger import Logger
#
# This the QML model for the quality management page.
#
class QualityManagementModel(ListModel):
NameRole = Qt.UserRo... | 2 | 2 |
BCI/BCI/SFS.py | RichardLeeK/BCI | 4 | 12797655 | <gh_stars>1-10
# Sequential Forward Selection
import warnings
import numpy as np
from sklearn.utils import check_X_y, safe_sqr
from sklearn.utils.metaestimators import if_delegate_has_method
from sklearn.base import BaseEstimator
from sklearn.base import MetaEstimatorMixin
from sklearn.base import clone
from sklearn.ba... | 3.21875 | 3 |
app/app/util/csv_transformer.py | Oblo-cit-sci/Oblo-backend | 0 | 12797656 | <gh_stars>0
from csv import DictWriter
from datetime import datetime
from typing import List
from app.models.orm import Entry
from app.util.consts import TYPE, NAME, TERMINAL_ASPECT_TYPES, VALUE
regular_entry_base_meta_columns = [
"uuid",
"creation_ts",
"domain",
"template",
"template_version",
... | 2.5 | 2 |
notification-api/modules/app/controllers/user.py | ibrahim-sakr/swvl_notifications | 1 | 12797657 | <filename>notification-api/modules/app/controllers/user.py
import os
from flask import request, jsonify
from app import app, mongo
import datetime
import random
import string
@app.route('/users', methods=['GET'])
def usersIndex():
data = list(mongo.db.users.find())
return jsonify({'result': data}), 200
@app.r... | 2.84375 | 3 |
logcausality/config.py | cpflat/LogCausalAnalysis | 20 | 12797658 | #!/usr/bin/env python
# coding: utf-8
import sys
import os
import datetime
import logging
import collections
import ConfigParser
DEFAULT_CONFIG_NAME = "/".join((os.path.dirname(__file__),
"config.conf.default"))
LOGGER_NAME = __name__.rpartition(".")[-1]
_logger = logging.getLogger(LOGGER_NAME)
_ch = logging.... | 2.40625 | 2 |
Torrent Checker/Torrent_ip_checker.py | Utkarsh1308/FunUtils | 48 | 12797659 | #!/usr/bin/python
import Tkinter
import ctypes
import tkMessageBox
import socket
import sys
import urllib2
import httplib
from bs4 import BeautifulSoup as BS
class window(Tkinter.Tk):
Ip_text = ''
def __init__(self,parent):
Tkinter.Tk.__init__(self,parent)
self.parent = parent
self.iconbitmap(default='eye.ico')... | 2.90625 | 3 |
data_visualization/api_blueprint/views.py | danielrenes/car-data-visualization | 0 | 12797660 | <gh_stars>0
import json
from flask import g, url_for, jsonify, abort, request
from sqlalchemy.exc import IntegrityError
from . import api
from .. import db
from ..models import ViewWrapper, View, Subview
from ..queries import query_all_views, query_get_view_by_id, query_get_sensor_by_name
@api.route('/views', method... | 2.28125 | 2 |
app.py | Dkadariya/SBN_pos_server | 0 | 12797661 | <reponame>Dkadariya/SBN_pos_server
from flask import Flask, jsonify, request
from flask_restful import Resource, Api
from flask_cors import CORS
from fileIO import commit_file
# importing methods from SQL handler module for CRUD operations
from sql_handler import get_item, insert_item, remove_item, sell_item, list_ite... | 2.359375 | 2 |
bitbots_vision/src/bitbots_vision/dynamic_color_space.py | MosHumanoid/bitbots_vision | 3 | 12797662 | <filename>bitbots_vision/src/bitbots_vision/dynamic_color_space.py
#! /usr/bin/env python3
import cv2
import yaml
import rospy
import rospkg
import numpy as np
from cv_bridge import CvBridge
from collections import deque
from sensor_msgs.msg import Image
from bitbots_msgs.msg import ColorSpace, Config
from bitbots_vis... | 2.5 | 2 |
setup.py | RuyiLi/pituo | 0 | 12797663 | <reponame>RuyiLi/pituo
from setuptools import setup
with open('README.md') as f:
long_description = f.read()
setup(
name='pituo',
packages=['pituo'],
version='0.0.2',
license='MIT',
description='Go-styled errors in Python.',
long_description=long_description,
long_description_content_t... | 1.453125 | 1 |
btk20_src/lib/pykaldiarkio.py | musiclvme/distant_speech_recognition | 136 | 12797664 | <reponame>musiclvme/distant_speech_recognition<filename>btk20_src/lib/pykaldiarkio.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# MIT License
#
# Copyright (c) 2018 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "... | 1.820313 | 2 |
tests/lib/result_reporters/pyne_stat_summary_reporter_test.py | Avvir/pyne | 4 | 12797665 | <reponame>Avvir/pyne
from pynetest.expectations import expect
from pynetest.lib.result_reporters.printing_reporter import PrintingReporter
from pynetest.lib.result_reporters.pyne_result_reporters import PyneStatSummaryReporter
from pynetest.lib.pyne_test_blocks import ItBlock, DescribeBlock
from tests.test_helpers.fake... | 2.375 | 2 |
raypipe/core/rpipe/callback.py | billyyann/RayPipe | 0 | 12797666 | <reponame>billyyann/RayPipe<filename>raypipe/core/rpipe/callback.py
import os
from tensorflow.python.keras.callbacks import Callback, ModelCheckpoint
import ray.train as train
import zipfile
from raypipe import logger
from raypipe.core.distribution import object_store_impl
from raypipe.core.distribution.object_store ... | 2.140625 | 2 |
setup.py | jonspock/vdf-competition | 97 | 12797667 | <filename>setup.py
#!/usr/bin/env python
from setuptools import setup
from inkfish.version import version
setup(
name="inkfish",
version=version,
packages=[
"inkfish",
],
author="<NAME>, Inc.",
entry_points={
'console_scripts':
[
'pot = inkfish.cmds... | 1.25 | 1 |
tests/test_git_history.py | mthurman/git-history | 92 | 12797668 | from click.testing import CliRunner
from git_history.cli import cli
from git_history.utils import RESERVED
import itertools
import json
import pytest
import subprocess
import sqlite_utils
import textwrap
git_commit = [
"git",
"-c",
"user.name='Tests'",
"-c",
"user.email='<EMAIL>'",
"commit",
]
... | 2.015625 | 2 |
Config/HEADERS.py | solider245/Requests_Html_Spider | 10 | 12797669 | <reponame>solider245/Requests_Html_Spider
#!/usr/bin/env python
# encoding: utf-8
"""
@version: v1.0
@author: W_H_J
@license: Apache Licence
@contact: <EMAIL>
@software: PyCharm
@file: HEADERS.py
@time: 2018/9/26 17:31
@describe: 请求头集合--爬虫请求头信息在此配置
'User-Agent': '%s' % UserAgent.pc_agent() 启用轮换浏览器请求头
"""
i... | 1.84375 | 2 |
vcflat/tests/test_HeaderExtraction/test_pop_header.py | arontommi/VCFlat | 4 | 12797670 | <reponame>arontommi/VCFlat
import os
from vcflat.HeaderExtraction import VcfHeader, pop_header
def get_input():
test_data_dir = os.path.join(os.path.dirname(__file__), "..", "test_data")
i = os.path.join(test_data_dir, "test.snpeff.vcf")
return i
def get_no_chrom():
i = get_input()
vch = VcfHead... | 2.40625 | 2 |
learn_cedev/book/models.py | atthana/django_cedev | 0 | 12797671 | <gh_stars>0
from django.db import models
from django.utils.html import format_html
BOOK_LEVEL_CHOICE = ( # โชว์ชุดหลัง แต่เซฟด้วยชุดหน้า เช่น โชว์ Basic แต่เซฟด้วย B นะ
('B', 'Basic'),
('M', 'Medium'),
('A', 'Advance'),
)
class Category(models.Model):
name = models.CharField(max_length=100)
clas... | 2.40625 | 2 |
generate_dataset.py | birnbaum/racist-comment-generator | 2 | 12797672 | import mysql.connector
import progressbar
import argparse
import yaml
import re
import collections
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--out', type=str, default='data/racist/racist.txt',
help='text file where the data is written to')
args = parser.pa... | 2.71875 | 3 |
backend/logger/migrations/0003_requestlogger_sha1.py | AstroMatt/esa-subjective-time-perception | 1 | 12797673 | <gh_stars>1-10
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-09-15 12:47
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('logger', '0002_auto_20161231_1740'),
]
operations = [
migrat... | 1.65625 | 2 |
experiments/models/mnist_torch_models.py | VKCOM/TopicsDataset | 1 | 12797674 | <filename>experiments/models/mnist_torch_models.py
import torch
import torch.nn as nn
import torch.nn.functional as F
N_CLASSES = 10
mnist_input_shape = (28, 28, 1)
class MnistModel(nn.Module):
def __init__(self):
super().__init__()
self.conv_1 = nn.Conv2d(1, 32, 3, 1)
self.conv_2 = nn.C... | 3.328125 | 3 |
csv2xlsx.py | dorbarker/csv2xlsx | 4 | 12797675 | import os
import glob
import csv
import argparse
from xlsxwriter.workbook import Workbook
def arguments():
parser = argparse.ArgumentParser()
parser.add_argument('path', default = os.getcwd(), help = "Path to CSV files")
parser.add_argument('--outname', default = None, help = "Name of output XLSX file")
... | 3.265625 | 3 |
openstack_dashboard/dashboards/identity/signups/panel.py | sreenathmmenon/astttproject | 0 | 12797676 | from django.utils.translation import ugettext_lazy as _
import horizon
from openstack_dashboard.local.local_settings import SIGNUP_ROLES, OPENSTACK_API_VERSIONS
from openstack_dashboard.dashboards.identity.signups.common import get_admin_ksclient
class Signups(horizon.Panel):
name = _("Signups")
slug = 'signu... | 1.976563 | 2 |
lesson5/times_table_challenge.py | chrisglencross/python-lessons | 1 | 12797677 | <filename>lesson5/times_table_challenge.py
import random
import time
def input_number(prompt):
while True:
try:
print(prompt)
number=int(input("> "))
break
except ValueError:
print("Oops! That wasn't a valid number. Try again.")
return number
def... | 4.09375 | 4 |
reviews/mixins.py | moshthepitt/answers | 6 | 12797678 | <reponame>moshthepitt/answers
from django.shortcuts import redirect
from django.contrib import messages
from django.utils.translation import ugettext as _
from answers.models import Answer
class ReviewMixin(object):
"""
Control who can take a review
"""
def dispatch(self, *args, **kwargs):
... | 2.28125 | 2 |
gamecam/pyrcolate.py | SpooksMcGoose/gamecam | 0 | 12797679 | <reponame>SpooksMcGoose/gamecam<gh_stars>0
import json
import operator
import os
import shutil
import string
import sys
import time
import cv2
import piexif
import numpy as np
from sklearn.cluster import KMeans
from datetime import datetime as dt, timedelta as td
from matplotlib import pyplot as plt
from matplotlib.... | 2.203125 | 2 |
SCODE-R/mrr.py | rizwan09/REDCODER | 22 | 12797680 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
# Adapted from https://github.com/microsoft/CodeXGLUE/blob/main/Text-Code/NL-code-search-Adv/evaluator/evaluator.py
import logging
import sys, json
import numpy as np
def read_answers(filename):
answers = {}
with open(filename) as f:
... | 2.765625 | 3 |
src/py_profiler/long_adder.py | andy1xx8/py-profiler | 3 | 12797681 | import threading
#
# @author andy
#
class LongAdder:
def __init__(self):
self._lock = threading.Lock()
self._value = 0
def get_value(self):
return self._value
def increment(self):
with self._lock:
self._value += 1
def decrement(self):
with self._lo... | 3.09375 | 3 |
app/__init__.py | bjrnwnklr/random-poetry | 0 | 12797682 | <filename>app/__init__.py
from flask import Flask
from config import Config
from randompoetry import PoemFormRegistry, CorpusRegistry
app = Flask(__name__)
app.config.from_object(Config)
pfr = PoemFormRegistry.from_json('poemforms.json')
cr = CorpusRegistry()
# this has to be at the bottom to avoid circular referenc... | 1.992188 | 2 |
gazebo/0810_robot.py | shmpwk/robot_assembler | 0 | 12797683 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import rospy
import actionlib
import math
from trajectory_msgs.msg import JointTrajectry
from trajectry_msgs.msg import JointTrajectoryPoint
from control_msgs.msg import JointTrajectory
from sensor_msgs.msg import LaserScan
i=0
def callback(msg):
rospy.loginfo('min ... | 2.109375 | 2 |
lcof/33-er-cha-sou-suo-shu-de-hou-xu-bian-li-xu-lie-lcof.py | yuenliou/leetcode | 0 | 12797684 | #!/usr/local/bin/python3.7
# -*- coding: utf-8 -*-
from typing import List
class Solution:
def verifyPostorder(self, postorder: List[int]) -> bool:
"""剑指Offer:判断有点繁琐"""
length = len(postorder)
if length <= 0: return True
root = postorder[length - 1]
#左子树小于跟节点,已经保证
l... | 3.671875 | 4 |
tests/steps.py | Django-Stack-Backend/Django-backend-React-frontend | 1 | 12797685 | import json
from datetime import datetime
from django.db.models import Model
from jsonpath_ng import parse
from rdflib import Graph, URIRef
from safetydance import step_data
from safetydance_django.steps import ( # noqa: F401
http_client,
http_response,
json_values_match,
)
from safetydance_django.test im... | 2.125 | 2 |
app/entity/service.py | conatel-i-d/flask-blueprint | 0 | 12797686 | <gh_stars>0
from app.utils.base_service import BaseService
from .model import Entity
from .interfaces import EntityInterfaces
class EntityService(BaseService):
model = Entity
interfaces = EntityInterfaces
| 1.460938 | 1 |
apps/paypal/urls.py | youssriaboelseod/pyerp | 115 | 12797687 | # Django Library
from django.urls import path
# Localfolder Library
from .views.paypal_config import UpdatePaypalConfigView
# http://www.secnot.com/django-shop-paypal-rest-1.html
app_name = 'paypal'
urlpatterns = [
path('paypal-config/<int:pk>', UpdatePaypalConfigView.as_view(), name='paypal-config'),
]
| 1.8125 | 2 |
uscisstatus/__init__.py | meauxt/uscisstatus | 2 | 12797688 | <filename>uscisstatus/__init__.py
from lxml import html
import re
import requests
from datetime import datetime
CASE_DATE_PATTERN = r"[(A-Za-z)]*\s[\d]*,\s[\d]*"
URL = "https://egov.uscis.gov/casestatus/mycasestatus.do"
APP_RECEIPT_NUM = "appReceiptNum"
INIT_CASE_SEARCH = "initCaseSearch"
CASE_STATUS = "CHECK STATUS"
... | 2.875 | 3 |
src/Scene.py | rookies/dmx | 0 | 12797689 | <reponame>rookies/dmx
#!/usr/bin/python3
import logging
import xml.etree.ElementTree as ET
from Exceptions import SceneFileException
import SceneCommands
class Scene(object):
metaData = {}
commands = {}
def fromFile(self, f):
## Parse XML ##
logging.info("Reading from scene file `%s'.", f)
tree = ET.parse(f... | 2.6875 | 3 |
snakemake/report/__init__.py | CIMAC-CIDC/cidc-snakemake | 0 | 12797690 | __author__ = "<NAME>"
__copyright__ = "Copyright 2015, <NAME>"
__email__ = "<EMAIL>"
__license__ = "MIT"
import os
import sys
import mimetypes
import base64
import textwrap
import datetime
import io
import uuid
import json
import time
import shutil
import subprocess as sp
import itertools
from collections import named... | 2.1875 | 2 |
main.py | bjtuer-math/GSMBCD | 0 | 12797691 | <gh_stars>0
import pickle
with open('argfile','r') as f:
data=pickle.load(f)
#data[0].u_rules=['stochastic_lb','Lb','stochastic_lb_double']
data[0].u_rules=['Lb-NN_refined_sto_double','Lb-NN_refined','Lb-NN_refined_sto']
data[0].s_rules=['GS','Random','all']
#data[0].u_rules=['Lb-NN_refined_sto']
#data[0].s_rule... | 1.984375 | 2 |
utils.py | i0Ek3/libloss | 0 | 12797692 | <filename>utils.py
#!/usr/bin/env python
# coding=utf-8
import numpy as np
def validate(x, y):
if np.shape(x) != np.shape(y):
return False
else:
if x.any() == y.any():
print("----")
return True
else:
print("++++")
return False
| 2.953125 | 3 |
upload_app.py | nprapps/inauguration | 0 | 12797693 | #!/usr/bin/env python
import os
import re
from flask import Flask, redirect
from tumblpy import Tumblpy
import app_config
app = Flask(app_config.PROJECT_NAME)
app.config['PROPAGATE_EXCEPTIONS'] = True
@app.route('/dear-mr-president/', methods=['POST'])
def _post_to_tumblr():
"""
Handles the POST to Tumblr... | 3.203125 | 3 |
src/Echo_Chamber/main.py | kms70847/Animation | 17 | 12797694 | from math import sqrt
#Courtesy of Aran-Fey https://chat.stackoverflow.com/transcript/message/47258396#47258396
def circle_octant(r):
r2 = r ** 2
y = 0
while y <= r:
x = sqrt(r2 - y**2)
if x-int(x) >= 0.5:
x += 1
else:
# If we moved left, find o... | 3.90625 | 4 |
examples/python/cpu/scalars/scalar_cast_01.py | kant/ocean-tensor-package | 27 | 12797695 | import pyOcean_cpu as ocean
s = ocean.cdouble(3+4j)
print(s)
print(s.asPython())
print(s.imag.asPython())
print(s.real.asPython())
print(int(s.real))
print(float(s.real))
| 2.296875 | 2 |
app/__init__.py | thomasbhatia/kigata | 1 | 12797696 | from . import factory
def create_app(settings_override=None):
# Returns the app API application instance
app = factory.create_app(__name__, __path__, settings_override)
return app
| 1.8125 | 2 |
example/hello_fastapi.py | ifplusor/ahserver | 1 | 12797697 | <filename>example/hello_fastapi.py
# encoding=utf-8
if __name__ == "__main__":
import asyncio
import os
import uvloop
from ahserver.application.asgi import server
# 设置 uvloop
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
# 启动服务
server(
__file__ + ":app",
por... | 2.65625 | 3 |
aoc_wim/aoc2018/q19.py | wimglenn/advent-of-code-wim | 20 | 12797698 | <filename>aoc_wim/aoc2018/q19.py
"""
--- Day 19: Go With The Flow ---
https://adventofcode.com/2018/day/19
"""
import math
from aocd import data
from aoc_wim.aoc2018.q16 import all_ops
def parsed(data):
lines = data.splitlines()
ip = int(lines.pop(0).split()[1])
lines = [s.split() for s in lines]
line... | 3.21875 | 3 |
game/migrations/0001_initial.py | vinsmokemau/ProyectoLoteria | 0 | 12797699 | # Generated by Django 2.2.4 on 2019-09-11 03:40
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('deck', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Boar... | 1.882813 | 2 |
BasicRead.py | Seeed-Studio/seeed-ardupy-si114x | 0 | 12797700 | <filename>BasicRead.py<gh_stars>0
from arduino import grove_si114x
import time
SI1145 = grove_si114x()
while True:
print('Visible %03d UV %.2f IR %03d' % (SI1145.Visible , SI1145.UV/100 , SI1145.IR),end=" ")
print('\r', end='')
time.sleep(0.5)
| 2.578125 | 3 |
tests/integ_time.py | mp-extras/vl53l5cx | 2 | 12797701 | <gh_stars>1-10
# MicroPython
from machine import lightsleep, Pin
from time import sleep, ticks_ms
from esp32 import wake_on_ext1, WAKEUP_ALL_LOW
from sensor import make_sensor
from vl53l5cx import DATA_TARGET_STATUS, DATA_DISTANCE_MM, POWER_MODE_WAKEUP
from vl53l5cx import RESOLUTION_4X4, RANGING_MODE_AUTONOMOUS, PO... | 2.578125 | 3 |
glucosetracker/settings/production.py | arhanair/glucose-tracker-monitor | 134 | 12797702 | from .base import *
DEBUG = False
TEMPLATE_DEBUG = DEBUG
# Use the cached template loader so template is compiled once and read from
# memory instead of reading from disk on each load.
TEMPLATE_LOADERS = (
('django.template.loaders.cached.Loader', (
'django.template.loaders.filesystem.Loader',
'd... | 1.703125 | 2 |
scripts/test_vlm_1.py | Xero64/pyvlm | 2 | 12797703 | #%% Load Dependencies
from math import pi
from IPython.display import display
from pyvlm import LatticeResult, LatticeOptimum
from pyvlm import latticesystem_from_json
from pyvlm.tools import elliptical_lift_force_distribution
#%% Create Lattice System
jsonfilepath = '../files/Straight_Wing_Cosine_100.json'
lsys = lat... | 2.515625 | 3 |
avaloq/avaloq/urls.py | Tankiolegend/AvaloqCodingWebsite | 0 | 12797704 | from django.contrib import admin
from django.urls import path, include
from avaloq_app import views
urlpatterns = [
path('', views.review, name='review'),
path('avaloq/', include('avaloq_app.urls')),
path('admin/', admin.site.urls),
path('accounts/', include('registration.backends.default.urls')),
]
ha... | 1.625 | 2 |
main.py | Manoj-Paramsetti/auto-meeting-launcher | 4 | 12797705 | import os
import re
import sys
import webbrowser
import yaml
import pyautogui
import tkinter
file = __file__[:-7]
meetings = {"meetings": []}
def more_option(opt):
os.system("cls || clear")
# Add
if opt == 1:
print(" Give alias for your meeting")
alias = input(" [User] >>> ")
... | 3.0625 | 3 |
morph_net/framework/output_non_passthrough_op_handler.py | MohammadChalaki/morph-net | 1,061 | 12797706 | <gh_stars>1000+
"""OpHandler for OutputNonPassthrough ops.
OutputNonPassthrough ops take their regularizer from the output and do not
passthrough the regularizer to their input. This is the default OpHandler for
ops like Conv2D and MatMul when L1-gamma regularization is used.
"""
from __future__ import absolute_impor... | 2.296875 | 2 |
cogs/chess.py | adgj-1/cs221bot | 0 | 12797707 | <reponame>adgj-1/cs221bot<gh_stars>0
from discord.ext import commands
POS = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7}
class Chess(commands.Cog, name="chess test"):
board = []
w = 8
h = 8
turn = False
def __init__(self, bot):
self.bot = bot
@commands.command(n... | 3.09375 | 3 |
tests/test_components_eta_hms.py | Robpol86/etaprogress | 13 | 12797708 | <filename>tests/test_components_eta_hms.py
from etaprogress.components.eta_conversions import eta_hms
def test():
assert '00' == eta_hms(0)
assert '09' == eta_hms(9)
assert '59' == eta_hms(59)
assert '01:00' == eta_hms(60)
assert '01:01' == eta_hms(61)
assert '59:59' == eta_hms(3599)
ass... | 2.171875 | 2 |
code/visualization/display_metric_vs_epochs_plot.py | mrbarbasa/kaggle-spooky-author | 1 | 12797709 | import matplotlib.pyplot as plt
def display_metric_vs_epochs_plot(scores, metric, nth_iter, nth_fold):
"""Display a metric vs. epochs plot.
Both the training and validation scores will be plotted for the
chosen metric.
Parameters
----------
scores : pandas.DataFrame
Scores containing ... | 3.703125 | 4 |
core/src/trezor/messages/StellarPaymentOp.py | Kayuii/trezor-crypto | 0 | 12797710 | # Automatically generated by pb2py
# fmt: off
import protobuf as p
from .StellarAssetType import StellarAssetType
class StellarPaymentOp(p.MessageType):
MESSAGE_WIRE_TYPE = 211
def __init__(
self,
source_account: str = None,
destination_account: str = None,
asset: StellarAsse... | 2.09375 | 2 |
1101-1200/1125-Smallest Sufficient Team/1125-Smallest Sufficient Team.py | jiadaizhao/LeetCode | 49 | 12797711 | <gh_stars>10-100
class Solution:
def smallestSufficientTeam(self, req_skills: List[str], people: List[List[str]]) -> List[int]:
table = {skill : (1 << i) for i, skill in enumerate(req_skills)}
dp = {0 : []}
for i, p in enumerate(people):
curr = 0
for s in p:
... | 2.84375 | 3 |
2016/starter.py | iKevinY/advent | 11 | 12797712 | import os # NOQA
import sys # NOQA
import re # NOQA
import math # NOQA
import fileinput
from collections import Counter, deque, namedtuple # NOQA
from itertools import count, product, permutations, combinations, combinations_with_replacement # NOQA
from utils import parse_line, mul, factors, memoize, primes, new... | 3.046875 | 3 |
STN.py | newrotik/pySTN | 4 | 12797713 | <gh_stars>1-10
__author__ = 'robin'
"""
Implementation of a scheduling system based on the STN model. The data of the problem is
in the __init__() method, and can be changed. Additional constraints can be included as functions
that return cvx.Constraints, and added in the STN.construst_nominal_model() method.
We pack ... | 2.609375 | 3 |
ex036.py | AleLucasG/Estudos-Python-I | 0 | 12797714 | <reponame>AleLucasG/Estudos-Python-I
"""APROVANDO EMPRESTIMO PARA COMPRA DE UMA CASA.
- VALOR DO EMPRESTIMO: 80000.00;
- SALARIO EMPREGADO: 1.600;
- ANOS DE FINANCIAMENTO: 7 ANOS;
-
"""
| 1.476563 | 1 |
6th_semester/NumMethods/course_project/cp.py | mehakun/Labs | 3 | 12797715 | <reponame>mehakun/Labs
import numpy as np
import math
from scipy.stats import truncnorm
from time import time
from tabulate import tabulate
def simpson(interval, f, h):
a, b = interval
n = int((b - a) / h + 1)
first_part = 4 * np.sum([f(a + i * h) for i in range(1, n, 2)])
second_part = 2 * np.sum([f(... | 2.5 | 2 |
tests/test_hash_writer.py | terlar/ion-hash-python | 9 | 12797716 | <filename>tests/test_hash_writer.py<gh_stars>1-10
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License").
# You may not use this file except in compliance with the License.
# A copy of the License is located at
#
# http://www.... | 2.515625 | 3 |
pretraining_advCL.py | LijieFan/AdvCL | 22 | 12797717 | from __future__ import print_function
import argparse
import numpy as np
import os, csv
from dataset import CIFAR10IndexPseudoLabelEnsemble
import pickle
import torch
import torch.nn as nn
import torch.nn.functional as F
import torchvision.transforms as transforms
import torch.utils.data as Data
import torch.backends.... | 2.125 | 2 |
Utils/saveFigure.py | LeonardoFagundesJr/iAuRoRA | 0 | 12797718 | <gh_stars>0
#---
# Save Figure:
def saveFig_old(fig,nameFig):
# ------- the name must contain the figure format:
# e.g., nameFig = 'Position.png' or nameFig = 'linearVelocity.eps'
import os
nameFig = os.path.join("/content/Figures/",nameFig)
fig.savefig(nameFig, dpi=300, bbox_inches='tight')
... | 2.53125 | 3 |
mkMeteoF/libera5.py | YannChemin/LINGRA_RS | 0 | 12797719 | <gh_stars>0
import netCDF4
import cdsapi
import numpy as np
import matplotlib.pyplot as plt
def download_ERA5_bbox(i_year, out_dir, prefix, north, west, south, east):
c = cdsapi.Client()
c.retrieve(
'reanalysis-era5-single-levels',
{
'product_type': 'reanalysis',
'varia... | 2.15625 | 2 |
currency_calculator/__init__.py | jie17/PyCurrency | 1 | 12797720 | from .PyCurrency import get, convert | 1.085938 | 1 |
text_classification/train.py | Ronalmoo/nlp_with_torch | 0 | 12797721 | <reponame>Ronalmoo/nlp_with_torch
import argparse
import torch
import torch.nn as nn
import torch.optim as optim
from pathlib import Path
from tqdm import tqdm
from torch.nn.utils import clip_grad_norm_
from torch.optim.lr_scheduler import ReduceLROnPlateau
from torch.utils.tensorboard import SummaryWriter
from data_lo... | 1.242188 | 1 |
07-handy-haversacks/solution.py | johntelforduk/advent-of-code-2020 | 1 | 12797722 | <filename>07-handy-haversacks/solution.py
# Solution to day 7 of AOC 2020, <NAME>.
# https://adventofcode.com/2020/day/7
import sys
VERBOSE = ('-v' in sys.argv)
filename = sys.argv[1]
def search_for_shiny_gold(root: str) -> int:
"""Search a tree of bags. Return the number of shiny gold bags it contains."""
... | 3.765625 | 4 |
diventi/tooltips/__init__.py | flavoi/diven | 2 | 12797723 | default_app_config = 'diventi.tooltips.apps.TooltipsConfig' | 1.054688 | 1 |
free/urls.py | ParkHyeonChae/Re-Born-Web | 23 | 12797724 | from django.conf import settings
from django.conf.urls.static import static
from django.urls import path
from . import views
from django.contrib import messages
from django.shortcuts import redirect
app_name = 'free'
def protected_file(request, path, document_root=None):
messages.error(request, "접근 불가")
retu... | 1.96875 | 2 |
school/lecture1/isi_cv_03_sol.py | kubekbreha/ML-Python-Algorithms | 0 | 12797725 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Sun Feb 19 21:04:18 2017
@author: pd
"""
#from IPython import get_ipython
#get_ipython().magic('reset -sf')
import numpy as np
from sklearn import datasets
from sklearn.tree import DecisionTreeClassifier
import matplotlib.pyplot as plt
from sklearn.cross_... | 2.96875 | 3 |
scripts/stock_price/findSimilarLines.py | zettsu-t/cPlusPlusFriend | 9 | 12797726 | #!/usr/bin/python
# coding: utf-8
import sys
import Levenshtein
import numpy as np
assert len(sys.argv) > 1
with open(sys.argv[1], 'r', encoding='utf-8') as file:
lines = file.readlines()
n_lines = len(lines)
distances = np.zeros((n_lines, n_lines), dtype=int)
messages = []
for x in range(n_lines):
for y i... | 3.125 | 3 |
mock_api/mock_gh_api.py | equinor/ms-continuus | 0 | 12797727 | import json
from copy import deepcopy
from random import randrange
from typing import List
import uvicorn
from fastapi import FastAPI, HTTPException, status
from pydantic import BaseModel
from starlette.responses import FileResponse
app = FastAPI()
class Repos(BaseModel):
repositories: List[str]
with open("mock_... | 2.484375 | 2 |
backend/stock/migrations/0024_auto_20210218_2347.py | fengxia41103/stock | 1 | 12797728 | <reponame>fengxia41103/stock<filename>backend/stock/migrations/0024_auto_20210218_2347.py
# Generated by Django 3.1.6 on 2021-02-18 23:47
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('stock', '0023_auto_20210216_1552'),
]
operations = [
... | 1.65625 | 2 |
error_propagation/__init__.py | davidreissmello/error_propagation | 4 | 12797729 | <filename>error_propagation/__init__.py
from error_propagation.core import arrays_to_complex
from error_propagation.core import Complex
__all__ = ["Complex", "arrays_to_complex"]
| 1.046875 | 1 |
normalization.py | iskandr/attention-in-neural-networks | 5 | 12797730 | substitutions = {
"'’‘": " <SINGLE-QUOTE> ",
'"«»': " <DOUBLE-QUOTE> ",
"/": " <SLASH> ",
"\\": " <BACK-SLASH> ",
"”": " <RIGHT-QUOTE> ",
"“": " <LEFT-QUOTE> ",
"-": " <HYPHEN> ",
"[": " <LEFT-BRACKET> ",
"]": " <RIGHT-BRACKET> ",
"?": " <QUESTION> ",
"!": " <EXCLAMATION> ",
... | 3.25 | 3 |
meta/DesignDataPackage/iFAB/validate/validate.py | lefevre-fraser/openmeta-mms | 0 | 12797731 | """
validate.py
Validate XML file against XSD schema using minixsd library.
<NAME> (<EMAIL>)
The Pennsylvania State University
Applied Research Laboratory
2012
"""
import argparse
from collections import namedtuple
from minixsv.pyxsval import parseAndValidate
from genxmlif import GenXmlIfError
from minixsv.xsvalErrorHa... | 2.75 | 3 |
src/resources/face_train.py | RoliKhanna/SafeRide | 0 | 12797732 | <filename>src/resources/face_train.py
from math import sqrt
from sklearn import neighbors
from os import listdir
from os.path import isdir, join, isfile, splitext
import pickle
import face_recognition
from face_recognition import face_locations
from face_recognition.cli import image_files_in_folder
import cv2
def tra... | 3.171875 | 3 |
models/chat.py | Akkihi/Custom-Commands-Bot | 1 | 12797733 | from peewee import *
from .base_model import BaseModel
class Chat(BaseModel):
telegram_id = BigIntegerField(unique=True)
title = TextField(null=True)
link = TextField(null=True)
| 2.109375 | 2 |
student_dashboard_prototype.py | gregorygsimon/gregorygsimon.github.io | 2 | 12797734 | <filename>student_dashboard_prototype.py<gh_stars>1-10
import matplotlib.pyplot as plt
from matplotlib import rcParams
import matplotlib.dates as mdates
import pandas as pd
import numpy as np
import requests, datetime, webbrowser
## This code will not run without MindEdge access / password
if 'un' not in vars():
... | 2.90625 | 3 |
examples/crypto/rsaEncrypt.py | aaronize/pooryam | 0 | 12797735 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import rsa
def do_encrypt(plain_data):
# rsa.encrypt(plainMessage, )
pass
def do_decrypt(cipher_data):
pass
if __name__ == "__main__":
message = "hello world"
pubkey = ""
# 加密
cipherMessage = rsa.encrypt(message.en... | 3.21875 | 3 |
sacorg/algorithms/blitzstein_diaconis/blitzstein_diaconis.py | abdcelikkanat/sacorg | 0 | 12797736 | <gh_stars>0
from sacorg.utils import *
from sacorg.algorithms.isgraphical import *
def s(deg_seq):
"""
Generates a sample graph for a given degree sequence d
:param deg_seq: Given degree sequence
:return E, p, c: edges with vertex labels starting from 1,
probability of the gener... | 3.015625 | 3 |
native_client/src/trusted/validator_ragel/check_dis_section.py | zipated/src | 2,151 | 12797737 | <reponame>zipated/src
#!/usr/bin/python
# Copyright (c) 2013 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import subprocess
import sys
import tempfile
import objdump_parser
import test_format
class Rdf... | 1.78125 | 2 |
books/learn-python-the-hard-way/ex29.py | phiratio/lpthw | 1 | 12797738 | <gh_stars>1-10
people = 20
cats = 30
dogs = 15
if people < cats:
print(f'Too many Cats! The world is doomed!')
if people > cats:
print(f'Not many cats! The world is saved')
if people > dogs:
print(f'The world is drooled on')
if people < dogs:
print(f'The world is dry')
dogs += 5
if people >= d... | 4.09375 | 4 |
easyai/train_task.py | lpj0822/image_point_cloud_det | 1 | 12797739 | <reponame>lpj0822/image_point_cloud_det<gh_stars>1-10
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# Author:
from easyai.helper.arguments_parse import TaskArgumentsParse
from easyai.tasks.cls.classify_train import ClassifyTrain
from easyai.tasks.det2d.detect2d_train import Detection2dTrain
from easyai.tasks.seg.segmen... | 1.953125 | 2 |
src/rayoptics/qtgui/ipyconsole.py | wuffi/ray-optics | 106 | 12797740 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright © 2018 <NAME>
""" Support creation of an iPython console, with rayoptics environment
.. Created on Wed Nov 21 21:48:02 2018
.. codeauthor: <NAME>
"""
from PyQt5.QtGui import QColor
from qtconsole.rich_jupyter_widget import RichJupyterWidget
from qtconsole.in... | 2.375 | 2 |
009_web_data/inet_data.py | RicardoEscobar/learning-python | 0 | 12797741 | #
# Example file for retrieving data from the internet
#
import urllib.request
def main():
# open a connection to a URL using urllib2
web_url = urllib.request.urlopen("http://www.google.com")
# get the result code and print it
print ("result code: " + str(web_url.getcode()))
# read the data from... | 3.875 | 4 |
pygw2/api/daily.py | Natsku123/pygw2 | 1 | 12797742 | <filename>pygw2/api/daily.py
from ..core.models.general import DailyCrafting, DailyMapChest, DailyWorldBoss
from ..utils import endpoint, object_parse
class DailyApi:
_instances = {}
def __new__(cls, *args, api_key: str = "", **kwargs):
if api_key not in cls._instances:
cls._instances[api... | 2.4375 | 2 |
src/DictionaryVector.py | Dorijan-Cirkveni/AutoSolvingMatrix | 0 | 12797743 | <reponame>Dorijan-Cirkveni/AutoSolvingMatrix
from src.VectorAbstract import VectorAbstract
class DictionaryVector(VectorAbstract):
def __init__(self, values=None):
if values is None:
values = dict()
self.values: dict = dict()
for e in values:
v = values[e]
... | 3.046875 | 3 |
backend/ArrowSelection/Application.py | Ezetowers/tp-final-fallas-I | 0 | 12797744 | import sys, logging, time, random
import web
import json
from intellect.Intellect import Intellect
from MyIntellect import MyIntellect
from Question import Question
from Arrow_Model import Arrow_Model
from Model import Model
class Application(object):
def __init__(self):
# Load the rules
self._myIntellect = MyI... | 2.21875 | 2 |
Co-Simulation/Sumo/sumo-1.7.0/tools/personGenerator.py | uruzahe/carla | 4 | 12797745 | #!/usr/bin/env python
# Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
# Copyright (C) 2019-2020 German Aerospace Center (DLR) and others.
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License 2.0 which is available at
# https://www.ec... | 2.390625 | 2 |
4_SC_project/students/urls.py | abdullah1107/Django-for-Begineers | 0 | 12797746 | <filename>4_SC_project/students/urls.py
from django.urls import path,include
from rest_framework import routers
from . import views
from students.views import StudentsView,StudentViewusingID
router = routers.DefaultRouter()
router.register('',views.StudentsView)
urlpatterns = [
#path('<int:pk>/', StudentViewusi... | 2.015625 | 2 |
docs/02.AI_ML/code-1805/Day05all/cc1.py | mheanng/PythonNote | 2 | 12797747 | <reponame>mheanng/PythonNote<filename>docs/02.AI_ML/code-1805/Day05all/cc1.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import functools
def f1(x):
return x + 3
def f2(x):
return x * 6
def f3(x):
return x - 9
def fc(*fs):
return functools.reduce(
lambda fa, fb: lamb... | 2.609375 | 3 |
Code/predictTCGAData.py | HalforcNull/Research_PatternRecognition | 0 | 12797748 | <gh_stars>0
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 25 17:14:19 2017
@author: Student
"""
from sklearn.naive_bayes import GaussianNB
import numpy as np
import csv
import pickle
TrainingData = []
TrainingResult = []
TestSampleData = []
TestActualResult = []
def __loadData(dataFile):
data = []
i = 0
... | 2.515625 | 3 |
sources/migrations/0024_rename_owned_by_to_exportable_by.py | industrydive/sourcedive | 0 | 12797749 | <reponame>industrydive/sourcedive<gh_stars>0
# Generated by Django 2.2.10 on 2020-02-24 21:54
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('sources', '0023_add_person_owned_by_field_for_dive_relationship'),
]
operations = [
migrations... | 1.71875 | 2 |
scraper/reset_data.py | Ignis-Altum/scraper | 22 | 12797750 | <reponame>Ignis-Altum/scraper
import logging
from scraper import Filemanager
def reset():
print("Resetting data...")
logging.getLogger(__name__).info("Resetting data")
data = Filemanager.get_record_data()
for category in data.values():
for product in category.values():
for websit... | 2.640625 | 3 |