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 |
|---|---|---|---|---|---|---|
Week 6/Programming Assignment 3 - Functions.py | joe733/Joy-Of-Computing-Using-Python-2019 | 0 | 12790051 | <filename>Week 6/Programming Assignment 3 - Functions.py
'''
Given an integer number n, define a function named printDict() which can print a dictionary where the keys are numbers between 1 and n (both included) and the values are square of keys.
The function printDict() doesn't take any argument.
>>Input Format:
The ... | 4.65625 | 5 |
setup.py | CrawlerCode/PythonTools | 0 | 12790052 | <gh_stars>0
from setuptools import setup
def readme():
with open("README.rst") as f:
README = f.read()
return README
TYPE = "CORE"
packages = []
install_requires = []
if TYPE == "CORE":
packages = ['pythontools.core', 'pythontools.identity', 'pythontools.sockets', 'pythontools.dev', 'pythontool... | 1.609375 | 2 |
study/spMap.py | Suryavf/SelfDrivingCar | 11 | 12790053 | <filename>study/spMap.py
import os
import glob
import h5py
import numpy as np
import cv2 as cv
from matplotlib import pyplot as plt
# Parameters
path = '/media/victor/Documentos/'
outpath = '/media/victor/Documentos/Thesis/AttentionMap/Resume10'
dimImage = ( 96,192)
dimEncode = ( 12, 24)
n_head = 2
n_task... | 2.375 | 2 |
.github/workflows/get_version_and_update.py | gdt050579/GView | 7 | 12790054 | import sys
import os
import shutil
if len(sys.argv) < 2:
print("Failed to obtain GView.hpp location")
exit(1)
header_location = sys.argv[1]
if not os.path.exists(header_location):
print("Path {} does not exists!".format(header_location))
exit(1)
default_version_to_update = 1 # major=0, minor=1, patc... | 2.484375 | 2 |
utils/redis_utils.py | sdgdsffdsfff/qtalk_search | 1 | 12790055 | <reponame>sdgdsffdsfff/qtalk_search
#!/usr/bin/env python
# -*- coding:utf-8 -*-
__author__ = 'jingyu.he'
import redis
from redis import sentinel
import json
from conf.cache_params_define import *
# from utils.logger_conf import configure_logger
# log_path = get_logger_file(name='reids.log')
# redis_log = configure_l... | 1.789063 | 2 |
agilife/api/views.py | michellydsalves/agilife-api | 0 | 12790056 | <filename>agilife/api/views.py
from rest_framework import viewsets
from rest_framework import mixins
from rest_framework import generics
from rest_framework.views import APIView
from rest_framework.authentication import TokenAuthentication
from rest_framework.permissions import IsAuthenticated
from rest_framework.decor... | 1.921875 | 2 |
Python/Nearly Lucky Number.py | bic-potato/codeforces_learning | 0 | 12790057 | <filename>Python/Nearly Lucky Number.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Oct 19 21:11:16 2020
@author: zuoxichen
"""
import sys
def main_args():
a=list(input())
k=0
n=0
for i in a:
n+=1
if (i=='4' or i=='7'):
k+=1
else:
k+... | 3.515625 | 4 |
server/etes/migrations/0024_auto_20181119_1213.py | ethanmnrd/TicketXchnge | 0 | 12790058 | <gh_stars>0
# Generated by Django 2.1.3 on 2018-11-19 20:13
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('etes', '0023_auto_20181119_1203'),
]
operations = [
migrations.AddField(
model_name='ticket',
name='tick... | 1.617188 | 2 |
taschenrechner.py | it-moerike/python | 0 | 12790059 | <gh_stars>0
from tkinter import *
def rechnen():
if operator.curselection() == (0,):
ausgabe["text"] = float(zahl1.get()) + float(zahl2.get())
elif operator.curselection() == (1,):
ausgabe["text"] = float(zahl1.get()) - float(zahl2.get())
elif operator.curselection() == (2,):
ausga... | 3.21875 | 3 |
scripts/mongodb_store.py | coastrock/CEBD1261-2019-fall-group-project | 1 | 12790060 | try:
from pyspark import SparkContext, SparkConf
from pyspark.sql import SparkSession
import pyspark.sql.functions as f
# from operator import add
except Exception as e:
print(e)
## http://www.hongyusu.com/imt/technology/spark-via-python-basic-setup-count-lines-and-word-counts.html
def push_mongo():... | 2.421875 | 2 |
UVa 231 - Testing the Catcher/sample/main.py | tadvi/uva | 1 | 12790061 | '''
Created on Jul 20, 2013
@author: <NAME>
'''
import sys
INF = 1 << 31
def LDS(array):
N = len(array)
longest = [0] * N
longest[0] = 1
for i in range(1, N):
currMax = 1
for j in range(i):
if array[i] <= array[j] and longest[j] + 1 > currMax:
currMax = long... | 3.125 | 3 |
lib/config/default.py | yaopengUSTC/mbit-skin-cancer | 3 | 12790062 | <reponame>yaopengUSTC/mbit-skin-cancer<gh_stars>1-10
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from yacs.config import CfgNode as CN
_C = CN()
# ----- BASIC SETTINGS -----
_C.NAME = "default"
_C.OUTPUT_DIR = "./output/derm_7pt"
_C.VALID_ST... | 1.609375 | 2 |
wirexfers/__init__.py | plaes/wirexfers | 1 | 12790063 | <reponame>plaes/wirexfers
# -*- coding: utf-8 -*-
"""
wirexfers - an online payment library
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
WireXfers is an online payments library, written in Python, providing
a simple common API for various online payment protocols (IPizza,
Solo/TUPAS).
:copyright: (c)... | 0.855469 | 1 |
thualign/utils/hook.py | bryant1410/Mask-Align | 27 | 12790064 | <filename>thualign/utils/hook.py
# coding=utf-8
# Copyright 2021-Present The THUAlign Authors
import torch
import numpy as np
from .summary import scalar
from .misc import get_global_step
def print_grad(x, name="x"):
if type(x) == torch.Tensor:
x.register_hook(lambda x: print("Norm - {} {}:{}\n {}".forma... | 2.3125 | 2 |
src/negotiating_agent/venv/lib/python3.8/site-packages/geniusweb/protocol/session/mopac/MOPACSettings.py | HahaBill/CollaborativeAI | 1 | 12790065 | from typing import List
from tudelft_utilities_logging.Reporter import Reporter
from geniusweb.deadline.Deadline import Deadline
from geniusweb.protocol.session.SessionProtocol import SessionProtocol
from geniusweb.protocol.session.SessionSettings import SessionSettings
from geniusweb.protocol.session.TeamInfo import... | 2.109375 | 2 |
data_visualization_app.py | vishwas1234567/Streamlit_tutorials | 5 | 12790066 | import streamlit as st
import plotly_express as px
import pandas as pd
# configuration
st.set_option('deprecation.showfileUploaderEncoding', False)
# title of the app
st.title("Data Visualization App")
# Add a sidebar
st.sidebar.subheader("Visualization Settings")
# Setup file upload
uploaded_file = st.sidebar.file... | 3.234375 | 3 |
rigidsearch/cli.py | robopsi/rigidsearch | 9 | 12790067 | # coding: utf-8
import os
import shutil
import json
import click
from werkzeug.utils import cached_property
class Context(object):
def __init__(self):
self.config_filename = os.environ.get('RIGIDSEARCH_CONFIG')
@cached_property
def app(self):
from rigidsearch.app import create_app
... | 2.15625 | 2 |
src/sion.py | kamimura/py-sion | 1 | 12790068 | # Created by kamimura on 2018/07/21.
# Copyright © 2018 kamimura. All rights reserved.
import sys
import datetime
from antlr4 import *
from SIONLexer import SIONLexer
from SIONParser import SIONParser
from SIONVisitor import SIONVisitor
def load(file, encoding: str='utf-8', errors: str='strict') -> object:
data =... | 2.203125 | 2 |
src/project/urls.py | kottenator/code.kottenator.com | 0 | 12790069 | <reponame>kottenator/code.kottenator.com
from django.contrib import admin
from django.urls import path, include
import project.auth.urls
import project.core.urls
from project.core.views import bad_request, permission_denied, page_not_found, server_error
import project.projects.urls
urlpatterns = [
path('admin/',... | 1.898438 | 2 |
code/matplotlib/test.py | qiudebo/13learn | 1 | 12790070 | # *-* coding:utf-8 *-*
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
from matplotlib import style
import os
from os import path
from matplotlib.font_manager import fontManager
# 图表坐标系
| 1.382813 | 1 |
rdfframework/processors/__init__.py | KnowledgeLinks/rdfframework | 7 | 12790071 | """
RDF Proccessors
===============
Processors are used to manipulate rdf date within the framework.
:copyright: Copyright (c) 2016 by <NAME> and <NAME>.
:license: To be determined, see LICENSE.txt for details.
"""
from .propertyprocessors import PropertyProcessor
from .classprocessors import ClassProcessor
__auth... | 1.328125 | 1 |
atlas/foundations_rest_api/src/foundations_rest_api/filters/null_filter.py | DeepLearnI/atlas | 296 | 12790072 | <reponame>DeepLearnI/atlas
from foundations_rest_api.filters.api_filter_mixin import APIFilterMixin
class NullFilter(APIFilterMixin):
def __call__(self, result, params):
if result and isinstance(result, list):
new_params = {key: value for key, value in params.items() if key.endswith('_isnull'... | 2.75 | 3 |
problems/interleaving_str.py | apoorvkk/LeetCodeSolutions | 1 | 12790073 | class Solution:
def isInterleave(self, s1, s2, s3):
"""
:type s1: str
:type s2: str
:type s3: str
:rtype: bool
"""
return self._is_interleave(s1, s2, s3, set(), 0, 0, 0)
def _is_interleave(self, s1, s2, s3, memo, s1_start, s2_start, s3_start):
... | 3.53125 | 4 |
pyDLib/GUI/fields.py | benoitkugler/abstractDataLibrary | 0 | 12790074 | """Implements widgets to visualize and modify basic fields. (french language)
ASSOCIATION should be updated with custom widgets, since common.abstractDetails will use it.
"""
import datetime
import re
from collections import defaultdict
from typing import List, Any
from PyQt5.QtCore import pyqtSignal, Qt, QPoint
from ... | 2.359375 | 2 |
charts.py | TurtleOld/budget_interface_flask | 0 | 12790075 | <gh_stars>0
from flask import Blueprint, render_template
import matplotlib.pyplot as plt
import datetime
from settings_database import cursor
from functions import get_total_amount, get_number_month
charts_route = Blueprint("charts", __name__)
# Выделяем число месяца из даты чека
def get_name_month_from_date(date_ti... | 2.703125 | 3 |
src/bbbr/wsgi.py | zgoda/bbbrating-server | 0 | 12790076 | <reponame>zgoda/bbbrating-server
from .app import make_app
application = make_app()
| 1.25 | 1 |
proxysql_tools/galera/galera_node.py | akuzminsky/proxysql-tools | 26 | 12790077 | """Module describes GaleraNode class"""
from contextlib import contextmanager
import pymysql
from pymysql.cursors import DictCursor
from proxysql_tools import execute
class GaleraNodeState(object): # pylint: disable=too-few-public-methods
"""State of Galera node http://bit.ly/2r1tUGB """
PRIMARY = 1
JO... | 2.5 | 2 |
src/comment_analysis/parsing_utils.py | peppocola/DeClutter-Challenge-2020 | 5 | 12790078 | import json
from sklearn.preprocessing import LabelEncoder
from src.comment_analysis.url_utils import get_text_by_url
from src.csv.csv_utils import get_link_line_type, get_keywords
from src.keys import line, serialize_outpath
from nltk.stem.porter import *
from spacy.lang.en.stop_words import STOP_WORDS
from src.comm... | 2.8125 | 3 |
2020/01/part_1.py | anders-wind/advent_of_code | 0 | 12790079 | from typing import List
def read_input(file_path) -> List[int]:
res = set({})
with open(file_path, 'r') as file_handle:
for line in file_handle:
res.add(int(line))
return res
def calculate_result(numbers: List[int]) -> int:
for number in numbers:
opposite = 2... | 3.765625 | 4 |
tests/unit/test_user.py | gnott/h | 0 | 12790080 | from unittest import TestCase
from h.models import User
from . import AppTestCase
class UserTest(AppTestCase):
def test_password_encrypt(self):
"""make sure user passwords are stored encrypted
"""
u1 = User(username=u'test', password=u'<PASSWORD>', email=u'<EMAIL>')
assert u1.pass... | 3.3125 | 3 |
tagannotator/base/migrations/0005_auto_20200113_0518.py | kixlab/suggestbot-instagram-context-annotator | 0 | 12790081 | <filename>tagannotator/base/migrations/0005_auto_20200113_0518.py
# Generated by Django 2.2.7 on 2020-01-13 05:18
import base.models
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migratio... | 1.523438 | 2 |
get_model.py | dev-05/google_lens_clone | 1 | 12790082 | <filename>get_model.py
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 16 17:14:38 2021
@author: dev
"""
from tensorflow.keras.applications.vgg16 import VGG16
model=VGG16()
model.save('mymodel.h5')
print("VGG16 model downloaded and saved successfully") | 2.40625 | 2 |
src/architecture/encoder/stacked_mnist_encoder.py | gmum/lcw-generator | 4 | 12790083 | <reponame>gmum/lcw-generator
from architecture.encoder.cnn_encoder_block import CnnEncoderBlock
import torch
import torch.nn as nn
from architecture.generator.linear_generator_block import LinearGeneratorBlock
class Encoder(nn.Module):
def __init__(self, latent_size: int):
super().__init__()... | 2.703125 | 3 |
scraper/scraper/main_page.py | tomirendo/BenYehuda | 0 | 12790084 | """
Class for parsing the main Ben Yehuda site page
"""
from urllib import request
from urllib import parse as urlparse
from bs4 import BeautifulSoup
from .helpers import NamedLink, clean_text
class MainPage(object):
"""
Parses and gets information from the main index page. Mostly used to get
links for a... | 3.734375 | 4 |
Eye-Tracking-System/tony/com.tonybeltramelli.eyetracker/Eye.py | tonybeltramelli/Graphics-And-Vision | 12 | 12790085 | <gh_stars>10-100
__author__ = 'tbeltramelli'
from scipy.cluster.vq import *
from UMedia import *
from Filtering import *
from RegionProps import *
from UMath import *
from UGraphics import *
import operator
class Eye:
_result = None
_right_template = None
_left_template = None
def __init__(self, rig... | 2.234375 | 2 |
tinylinks/urls.py | gosuai/django-tinylinks | 11 | 12790086 | <gh_stars>10-100
"""URLs for the ``django-tinylinks`` app."""
from django.conf.urls import url
from django.views.generic import TemplateView
from .views import (
StatisticsView,
TinylinkCreateView,
TinylinkDeleteView,
TinylinkListView,
TinylinkRedirectView,
TinylinkUpdateView,
)
urlpatterns =... | 1.820313 | 2 |
rainy_project/mainpage/migrations/0018_survey.py | osamhack2020/WEB_HeavyReading_Rainy | 2 | 12790087 | <gh_stars>1-10
# Generated by Django 2.1 on 2020-10-29 14:45
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('mainpage', '0017_auto_20201025_2232'),
]... | 1.859375 | 2 |
naive_bayes.py | xiecong/Simple-Implementation-of-ML-Algorithms | 16 | 12790088 | <filename>naive_bayes.py
import numpy as np
from sklearn.datasets import fetch_20newsgroups
import re
def tokenize(documents, stop_words):
text = []
for doc in documents:
letters_only = re.sub("[^a-zA-Z]", " ", doc)
words = letters_only.lower().split()
text.append([w for w in words if ... | 2.515625 | 3 |
code.py | priyanshnama/Hackerrank-Automation-Prototype | 0 | 12790089 | <filename>code.py<gh_stars>0
import string
import urllib3
import random
import json
# log file
log = open("log.txt", "a+")
Head = ["firstname\t", "lastname\t", "email\t\t\t", "college\t", "city\t", "phone\t\t", "password\t", "refral\t"]
log.writelines(Head)
code = input("Enter Your Refral code: ")
points = int((int(... | 2.9375 | 3 |
nygame/_quietload.py | nfearnley/nygame | 1 | 12790090 | import os
os.environ["PYGAME_HIDE_SUPPORT_PROMPT"] = "1"
| 1.367188 | 1 |
_unittests/ut_rss/test_rss_compile.py | sdpython/pyrsslocal | 2 | 12790091 | <gh_stars>1-10
# coding: utf-8
"""
@brief test log(time=2s)
"""
import os
import unittest
from pyquickhelper.loghelper import fLOG
from pyquickhelper.pycode import get_temp_folder, ExtTestCase
from pyrsslocal.cli import compile_rss_blogs
class TestRSSCompile(ExtTestCase):
def test_rss_compile(self):
... | 2.34375 | 2 |
plantpredict/helpers.py | plantpredict/python-sdk | 2 | 12790092 | import pandas as pd
def load_from_excel(file_path, sheet_name=None):
"""
Loads the data from an Excel file into a list of dictionaries, where each dictionary represents a row in the Excel
file and the keys of each dictionary represent each column header in the Excel file. The method creates this list
... | 4.21875 | 4 |
ulm/settings/local.py | dupuy/ulm | 1 | 12790093 | <reponame>dupuy/ulm<gh_stars>1-10
# pylint: disable=W0401,W0614,C0111
from .base import * # noqa
ADMINS = (
('<NAME>', '<EMAIL>'),
)
MANAGERS = ADMINS
# Make this unique, and don't share it with anybody.
SECRET_KEY = '<KEY>'
| 1.296875 | 1 |
examples/1827402009.py | lobo0616/bysj | 1 | 12790094 | <filename>examples/1827402009.py
# 学号:1827402009
# 姓名:肖鹏
# IP:192.168.157.232
# 上传时间:2018/11/12 15:22:55
import math
def func1(a,b): if a>=b or int(a)!=a or int(b)!=b :
return None
else:
d=1
for i in range(a,b):
d=d*i
c=len(str(d))
x=1
... | 3.734375 | 4 |
dynatrace-scripts/checkforproblems.py | nikhilgoenkatech/Jekins | 0 | 12790095 | <filename>dynatrace-scripts/checkforproblems.py
import sys
import json
import requests
def main():
DT_URL = sys.argv[1]
DT_TOKEN = sys.argv[2]
endpoint = DT_URL + "api/v1/problem/status"
get_param = {'Accept':'application/json; charset=utf-8', 'Authorization':'Api-Token {}'.format(DT_TOKEN)}
config_post... | 2.59375 | 3 |
WIP/urls.py | kodi-sk/CSI-WIP | 0 | 12790096 | """WIP URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based ... | 2.53125 | 3 |
src/Honeybee_EnergyPlus Window Shade Generator.py | rdzeldenrust/Honeybee | 1 | 12790097 | <reponame>rdzeldenrust/Honeybee
# This component creates shades for Honeybee Zones
# By <NAME>
# <EMAIL>
# Ladybug started by <NAME> is licensed
# under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
"""
Use this component to generate shades for Honeybee zone windows. The component has two main uses:
... | 2.28125 | 2 |
devserver/modules/profile.py | leture/django-devserver | 467 | 12790098 | from devserver.modules import DevServerModule
from devserver.utils.time import ms_from_timedelta
from devserver.settings import DEVSERVER_AUTO_PROFILE
from datetime import datetime
import functools
import gc
class ProfileSummaryModule(DevServerModule):
"""
Outputs a summary of cache events once a response i... | 2.25 | 2 |
editor/readsave/test.py | Atrosha/APOC-Editor | 4 | 12790099 | x1=10
y1=10
x2=9
y2=10
x=(x1*x1+y1*y1)
y=(x2*x2+y2*y2)
xyz=(x+y)//2
average_x=(x1+x2)//2
average_y=(y1+y2)//2
average_x_2=average_x*average_x
average_y_2=average_y*average_y
average=average_x_2+average_y_2
new_x=(x1+x2)-average_x
new_y=(y1+y2)-average_y
new_2=new_x*new_x+new_y*new_y
d... | 3.703125 | 4 |
hyperion/helpers/__init__.py | hyperion-ml/hyperion | 14 | 12790100 | <filename>hyperion/helpers/__init__.py
"""
Copyright 2018 Johns Hopkins University (Author: <NAME>)
Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
"""
from .vector_reader import VectorReader
from .vector_class_reader import VectorClassReader
from .trial_data_reader import TrialDataReader
from .multi_test... | 1.515625 | 2 |
src/plot_AGs_results.py | syhw/contextual_word_segmentation | 2 | 12790101 | import numpy as np
import pylab as pl
import matplotlib
import matplotlib.pyplot as plt
from collections import defaultdict
import glob
import readline # otherwise the wrong readline is imported by rpy2
SAGE_XPS = 11
SAGE = 12
EAGE = 31
N_MONTHS = EAGE-SAGE+1
#TYPES = ["basic", "single-context", "topics"]
#TYPES = ["b... | 2.078125 | 2 |
supports/pyload/src/pyload/plugins/accounts/LinkifierCom.py | LuckyNicky/pycrawler | 1 | 12790102 | # -*- coding: utf-8 -*-
import hashlib
import json
import pycurl
from ..base.multi_account import MultiAccount
class LinkifierCom(MultiAccount):
__name__ = "LinkifierCom"
__type__ = "account"
__version__ = "0.01"
__status__ = "testing"
__pyload_version__ = "0.5"
__description__ = """Linki... | 2.0625 | 2 |
temp.py | Hrishabh-B/Basic_codes | 0 | 12790103 | #This code is written for dynamic step-size. step size c0 gets smaller when it achieves the number 200.
#Author: <NAME>, Senior Research Fellow, University of Delhi
#Date: 5-07-2021
from math import *
import numpy as np
c0=50.0
for x in np.arange(c0,580,10):
t=10*(abs(200.1-c0)/200.1)*abs(np.log(0.3/abs(c0-200.1)... | 3.203125 | 3 |
src/OTLMOW/OTLModel/Classes/Grasland.py | davidvlaminck/OTLClassPython | 2 | 12790104 | <gh_stars>1-10
# coding=utf-8
from OTLMOW.OTLModel.BaseClasses.OTLAttribuut import OTLAttribuut
from OTLMOW.OTLModel.Classes.GrazigeVegetatie import GrazigeVegetatie
from OTLMOW.OTLModel.Datatypes.KlNSB import KlNSB
from OTLMOW.GeometrieArtefact.VlakGeometrie import VlakGeometrie
# Generated with OTLClassCreator. To ... | 2.015625 | 2 |
build_html/preprocess_xml.py | DCCouncil/dc-law-tools | 3 | 12790105 | <reponame>DCCouncil/dc-law-tools
import lxml.etree as et
from .preprocessors import preprocessors
from .preprocessors.utils import index_docs
import os
DIR = os.path.abspath(os.path.dirname(__file__))
out_dir = os.path.join(DIR, '../../dc-law-html')
bld_file = os.path.join(DIR, '../working_files/dccode-html-bld.xml'... | 2.421875 | 2 |
code/config.py | SimonSuster/rc-cnn-dailymail | 325 | 12790106 |
import theano
import argparse
_floatX = theano.config.floatX
def str2bool(v):
return v.lower() in ('yes', 'true', 't', '1', 'y')
def get_args():
parser = argparse.ArgumentParser()
parser.register('type', 'bool', str2bool)
# Basics
parser.add_argument('--debug',
type='... | 2.4375 | 2 |
modules/evaluation.py | hrayrhar/limit-label-memorization | 37 | 12790107 | <reponame>hrayrhar/limit-label-memorization
from tqdm import tqdm
import numpy as np
def compute_accuracy_with_bootstrapping(pred, target, n_iters=1000):
""" Expects numpy arrays. pred should have shape (n_samples, n_classes), while
target should have shape (n_samples,).
"""
assert pred.shape[0] == ta... | 2.90625 | 3 |
hmm_for_baxter_using_only_success_trials/anomaly_identification.py | HongminWu/HMM | 3 | 12790108 | <reponame>HongminWu/HMM
#!/usr/bin/env python
import os
import numpy as np
from sklearn.externals import joblib
from matplotlib import pyplot as plt
import util
import training_config
import pandas as pd
import random
import ipdb
def run(anomaly_data_path_for_testing,
model_save_path,
figure_save_path... | 2.390625 | 2 |
matador/orm/__init__.py | dquigley-warwick/matador | 24 | 12790109 | <filename>matador/orm/__init__.py
# coding: utf-8
# Distributed under the terms of the MIT License.
__all__ = ["DataContainer"]
__author__ = '<NAME>'
__maintainer__ = '<NAME>'
from .orm import DataContainer
| 1.265625 | 1 |
lib/Model.py | calumcorrie/Meraki-Crowd-Interface | 0 | 12790110 | <reponame>calumcorrie/Meraki-Crowd-Interface<gh_stars>0
import os
import sys
import numpy as np
from PIL import Image, ImageFilter
import bz2
import pickle
import datetime
import requests
import hashlib
parentddir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir))
sys.path.append(parentddir)
fr... | 2.09375 | 2 |
53. Maximum Subarray/main.py | Competitive-Programmers-Community/LeetCode | 2 | 12790111 | <filename>53. Maximum Subarray/main.py
class Solution:
def maxSubArray(self, A):
if not A:
return 0
curSum = maxSum = A[0]
for num in A[1:]:
curSum = max(num, curSum + num)
maxSum = max(maxSum, curSum)
return maxSum
| 3.65625 | 4 |
esociallib/v2_04/evtCdBenPrRP.py | akretion/esociallib | 6 | 12790112 | <filename>esociallib/v2_04/evtCdBenPrRP.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Generated Tue Oct 10 00:42:21 2017 by generateDS.py version 2.28b.
# Python 2.7.12 (default, Nov 19 2016, 06:48:10) [GCC 5.4.0 20160609]
#
# Command line options:
# ('--no-process-includes', '')
# ('-o', 'esociallib/v2_04... | 1.984375 | 2 |
pointcloudset/diff/__init__.py | hugoledoux/pointcloudset | 23 | 12790113 | <reponame>hugoledoux/pointcloudset
"""
Functions to calculate differences and distances between entities.
"""
from pointcloudset.diff.origin import calculate_distance_to_origin
from pointcloudset.diff.plane import calculate_distance_to_plane
from pointcloudset.diff.point import calculate_distance_to_point
from pointcl... | 2.21875 | 2 |
acq4/devices/ThorlabsFilterWheel/__init__.py | aleonlein/acq4 | 1 | 12790114 | <reponame>aleonlein/acq4
from FilterWheel import *
| 0.976563 | 1 |
sdk/python/pulumi_cloudamqp/get_plugins.py | pulumi/pulumi-cloudamqp | 2 | 12790115 | <filename>sdk/python/pulumi_cloudamqp/get_plugins.py<gh_stars>1-10
# 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 impo... | 1.929688 | 2 |
mathrepl/evaluator.py | lpozo/mathrepl | 3 | 12790116 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHET... | 2.625 | 3 |
measure_mate/migrations/0010_measurement_target_rating.py | niche-tester/measure-mate | 15 | 12790117 | # -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-01-30 00:57
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('measure_mate', '0009_auto_20160124_1245'),
]
operat... | 1.429688 | 1 |
jnpr/openclos/tests/unit/test_writer.py | sysbot/OpenClos | 1 | 12790118 | '''
Created on Aug 26, 2014
@author: preethi
'''
import os
import sys
import shutil
sys.path.insert(0,os.path.abspath(os.path.dirname(__file__) + '/' + '../..')) #trick to make it run from CLI
import unittest
import sqlalchemy
from sqlalchemy.orm import sessionmaker
import pydot
from jnpr.openclos.model import Pod, D... | 1.96875 | 2 |
py_particle_processor_qt/tools/OrbitTool/__init__.py | DanielWinklehner/py_particle_processor | 0 | 12790119 | from py_particle_processor_qt.tools.OrbitTool.OrbitTool import *
| 1.023438 | 1 |
hyquest/verifiers/timemap.py | Edmonton-Public-Library/centennial | 0 | 12790120 | from hyquest.verifiers.common import getTaskResultSet, getUserAction
from hyquest.constants import TASK_TIMEMAP
# This handles matching up TimeMap state to associated TimeMap Tasks
def matchingTimeMapTasks(user, timeMapState):
tasks = getTaskResultSet(user).filter(type=TASK_TIMEMAP)
activeTasks = []
other... | 2.671875 | 3 |
app.py | 15281029/translation | 0 | 12790121 | # -*- coding: utf-8 -*-
from flask import Flask, request, make_response
import requests
import json
from core import Translation, RequestJson, PBMT
from bean import log
app = Flask(__name__)
def buildResponse(code, msg):
json_data = dict()
json_data['code'] = code
json_data['message'] = msg
response... | 2.421875 | 2 |
html_parsing/get_price_game/from_gama-gama.py | DazEB2/SimplePyScripts | 117 | 12790122 | <gh_stars>100-1000
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
# Основа взята из http://stackoverflow.com/a/37755811/5909792
def get_html(url):
from PyQt5.QtCore import QUrl
from PyQt5.QtWidgets import QApplication
from PyQt5.QtWebEngineWidgets import QWebEnginePage
class ... | 2.421875 | 2 |
tests/test_kmeans.py | joezuntz/TreeCorr | 0 | 12790123 | # Copyright (c) 2003-2019 by <NAME>
#
# TreeCorr is free software: 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 of conditions... | 1.945313 | 2 |
ws2122-lspm/Lib/site-packages/pm4py/objects/log/util/sorting.py | Malekhy/ws2122-lspm | 1 | 12790124 | '''
This file is part of PM4Py (More Info: https://pm4py.fit.fraunhofer.de).
PM4Py is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any late... | 2.25 | 2 |
kuconnect/dropout.py | ozanarkancan/KuConnect | 0 | 12790125 | import theano
from utils import srng
def dropout(input, dropout_rate=0):
if dropout_rate > 0:
retain = 1 - dropout_rate
d_output = (input / retain) * srng.binomial(input.shape, p=retain,
dtype='int32').astype('float32')
else:
d_output = input
return d_output
| 2.515625 | 3 |
pytglib/api/types/push_message_content_location.py | iTeam-co/pytglib | 6 | 12790126 | <filename>pytglib/api/types/push_message_content_location.py<gh_stars>1-10
from ..utils import Object
class PushMessageContentLocation(Object):
"""
A message with a location
Attributes:
ID (:obj:`str`): ``PushMessageContentLocation``
Args:
is_live (:obj:`bool`):
True, ... | 2.859375 | 3 |
03. Tuples and Sets - Lab/05_softuni_party.py | elenaborisova/Python-Advanced | 2 | 12790127 | def input_to_list(guests_count):
return [input() for _ in range(guests_count)]
def input_to_list_until_command(command):
result = []
line = input()
while not line == command:
result.append(line)
line = input()
return result
def get_not_arrived_guests(guests, guests_arrived):
... | 3.765625 | 4 |
nmtwizard/config.py | OpenNMT/nmt-wizard-docker | 44 | 12790128 | <filename>nmtwizard/config.py
"""Functions to manipulate and validate configurations."""
import collections
import jsonschema
import copy
def merge_config(a, b):
"""Merges config b in a."""
for key, b_value in b.items():
if not isinstance(b_value, dict):
a[key] = b_value
else:
... | 2.640625 | 3 |
shap/plots/_utils.py | willianfco/shap | 16,097 | 12790129 | from .. import Explanation
from ..utils import OpChain
from . import colors
import numpy as np
def convert_color(color):
try:
color = pl.get_cmap(color)
except:
pass
if color == "shap_red":
color = colors.red_rgb
elif color == "shap_blue":
color = colors.blue_rgb
... | 2.75 | 3 |
samples/pose_estimation/solver.py | SushmaDG/MaskRCNN | 1 | 12790130 | <filename>samples/pose_estimation/solver.py
import cv2
import os
import trimesh
import numpy as np
from paz.core import Pose6D
from paz.core.ops import Camera
import paz.processors as pr
from paz.core import ops
import matplotlib.pyplot as plt
MESH_DIR = '/home/incendio/Documents/Thesis/YCBVideo_detector/color_meshes'... | 2.3125 | 2 |
MLSD/Transformers/Text_Transformers.py | HaoranXue/Machine_Learning_For_Structured_Data | 4 | 12790131 | <filename>MLSD/Transformers/Text_Transformers.py
import numpy as np
import pandas as pd
from sklearn.base import TransformerMixin
from sklearn.feature_extraction.text import CountVectorizer, TfidfTransformer
class BasicText(TransformerMixin):
def __init__(self, Dreduction= None, *args,**kwargs):
self.Dr... | 2.90625 | 3 |
glycan_profiling/output/annotate_spectra.py | mstim/glycresoft | 0 | 12790132 | <gh_stars>0
import os
import logging
import string
import platform
from glycan_profiling import serialize
from glycan_profiling.serialize import (
Protein, Glycopeptide, IdentifiedGlycopeptide,
func, MSScan, GlycopeptideSpectrumMatch)
from glycan_profiling.task import TaskBase
from glycan_profiling.serialize ... | 2.203125 | 2 |
payloadcode/phototest.py | debragail/n3m0 | 21 | 12790133 | print "Here we go!"
# Import DroneKit-Python
from dronekit import connect, VehicleMode, LocationGlobalRelative, LocationGlobal
from pymavlink import mavutil # Needed for command message definitions
from picamera import PiCamera
import time
import math
import requests
# Connect to the Vehicle.
print("\nConnecting to v... | 2.953125 | 3 |
examples/entities/pdfunderlay.py | jpsantos-mf/ezdxf | 1 | 12790134 | # Copyright (c) 2016-2019 <NAME>
# License: MIT License
import ezdxf
dwg = ezdxf.new('R2000') # underlay requires the DXF R2000 format or newer
pdf_underlay_def = dwg.add_underlay_def(filename='underlay.pdf', name='1') # name = page to display
dwf_underlay_def = dwg.add_underlay_def(filename='underlay.dwf',
... | 2.765625 | 3 |
setup.py | krazybean/pybusy | 0 | 12790135 | <filename>setup.py
"""
Cursor glamor prettiness for bash
"""
from setuptools import setup, find_packages
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
setup(
name='pybusy'... | 1.5625 | 2 |
discovery-provider/src/queries/get_remix_track_parents.py | mikedotexe/audius-protocol | 1 | 12790136 | <reponame>mikedotexe/audius-protocol<filename>discovery-provider/src/queries/get_remix_track_parents.py
from sqlalchemy import desc, and_
from src.models import Track, Remix
from src.utils import helpers
from src.utils.db_session import get_db_read_replica
from src.queries.query_helpers import get_current_user_id, pop... | 2.125 | 2 |
answerer/query.py | apricis/erudite | 0 | 12790137 | import re
import string
class Reformulator(object):
def __init__(self, question, qclass, lang='en', stopwords=None):
self.__original_question = question
punctuation = re.sub(r"[-+/&']", '', string.punctuation)
self.__punctuation_re = r'[{}]'.format(punctuation)
question = question[... | 2.9375 | 3 |
example.py | ipconfiger/result2 | 4 | 12790138 | <filename>example.py
#coding=utf8
from result2 import Result, Ok, Err
def get_valid_user_by_email(email):
"""
Return user instance
"""
user = get_user(email)
if user:
if user.valid is False:
return Err("user not valid")
return Ok(user)
return Err("user not exists")... | 3.125 | 3 |
restApi/helpers/ride_helpers.py | Kitingu/restplus | 0 | 12790139 | <reponame>Kitingu/restplus
import datetime
from flask_restplus import reqparse
class RideParser:
parser = reqparse.RequestParser()
parser.add_argument('start_point',
type=str,
required=True,
location='json',
help="... | 2.953125 | 3 |
scapy/scapy-arp_request.py | all3g/pieces | 34 | 12790140 | <reponame>all3g/pieces<gh_stars>10-100
#!/usr/bin/env python
# -*- coding: utf8 -*-
from scapy.all import *
import logging
import threading
import Queue
logging.basicConfig(level=logging.DEBUG,
format='[*] %(name)s - %(message)s')
logger = logging.getLogger('arpscanner')
# disable scapy verbose... | 2.328125 | 2 |
src/third_party/swiftshader/third_party/subzero/pydir/run-pnacl-sz.py | rhencke/engine | 2,151 | 12790141 | #!/usr/bin/env python2
import argparse
import itertools
import os
import re
import subprocess
import sys
import tempfile
from utils import FindBaseNaCl, GetObjdumpCmd, shellcmd
def TargetAssemblerFlags(target, sandboxed):
# TODO(reed kotler). Need to find out exactly we need to
# add here for Mips32.
flags = ... | 2.609375 | 3 |
examples/svd.py | ravenSanstete/hako | 1 | 12790142 | <reponame>ravenSanstete/hako
from .context import monad
from .context import tangle
from .context import feeder
from .context import prototype
from .context import magica
from .context import hako
from connectors import ml_100k_conn as conn
ip='10.141.246.29';
port=27017;
version='100k';
batch_size=100;
connector=... | 1.585938 | 2 |
project_euler/101.py | huangshenno1/project_euler | 0 | 12790143 | <reponame>huangshenno1/project_euler
from __future__ import division
def u(n):
ret = 0
for i in xrange(0, 11):
ret += (-1)**i * n**i
return ret
def solve(k):
a = []
for n in xrange(1, k+1):
x = [n**x for x in xrange(0, k)]
x.append(u(n))
a.append(x)
for j in xrange(0, k):
for i in xrange... | 2.484375 | 2 |
vasp-validator/tests/test_vasp_proxy_hook.py | tanshuai/reference-wallet | 14 | 12790144 | <reponame>tanshuai/reference-wallet
# Copyright (c) The Diem Core Contributors
# SPDX-License-Identifier: Apache-2.0
def test_tautology():
...
| 1.070313 | 1 |
Part 2/Chapter 02/Programming projects/project_01.py | phuycke/Practice-of-computing-using-Python | 1 | 12790145 | <reponame>phuycke/Practice-of-computing-using-Python
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: <NAME>
email: <EMAIL>
GitHub: phuycke
"""
#%%
total_grains = 0
multiplier = 1
for i in range(1, 65):
total_grains += multiplier
multiplier *= 2
print('Total amount of wheat: {}'.forma... | 3.890625 | 4 |
nova/objects/volume_usage.py | bopopescu/nova-token | 0 | 12790146 | <filename>nova/objects/volume_usage.py
begin_unit
comment|'# Licensed under the Apache License, Version 2.0 (the "License"); you may'
nl|'\n'
comment|'# not use this file except in compliance with the License. You may obtain'
nl|'\n'
comment|'# a copy of the License at'
nl|'\n'
comment|'#'
nl|'\n'
comment|'# ... | 1.804688 | 2 |
misc/python/materialize/zippy/source_capabilities.py | bobbyiliev/materialize | 1 | 12790147 | # Copyright Materialize, Inc. and contributors. All rights reserved.
#
# Use of this software is governed by the Business Source License
# included in the LICENSE file at the root of this repository.
#
# As of the Change Date specified in that file, in accordance with
# the Business Source License, use of this software... | 1.867188 | 2 |
main.py | gbuenoandrade/Integralization-Simulator---Unicamp | 0 | 12790148 | <reponame>gbuenoandrade/Integralization-Simulator---Unicamp
import numpy as np
import matplotlib.pyplot as plt
class Course:
def __init__(self):
self.name = ''
self.type = ''
self.credits = 0
self.grade = 0.0
self.sem = ''
def __str__(self):
return self.name + ' ' + self.type + ' ' + str(self.credits) +... | 3.25 | 3 |
database/test_code/test_scrape_wiki_mysql.py | Coslate/NBA_Win_Predictor | 0 | 12790149 | #! /usr/bin/env python3.6
import pymysql
import re
import random
import datetime
import sys
import argparse
import os
#########################
# Main-Routine #
#########################
def main():
#Initialization
print('> Crawler Initialization...')
iter_num = 0
crawler_nba.init()
#Argu... | 2.875 | 3 |
reina/iv/__init__.py | SoumilShekdar/Reina | 4 | 12790150 | <filename>reina/iv/__init__.py<gh_stars>1-10
from .2sls import SieveTSLS
| 1.125 | 1 |