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 |
|---|---|---|---|---|---|---|
diptera_track_ui.py | jmmelis/DipteraTrack | 1 | 25600 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'diptera_track.ui'
#
# Created by: PyQt5 UI code generator 5.9.2
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
Mai... | 1.585938 | 2 |
orcid_service/tests/stubdata/work_single_409.py | nemanjamart/orcid-service | 1 | 25601 | data = {
"publication-date": {
"year": {
"value": "2020"},
"month": {"value": "01"}},
"short-description": "With a central surface brightness of 29.3 mag arcsec, and half-light radius of r_half=3.1^{+0.9}_{-1.1} kpc, Andromeda XIX (And XIX) is an extremely diffuse satellite of Androm... | 1.78125 | 2 |
tests/test_day5.py | n1ckdm/advent-of-code-2020 | 1 | 25602 | <filename>tests/test_day5.py
from aoc_2020.day5 import part1, get_pos, part2
data = """BFFFBBFRRR
FFFBBBFRRR
BBFFBBFRLL
"""
def test_get_pos():
assert get_pos("FBFBBFFRLR") == (44, 5)
def test_part1():
assert part1(data) == 820
def test_part2():
assert part2(data) is None
| 2.484375 | 2 |
python/util.py | spatialaudio/aes148-shelving-filter | 5 | 25603 | """Shelving Filter Cascade with Adjustable Transition Slope and Bandwidth
<NAME>, <NAME>, <NAME>
In: Proc. of 148th AES Convention, Virtual Vienna, May 2020, Paper 10339
http://www.aes.org/e-lib/browse.cfm?elib=20756
"""
import numpy as np
from scipy.signal import tf2sos, freqs
from matplotlib import rcParams
def ha... | 2.5 | 2 |
Segment Tree Query II.py | RijuDasgupta9116/LintCode | 321 | 25604 | <filename>Segment Tree Query II.py
"""
For an array, we can build a SegmentTree for it, each node stores an extra attribute count to denote the number of
elements in the the array which value is between interval start and end. (The array may not fully filled by elements)
Design a query method with three parameters roo... | 4.09375 | 4 |
inferencia/util/reader/reader_factory.py | yuya-mochimaru-np/inferencia | 0 | 25605 | import os.path as osp
from .reader.video_reader import VideoReader
class ReaderFactory():
video_exts = [".mp4", ".avi", ".mov", ".MOV", ".mkv"]
def create(target_input, target_fps):
if osp.isfile(target_input):
ext = osp.splitext(target_input)[1]
if ext in ReaderFactory.video_... | 2.734375 | 3 |
src/utils.py | lubianat/complex_bot | 1 | 25606 | # Code modified from original by @jvfe (BSD2)
# Copyright (c) 2020, jvfe
# https://github.com/jvfe/wdt_contribs/tree/master/complex_portal/src
import math
import re
from collections import defaultdict
from ftplib import FTP
from functools import lru_cache, reduce
from time import gmtime, strftime
import pandas as pd
f... | 2.765625 | 3 |
tests/t_11_serial_test.py | llbxg/NIST-SP-800-22 | 0 | 25607 | import scipy.special as sc
from tests.src.utils import split_list, __print
# .11 Serial Test
def serial_test(key, n, m=3, b_print=True):
def compute(s,m):
if m == 0:
return 0
if m == 1: head = ''
else : head = s[0:(m-1)]
s = s + head
v = [0]*2**m
... | 2.765625 | 3 |
views/routes.py | macwille/python-chat-app | 1 | 25608 | <reponame>macwille/python-chat-app<gh_stars>1-10
from app import app
from views import subject_routes, room_routes, user_routes, message_routes
from models import user_service
from flask import Flask, flash, render_template, request, session, abort
from db import db
# Rest of the routes are imported from /views
@app... | 2.3125 | 2 |
ievv_opensource/ievv_i18n_url/i18n_url_utils/i18n_urlpatterns.py | appressoas/ievv_opensource | 0 | 25609 | <filename>ievv_opensource/ievv_i18n_url/i18n_url_utils/i18n_urlpatterns.py
import re
from django.urls import path, URLResolver
from django.conf import settings
from ievv_opensource.ievv_i18n_url import active_i18n_url_translation
from ievv_opensource.ievv_i18n_url.views import RedirectToLanguagecodeView
#
# Note: Ba... | 2.234375 | 2 |
test_autocorrelation.py | jacob975/TATIRP | 0 | 25610 | #!/usr/bin/python
'''
Program:
This is a test program for autocorrelation
Usage:
test_autocorrelation.py
Editor:
Jacob975
20181127
#################################
update log
'''
import numpy as np
import time
import matplotlib.pyplot as plt
from uncertainties import unumpy, ufloat
# Convert flux to mag... | 2.875 | 3 |
lambda/ecs-lifecycle-hook-launch.py | asilvas/ecs-cluster-manager | 47 | 25611 | # Copyright 2018 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://aws.amazon.com/apache2.0/
#
# or in the "license" file ac... | 2.171875 | 2 |
leetcode/ag_107.py | baobei813214232/common-alglib | 4 | 25612 | <gh_stars>1-10
from ojlib.TreeLib import *
class Solution(object):
def levelOrderBottom(self, root):
"""
:type root: TreeNode
:rtype: List[List[int]]
"""
if not root:
return []
def slu(root, level, ans):
if not root: return []
if l... | 2.953125 | 3 |
tests/test_main.py | joaogcs/python-project-template | 0 | 25613 | <reponame>joaogcs/python-project-template
# This is a sample Python script.
def test_print_hi():
assert True
| 1.304688 | 1 |
products/api/api.py | Arvind-4/E-commerce-REST-API | 0 | 25614 | <gh_stars>0
from django.shortcuts import render
from rest_framework.generics import (
ListAPIView,
RetrieveAPIView,
)
from rest_framework.views import APIView
from rest_framework.response import Response
from django.core import serializers
from django.http import Http404
from rest_framework.permissions import ... | 1.851563 | 2 |
main.py | adelhult/please-plot | 0 | 25615 | from traceback import print_exc
from uuid import uuid4
from flask import Flask, request, send_from_directory
from function_plot import *
app = Flask(__name__)
max_simultaneous_requests = 8
simultaneous_requests = 0
@app.route('/generate/')
def generate():
global simultaneous_requests
simultaneous_requests +... | 2.75 | 3 |
structmanager/optimization/genesis/utils.py | saullocastro/structmanager | 1 | 25616 | <filename>structmanager/optimization/genesis/utils.py<gh_stars>1-10
def format_float(x, size=8, lr):
"""Format a float number
Parameters
----------
x : float
The float number.
size : int, optional
Desired size of the output string.
lr : str ('<' or '>')
Indicates if it s... | 3.328125 | 3 |
mtwaffle/mtsite.py | leomiquelutti/mtwaffle | 0 | 25617 | import inspect
import sys
import numpy as np
import attrdict
from mtwaffle import graphs
from mtwaffle import mt
class Site(attrdict.AttrDict):
index_map = {
'xx': [0, 0],
'xy': [0, 1],
'yx': [1, 0],
'yy': [1, 1]
}
EXCLUDED_CALLABLES = ('between_freqs', )
def __in... | 2.3125 | 2 |
Testing/evaluate.py | codedecde/WordEmbeddings | 2 | 25618 | <gh_stars>1-10
import numpy as np
import heapq
def cosine(x, y):
eps = 1e-10
return np.dot(x, y) / np.sqrt((np.dot(x, x) * np.dot(y, y)) + eps)
def get_nearest_k(word, vocab, vocab_matrix, k=4, return_score=False):
k_nearest_neighbors = []
vector_word = vocab_matrix[vocab[word]]
for w in vocab:
... | 2.765625 | 3 |
src/chapter3/exercise1.py | group13bse1/BSE-2021 | 0 | 25619 | hours = input('Enter Hours \n')
rate = input('Enter Rate\n')
hours = int(hours)
rate = float(rate)
if (hours <= 40):
pay = rate*hours
else:
extra_time = hours - 40
pay = (rate*hours) + ((rate*extra_time)/2)
print('Pay: ', pay)
| 4.125 | 4 |
hello.py | nickstenning/hello-pyramid | 1 | 25620 | <gh_stars>1-10
from pyramid.config import Configurator
from pyramid.view import view_config
@view_config(route_name='index', renderer='templates/index.html.jinja2')
def index(request):
return {}
def create_app():
config = Configurator()
config.include('pyramid_jinja2')
config.add_route('index', '/')... | 2 | 2 |
src/pytheas/tasks/schema.py | dcronkite/pytheas | 0 | 25621 | def get_schema():
return {
'type': 'object',
'properties': {
'connections': {
'type': 'array',
'items': {
'type': 'object',
'properties': {
'name': {'type': 'string'},
... | 1.953125 | 2 |
src/autobridge/Floorplan/LegalizeFloorplan.py | mfkiwl/AutoBridge | 0 | 25622 | <filename>src/autobridge/Floorplan/LegalizeFloorplan.py
import logging
from collections import defaultdict
from typing import Dict, List, Tuple, Optional
from mip import Model, minimize, BINARY, xsum, OptimizationStatus, Var
from autobridge.Floorplan.Utilities import *
from autobridge.Opt.DataflowGraph import Vertex
f... | 2.375 | 2 |
tests/unit/spanner_dbapi/test_connect.py | larkee/python-spanner | 0 | 25623 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | 2.1875 | 2 |
section_3/5_magic_methods/main.py | hgohel/Python-for-Everyday-Life | 43 | 25624 | <reponame>hgohel/Python-for-Everyday-Life
# -*- coding: utf-8 -*-
# !/usr/bin/env python3
if __name__ == '__main__':
import money
# crafting money
euro = money.Money(1.0, 'EUR')
five_euros = money.Money(5.0, 'EUR')
ten_euros = money.Money(10.0, 'EUR')
dollar = money.Money(1.0, 'USD')
# mo... | 4 | 4 |
web-server/webserver/urls.py | ApLight/groenlandicus | 0 | 25625 | <reponame>ApLight/groenlandicus<gh_stars>0
"""webserver URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: ... | 2.6875 | 3 |
pasteScripts.py | alexanderbeatson/electiondashboard | 0 | 25626 | def main():
mainFile = open("index.html", 'r', encoding='utf-8')
writeFile = open("index_pasted.html", 'w+', encoding='utf-8')
classId = 'class="internal"'
cssId = '<link rel='
for line in mainFile:
if (classId in line):
pasteScript(line, writeFile)
elif (cssId in line):... | 3.09375 | 3 |
apps/core/views.py | InfinityLoopA-Z/BigBoxChallenge | 0 | 25627 | <reponame>InfinityLoopA-Z/BigBoxChallenge
from rest_framework import viewsets
from django_filters.rest_framework import DjangoFilterBackend
from . import models, serializers, filtersets, pagination
class ActivityViewSet(viewsets.ModelViewSet):
"""A viewset of Activity model"""
queryset = models.Activity.obje... | 2.125 | 2 |
hearthbreaker/cards/spells/neutral.py | souserge/hearthbreaker | 429 | 25628 | from hearthbreaker.cards.base import SpellCard
from hearthbreaker.constants import CHARACTER_CLASS, CARD_RARITY
from hearthbreaker.tags.base import BuffUntil, Buff
from hearthbreaker.tags.event import TurnStarted
from hearthbreaker.tags.status import Stealth, Taunt, Frozen
import hearthbreaker.targeting
class TheCoin... | 2.140625 | 2 |
srgan_pytorch/utils/transform.py | nisargshah1999/SRGAN-PyTorch | 2 | 25629 | # Copyright 2021 Dakewe Biotech Corporation. All Rights Reserved.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | 2.03125 | 2 |
dorado/ceres/ceresClass.py | Mucephie/DORADO | 0 | 25630 | <filename>dorado/ceres/ceresClass.py<gh_stars>0
import warnings
warnings.filterwarnings('ignore')
# import sys
# import os
import numpy as np
import ccdprocx
from astropy.time import Time
from astropy.table import QTable, Table
import astroalign as aa
from astropy.wcs import WCS
# from astropy.utils.console import Pro... | 1.921875 | 2 |
scrawl.py | I-mm/Lianjia-houseInfo | 0 | 25631 | import core
import model
import settings
def get_communitylist():
res = []
for community in model.Community.select():
res.append(community.title)
return res
if __name__ == "__main__":
regionlist = settings.REGIONLIST # only pinyin support
model.database_init()
core.GetHouseByRegionl... | 2.421875 | 2 |
monitoring/deployment_manager/systems/configuration.py | interuss/InterUSS-Platform | 0 | 25632 | from typing import Optional
from monitoring.monitorlib.typing import ImplicitDict
from monitoring.deployment_manager.systems.dss.configuration import DSS
from monitoring.deployment_manager.systems.test.configuration import Test
class KubernetesCluster(ImplicitDict):
name: str
"""Name of the Kubernetes clust... | 2.1875 | 2 |
src/Broker_Instance/streamer.py | zxq0404/Raven | 0 | 25633 | import zmq
def main():
try:
context = zmq.Context(1)
# Socket facing clients
frontend = context.socket(zmq.PULL)
frontend.bind("tcp://*:5556")
# Socket facing services
backend = context.socket(zmq.PUSH)
backend.bind("tcp://*:5557")
zmq.device(zmq.S... | 2.234375 | 2 |
tests/users/lists/items/test_people.py | mza921/trakt.py | 0 | 25634 | <filename>tests/users/lists/items/test_people.py
# flake8: noqa: F403, F405
from tests.core import mock
from trakt import Trakt
from trakt.objects import Person
from datetime import datetime
from dateutil.tz import tzutc
from hamcrest import *
from httmock import HTTMock
def test_basic():
with HTTMock(mock.fixt... | 2.1875 | 2 |
code-challanges/401/linked_list/ll_merge/ll_merge.py | schoentr/data-structures-and-algorithms | 0 | 25635 | from linked_list.linked_listf import LinkedList
def ll_merge(list_A, list_B):
curr_B = list_B.head
curr_A = list_A.head
temp_C = None
while curr_A._next and curr_B:
curr_B = list_B.head
temp_A = curr_A._next
temp_B = curr_B._next
# if curr_B._next._next:
# te... | 4.03125 | 4 |
wr_ks_reader.py | Kevin-Prichard/werobots-kickstarter-python | 1 | 25636 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json, sys, copy, os, re
import pprint
import locale
import csv
locale.setlocale(locale.LC_ALL, 'en_US')
from collections import defaultdict
from operator import itemgetter
pp = pprint.PrettyPrinter(indent=4)
# For MacPorts ... need to eliminate TODO
sys.path.append... | 2.859375 | 3 |
partialflow/utils.py | jakob-bauer/partialflow | 3 | 25637 | import time
class Timer(object):
def __init__(self):
self._start = 0
self._end = 0
def __enter__(self):
self._start = time.time()
return self
def __exit__(self, exc_type, exc_val, exc_tb):
self._end = time.time()
@property
def duration(self):
if s... | 3.78125 | 4 |
scripts/cloud/aws/ops-ec2-add-snapshot-tag-to-ebs-volumes.py | fahlmant/openshift-tools | 164 | 25638 | #!/usr/bin/env python
# vim: expandtab:tabstop=4:shiftwidth=4
"""
This is a script that can be used to tag EBS volumes in OpenShift v3.
This script assume that your AWS credentials are setup in ~/.aws/credentials like this:
[default]
aws_access_key_id = xxxx
aws_secret_access_key = xxxx
Or that environmen... | 2.203125 | 2 |
rush00/rush00/settings.py | ppichier/moviemon_game | 0 | 25639 | <reponame>ppichier/moviemon_game
"""
Django settings for rush00 project.
Generated by 'django-admin startproject' using Django 3.0.2.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.0... | 2.03125 | 2 |
test/jpypetest/test_jchar.py | baztian/jpype | 0 | 25640 | import _jpype
import jpype
import common
from jpype.types import *
class JChar2TestCase(common.JPypeTestCase):
def setUp(self):
common.JPypeTestCase.setUp(self)
def testCharRange(self):
self.assertEqual(ord(str(jpype.JChar(65))), 65)
self.assertEqual(ord(str(jpype.JChar(512))), 512)
... | 2.296875 | 2 |
pysensors.py | zakrzem1/pysensors | 0 | 25641 | #!/usr/bin/python
# Google Spreadsheet DHT Sensor Data-logging Example
# Depends on the 'gspread' package being installed. If you have pip installed
# execute:
# sudo pip install gspread
# Copyright (c) 2014 Adafruit Industries
# Author: <NAME>
# Permission is hereby granted, free of charge, to any person obtainin... | 2.078125 | 2 |
compare/utils.py | l0rb/buzzword | 0 | 25642 | """
Random utilities this app needs
"""
import os
import re
from buzz import Corpus as BuzzCorpus
from buzz import Collection
from django.conf import settings
from explore.models import Corpus
from .models import OCRUpdate, PDF
# from django.core.exceptions import ObjectDoesNotExist
# when doing OCR, re.findall wi... | 2.78125 | 3 |
apps/sitemap/__init__.py | MySmile/mysmile | 5 | 25643 | <filename>apps/sitemap/__init__.py
default_app_config = 'apps.sitemap.apps.SitemapConfig'
| 1.1875 | 1 |
extra_tests/snippets/stdlib_subprocess.py | dbrgn/RustPython | 11,058 | 25644 | import subprocess
import time
import sys
import signal
from testutils import assert_raises
is_unix = not sys.platform.startswith("win")
if is_unix:
def echo(text):
return ["echo", text]
def sleep(secs):
return ["sleep", str(secs)]
else:
def echo(text):
return ["cmd", "/C", f"echo {... | 2.421875 | 2 |
pythonProject1/chap2/demo8.py | zhudi7/pythonAK | 0 | 25645 | # 公众号:MarkerJava
# 开发时间:2020/10/5 17:25
scores = {'kobe': 100, 'lebron': 99, 'AD': 88}
# 获取所有key
keys = scores.keys()
print(keys)
print(type(keys))
print(list(keys)) # 将所有key组成的视图转换层列表
# 获取所有的值
value = scores.values()
print(value)
print(type(value)) # 将所有value组成的视图转换层列表
# 获取所有键值对
items = scores.items()
print(items... | 3.1875 | 3 |
src/command_modules/azure-cli-storage/tests/test_storage_blob_scenarios.py | saurabsa/azure-cli-old | 0 | 25646 | <gh_stars>0
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------... | 2.03125 | 2 |
fmtrack/post_process.py | elejeune11/FM-Track | 3 | 25647 | import fmtrack
import os
import matplotlib.colors as colors
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
import pickle
import pyvista
from sklearn.gaussian_process import GaussianProcessRegressor
from sklearn.gaussian_process.kernels import (RBF, Matern, RationalQuadratic,
... | 1.59375 | 2 |
chapter_6/C.py | staguchi0703/ALDS1 | 0 | 25648 | <gh_stars>0
# %%
# VScodeで入力をテキストから読み込んで標準入力に渡す
import sys
import os
f=open(r'.\chapter_6\C_input.txt', 'r', encoding="utf-8")
# inputをフルパスで指定
# win10でファイルを作るとs-jisで保存されるため、読み込みをutf-8へエンコードする必要あり
# VScodeでinput file開くとutf8になってるんだけど中身は結局s-jisになっているらしい
sys.stdin=f
#
# 入力スニペット
# num = int(input())
# num_list = [int(item)... | 3.140625 | 3 |
cloudformation/solution-assistant/src/lambda_function.py | NihalHarish/sagemaker-explaining-credit-decisions | 80 | 25649 | <filename>cloudformation/solution-assistant/src/lambda_function.py
import boto3
from pathlib import Path
import sys
sys.path.append('./site-packages')
from crhelper import CfnResource
import datasets
helper = CfnResource()
@helper.update
@helper.create
def on_create(event, _):
folderpath = Path("/tmp")
so... | 2.21875 | 2 |
rover/controls-systems/mobility/I2C_Test_Code_Enum.py | CSUFTitanRover/TitanRover2018 | 16 | 25650 | <filename>rover/controls-systems/mobility/I2C_Test_Code_Enum.py
import smbus
import time
from enum import Enum
# Sets enumerators and their values
class commands(Enum):
UNKNOWN_COMMAND = 0
LED = 1
SERVO = 2
# Initializes bus to smbus
bus = smbus.SMBus(1)
# This is the slave address we setup in the Arduin... | 3.609375 | 4 |
tests/test_matrix.py | avere001/dsplot | 8 | 25651 | <gh_stars>1-10
import os
import pytest
from dsplot.errors import InputException
from dsplot.matrix import Matrix
def test_matrix():
matrix = Matrix([[1, 2, 3], [4, 5, 6], [1, 2, 6]])
matrix.plot('tests/test_data/matrix.png')
assert 'matrix.png' in os.listdir('tests/test_data')
with pytest.raises(I... | 2.703125 | 3 |
odoo-13.0/addons/board/controllers/main.py | VaibhavBhujade/Blockchain-ERP-interoperability | 0 | 25652 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from lxml import etree as ElementTree
from odoo.http import Controller, route, request
class Board(Controller):
@route('/board/add_to_dashboard', type='json', auth='user')
def add_to_dashboard(self, action_id... | 2.078125 | 2 |
JSONFormatter.py | ejkim1996/Unity-JSON-Manager | 2 | 25653 | <reponame>ejkim1996/Unity-JSON-Manager<filename>JSONFormatter.py
import json
from tkinter import Tk
from tkinter.filedialog import askopenfilename
# Python script that allows user to select JSON file using TKinter and format it properly.
root = Tk()
filename = askopenfilename()
root.destroy() # Close the window
read... | 3.4375 | 3 |
webs/douban/tasks/__init__.py | billvsme/videoSpider | 216 | 25654 | from . import get_main_movies_base_data
from . import get_main_movies_full_data
from . import get_celebrities_full_data
from . import down_video_images
from . import down_celebrity_images
| 1.140625 | 1 |
examples/self_bot.py | LimeProgramming/defectio | 0 | 25655 | import defectio
client = defectio.Client()
@client.event
async def on_ready():
print("We have logged in.")
@client.event
async def on_message(message: defectio.Message):
if message.author == client.user:
return
if message.content.startswith("$hello"):
await message.channel.send("Hello!... | 2.3125 | 2 |
rtl/tests/test_log.py | kelceydamage/raspi-tasks | 1 | 25656 | <filename>rtl/tests/test_log.py
from rtl.tasks.log import log
from dummy_data import KWARGS, CONTENTS3
def test_log():
KWARGS = {
'operations': [
{
'a': 'b',
'column': 'c'
}
]
}
r = log(KWARGS, CONTENTS3)
assert r['c'][2] == 2.5649... | 2.28125 | 2 |
CollaborativeFiltering/CollaborativeFiltering.py | darwin-b/MachineLearning | 0 | 25657 |
import numpy as np
train_ratings_path = "./../Data/netflix/TrainingRatings.txt"
test_ratings_path = "./../Data/netflix/TestingRatings.txt"
map_users={}
map_titles={}
data_matrix = np.empty((28978,1821),dtype=np.float32)
data_matrix[:] = np.nan
with open(train_ratings_path,'r') as reader:
counter_titles=0
c... | 2.28125 | 2 |
sources/lectures.py | JhoLee/ecampus-manager | 1 | 25658 | <filename>sources/lectures.py
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'ui/lectures.ui'
#
# Created by: PyQt5 UI code generator 5.13.0
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.Qt import QMessageBox, QSize, QIcon... | 2.078125 | 2 |
my_cv/gesture_recognition/demo.py | strawsyz/straw | 2 | 25659 | <gh_stars>1-10
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
text = ax.text(0.5, 0.5, 'event', ha='center', va='center', fontdict={'size': 20})
def call_back(event):
# print( event.xdata, event.ydata)
info = 'name:{}\n button:{}\n x,y:{},{}\n xdata,ydata:{}{}'.format(event.name, event.button, even... | 2.90625 | 3 |
day16/part1.py | bugra-yilmaz/adventofcode2021 | 0 | 25660 | import os.path
import pytest
INPUT_TXT = os.path.join(os.path.dirname(__file__), 'input.txt')
def compute(s: str) -> int:
packet = s.strip()
packet = "".join([hexadecimal_to_binary(c) for c in packet])
versions = []
parse_packet(versions, packet, 0)
return sum(versions)
def parse_packet(vers... | 2.640625 | 3 |
tests/managers/test_equal_managers.py | microprediction/precise | 40 | 25661 | import random
from precise.skaters.managerutil.managertesting import manager_test_run
from precise.skaters.managers.equalmanagers import equal_daily_long_manager, equal_long_manager
from precise.skaters.managers.equalmanagers import equal_weekly_long_manager, equal_weekly_buy_and_hold_long_manager
from precise.skaterto... | 2.21875 | 2 |
model/fcgn/grasp_proposal_target.py | ZhangHanbo/Visual-Manipulation-Relationship-Network-Pytorch | 26 | 25662 | # --------------------------------------------------------
# Visual Detection: State-of-the-Art
# Copyright: <NAME>
# Licensed under The MIT License [see LICENSE for details]
# Written by <NAME>
# --------------------------------------------------------
import torch
import torch.nn as nn
import torch.nn.functional as ... | 1.851563 | 2 |
python-advanced/webscrap/wlog.py | Rokon-Uz-Zaman/thinkdiff_python_django | 92 | 25663 | # author: <NAME>
# code: https://github.com/mahmudahsan/thinkdiff
# blog: http://thinkdiff.net
# http://pythonbangla.com
# MIT License
# --------------------------
# Reporting Logs in text file
# --------------------------
import logging
def set_custom_log_info(filename):
logging.basicConfig(filename=filena... | 2.375 | 2 |
geoevents/core/management/commands/r3dumpdata.py | mcenirm/geoevents | 25 | 25664 | <reponame>mcenirm/geoevents<filename>geoevents/core/management/commands/r3dumpdata.py
# This technical data was produced for the U. S. Government under Contract No. W15P7T-13-C-F600, and
# is subject to the Rights in Technical Data-Noncommercial Items clause at DFARS 252.227-7013 (FEB 2012)
from django.core.management... | 1.703125 | 2 |
src/MostrarGrafica.py | VictorVaquero/sentimentAnalysis | 0 | 25665 | #!/usr/bin/env python
# coding: utf-8
# In[28]:
import matplotlib.pyplot as plt
import numpy as np
import csv
# In[32]:
listaHigh = []
listaLow = []
listaClose = []
contador = 0
lineas = len(open('GOOGLPrediccion.csv').readlines())
c = input()
if(int(c)!=0):
c = int(c)
else:
c = lineas
cantidad = linea... | 3.46875 | 3 |
src/Blog/settings/production.py | sadmanbd/wagtailblog | 1 | 25666 | from __future__ import absolute_import, unicode_literals
import os
from .base import *
DEBUG = False
SECRET_KEY = os.environ.get("SECRET_KEY")
try:
from .local import *
except ImportError:
pass
| 1.25 | 1 |
lookml/lookml.py | pythonruss/pylookml | 0 | 25667 | import re, os, shutil
import lookml.config as conf
import lkml
import time, copy
from string import Template
from lookml.modules.project import *
import lkml, github
def snakeCase(string):
str1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', string)
return re.sub('([a-z0-9])([A-Z])', r'\1_\2', str1).lower()
def splice... | 2.59375 | 3 |
chapter03/python/situation.py | coco-in-bluemoon/building-recommendation-engines | 0 | 25668 | <filename>chapter03/python/situation.py
from sklearn.metrics.pairwise import cosine_similarity
import numpy as np
import pandas as pd
# 1. Load Data and Item Profile
ratings = pd.read_csv('chapter03/data/movie_rating.csv')
movie_ratings = pd.pivot_table(
ratings,
values='rating',
index='title',
column... | 2.90625 | 3 |
tic_tac_toe/TD_lambda_run.py | Luca-Dambra/TD_lambda_board_games | 0 | 25669 | import functools
import numpy as np
import pandas as pd
from NN_base import load_network, save_network, create_network
from tic_tac_toe import TicTacToeGameSpec, play_game
from TD_lambda import TD_train
NETWORK_FILE_PATH = None
NUMBER_OF_GAMES_TO_RUN = 500
NUMBER_OF_TEST = 200
NUMBER_OF_ROUNDS = 100
EPSILON = 0.1
TA... | 2.578125 | 3 |
FinalProject_SANet/demo/net.py | lev1khachatryan/ASDS_CV | 5 | 25670 | import torch.nn as nn
import torch
from function import normal
from function import calc_mean_std
decoder = nn.Sequential(
nn.ReflectionPad2d((1, 1, 1, 1)),
nn.Conv2d(512, 256, (3, 3)),
nn.ReLU(),
nn.Upsample(scale_factor=2, mode='nearest'),
nn.ReflectionPad2d((1, 1, 1, 1)),
nn.Conv2d(256, 256,... | 2.15625 | 2 |
blaze/expr/scalar/interface.py | chdoig/blaze | 1 | 25671 | from __future__ import absolute_import, division, print_function
from ..core import Expr
from datashape import dshape
from .boolean import BooleanInterface
from .numbers import NumberInterface
class ScalarSymbol(NumberInterface, BooleanInterface):
__slots__ = '_name', 'dtype'
def __init__(self, name, dtype=... | 2.359375 | 2 |
2019/08-kosen/rev-favorites/solve.py | wani-hackase/wani-writeup | 25 | 25672 | def main():
seed = 0x1234
e = [0x62d5, 0x7b27, 0xc5d4, 0x11c4, 0x5d67, 0xa356, 0x5f84,
0xbd67, 0xad04, 0x9a64, 0xefa6, 0x94d6, 0x2434, 0x0178]
flag = ""
for index in range(14):
for i in range(0x7f-0x20):
c = chr(0x20+i)
res = encode(c, index, seed)
if... | 3.046875 | 3 |
WidgetsUnlimited/model/customer_address.py | AlanHorowitz/open-ended-capstone | 0 | 25673 | from psycopg2.extensions import TRANSACTION_STATUS_IDLE
from .metadata import Table, Column
from .customer import CustomerTable
class CustomerAddressTable(Table):
NAME = "customer_address"
def __init__(self):
super().__init__(
CustomerAddressTable.NAME,
Column(
... | 2.6875 | 3 |
src/data/spark/domain_length_sql.py | sheikhomar/mako | 0 | 25674 | <reponame>sheikhomar/mako
# Command to run this script on the CTIT cluster:
# $ spark-submit --master yarn --deploy-mode cluster --packages com.databricks:spark-csv_2.10:1.5.0 src/data/spark/domain_length_sql.py
from pyspark import SparkContext
from pyspark.sql import SQLContext
from pyspark.sql.functions import udf... | 2.390625 | 2 |
api/programs/result.py | ca2315/PlasmoCount | 0 | 25675 | <reponame>ca2315/PlasmoCount
from programs.viz import plot_labels, make_crop
import pandas as pd
from pathlib import Path
import time
class Result:
def __init__(
self,
id,
fname,
img,
pred,
n_digits=2,
color_dict={
... | 2.203125 | 2 |
tpp_twitter/twitter.py | SuperSonicHub1/twitter_plays_pyboy | 0 | 25676 | from dotenv import load_dotenv
import tweepy
from os import getenv
from typing import BinaryIO
BASE_BIO = "Inspired by @screenshakes. Powered by PyBoy: http://github.com/Baekalfen/PyBoy\n"
load_dotenv()
auth = tweepy.OAuthHandler(getenv('TWITTER_KEY'), getenv('TWITTER_SECRET'))
auth.set_access_token(getenv('TWITTER_... | 2.71875 | 3 |
ListNode.py | xinming365/LeetCode | 0 | 25677 | <gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2022/2/2 10:08 上午
# @Author : xinming
# @File : ListNode.py
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class MyLinkedList:
def __init__(self):
self.size = 0
self.dummy_head = ... | 3.875 | 4 |
samples/waitforupdates.py | ArpitSharma2800/pyvmomi-community-samples | 931 | 25678 | <reponame>ArpitSharma2800/pyvmomi-community-samples
#!/usr/bin/env python
#
# VMware vSphere Python SDK
# Copyright (c) 2008-2021 VMware, Inc. 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 co... | 2.171875 | 2 |
src/tests/cli/hypergol_create_test_case.py | hypergol/hypergol | 49 | 25679 | <gh_stars>10-100
import os
import glob
from pathlib import Path
from unittest import TestCase
from hypergol.name_string import NameString
def delete_if_exists(filePath):
if os.path.exists(filePath):
if os.path.isdir(filePath):
os.rmdir(filePath)
else:
os.remove(filePath)
... | 2.828125 | 3 |
examples/load_from_file/main.py | viniciuschiele/configd | 3 | 25680 | <reponame>viniciuschiele/configd
from central.config.file import FileConfig
config = FileConfig('config.json')
config.load()
print(config.get('timeout'))
print(config.get('database'))
print(config.get('database.host'))
print(config.get('database.port'))
| 1.976563 | 2 |
fbapp/views.py | shashank-sharma/facebook-comments | 0 | 25681 | from django.shortcuts import render
from getpage import *
from fbapp.models import Search, Clap
from django.http import Http404, HttpResponse
import json
# Create your views here.
def clap(request):
if request.is_ajax():
keyword = request.GET['keyword']
clap = Clap.objects.all()
if(len(clap) == 0):
clap = C... | 2.078125 | 2 |
Text_B_ocr_crnn_model_file/crnn/network_dnn.py | HAIbingshuai/chinese_ocr | 21 | 25682 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import numpy as np
import cv2
from Text_B_ocr_crnn_model_file.crnn.util import resizeNormalize, strLabelConverter
class CRNN:
def __init__(self, alphabet=None):
self.alphabet = alphabet
def load_weights(self, path):
ocrPath = path
ocrPat... | 2.796875 | 3 |
venta/admin.py | darkdrei/Inventario | 0 | 25683 | <filename>venta/admin.py<gh_stars>0
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib import admin
import models
import forms
from inventario import models as inventario
# Register your models here.
class DetalleInline(admin.StackedInline):
model = models.Detalle
form = forms... | 1.992188 | 2 |
Recipes/rcps/apps.py | ADKosm/Recipes | 0 | 25684 | from django.apps import AppConfig
class RcpsConfig(AppConfig):
name = 'rcps'
| 1.15625 | 1 |
tests/test_dotdict.py | datakortet/dkbuild-apacheconf | 0 | 25685 | # -*- coding: utf-8 -*-
import textwrap
import pytest
from dkbuild_apacheconf.dotdict import dotdict
def test_add_depth1():
dd = dotdict()
dd['hello'] = 42
print(dd)
assert dd.ctx == { 'hello': 42 }
def test_add_depth2():
dd = dotdict()
dd['hello.world'] = 42
print(dd)
assert dd.ct... | 2.578125 | 3 |
EM_GUI/parser5(void).py | AmirKavousi/EMspice | 2 | 25686 | <gh_stars>1-10
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
file1=open('data/u_Lvoid_20.txt',encoding='utf-8')
file2=open('temp2/void.txt','w',encoding='utf-8')
count=0
for line in file1:
count=count+1
if(line[0]=='R'):# 'line' here is a string
line_list=line.split( ) # 'line_list' is a list of sma... | 2.859375 | 3 |
ebi_eva_common_pyutils/variation/contig_utils.py | itsroops/eva-common-pyutils | 0 | 25687 | <filename>ebi_eva_common_pyutils/variation/contig_utils.py
# Copyright 2020 EMBL - European Bioinformatics Institute
#
# 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... | 2.328125 | 2 |
pswalker/sim/sim.py | ZLLentz/pswalker | 0 | 25688 | """
Simulated device classes
"""
from ophyd.device import Device, Component
from .signal import FakeSignal
class SimDevice(Device):
"""
Class to house components and methods common to all simulated devices.
"""
sim_x = Component(FakeSignal, value=0)
sim_y = Component(FakeSignal, value=0)
sim_... | 2.46875 | 2 |
clearKeys.py | kylephan/Utilities | 0 | 25689 | import maya.cmds as mc
def letsClear(*args):
obj = mc.ls(sl=True)
if all == True:
for o in obj:
clearTX(o)
clearTY(o)
clearTZ(o)
clearRX(o)
clearRY(o)
clearRZ(o)
else:
for o in obj: ... | 2.328125 | 2 |
server.py | boyuhou/security-data | 0 | 25690 | <reponame>boyuhou/security-data
import click
import logging
import datetime
import pandas as pd
from security_data import SecurityService
DATE_FORMAT = '%Y%m%d'
logging.basicConfig(format='%(asctime)s:%(levelname)s:%(message)s', level=logging.DEBUG, datefmt='%Y-%m-%d %I:%M:%S')
logger = logging.getLogger(__name__)
@... | 2.625 | 3 |
chemlib.py | nano-bio/fitlib | 0 | 25691 | from suds.client import Client
import suds
import time
import helplib as hl
#be aware that you need a chemspider_token.txt in the directory for the app to work
#the chemspider_token.txt should only contain the token (available online for free)
class ChemicalObject():
def __init__(self, name = '', cas = '', inchi... | 2.515625 | 3 |
src/lib/hxPy/py/hxpy/hxpy/hxpy.py | jamesdgessel/hxpy_adjustments | 35 | 25692 | <reponame>jamesdgessel/hxpy_adjustments
# -*- coding: utf-8 -*-
#
# Copyright (c) 2021, SkyFoundry LLC
# Licensed under the Academic Free License version 3.0
#
# History:
# 23 Jul 2021 <NAME> Creation
#
import socket
import struct
import traceback
from . import brio
from .haystack import Marker
from .haystack impo... | 2 | 2 |
util/legacypgsql.py | twonds/palaver | 4 | 25693 | <filename>util/legacypgsql.py
# Copyright (c) 2007 <NAME>, OGG, LLC
# See LICENSE.txt for details
# Converts the legacy muc spool to the new dirDBM one
import sys
from twisted.words.xish import domish, xpath
from twisted.words.protocols.jabber import jid
from twisted.enterprise import adbapi
from palaver import pala... | 2.125 | 2 |
gems/simple_args.py | Beatnukem/python-gems | 0 | 25694 | # 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 "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute,... | 1.921875 | 2 |
teetool/visual_2d.py | sfo/teetool | 9 | 25695 | ## @package teetool
# This module contains the Visual_2d class
#
# See Visual_2d class for more details
import numpy as np
from scipy.interpolate import griddata
import matplotlib.pyplot as plt
import teetool as tt
## Visual_2d class generates the 2d output using Matplotlib
#
# Even 3-dimensional trajectories can... | 3.171875 | 3 |
Algorithms/2. Implementation/18 - Climbing the Leaderboard.py | rosiejh/HackerRank | 0 | 25696 | <gh_stars>0
def climbingLeaderboard(scores, alice):
scores = list(reversed(sorted(set(scores))))
r, rank = len(scores), []
for a in alice:
while (r > 0) and (a >= scores[r - 1]):
r -= 1
rank.append(r + 1)
return rank | 3.5625 | 4 |
endsem/component_1/initial_parameters_estimator.py | maher460/cmu10601 | 1 | 25697 | import kmeans
import json
import numpy as np
NUM_GAUSSIANS = 32
DO_KMEANS = False
DEBUG = True
mixture_weights = [1.0/NUM_GAUSSIANS] * NUM_GAUSSIANS
if DEBUG:
print ("mixture_weights: ", mixture_weights)
print("Loading parsed data...")
traindata_processed_file = open("parsed_data/data1.universalenrollparsed", "... | 2.765625 | 3 |
backend/server/apps/endpoints/tests.py | BetikuOluwatobi/tweets_sentiment-analysis | 1 | 25698 | from django.test import TestCase
from .algorithm import Logistic_Regression
# Create your tests here.
class TestModelPredictions(TestCase):
def testPositive(self):
input = 'I am very happy today :)'
model = Logistic_Regression()
pred = model.predict_tweet(input)
self.assertEqual('positive',pred)
... | 2.875 | 3 |
githubly.py | kumaranvpl/githubly | 0 | 25699 | <reponame>kumaranvpl/githubly
import csv
import getpass
import json
import requests
import sys
from requests.auth import HTTPBasicAuth
class GithublyException(Exception):
def __init__(self, value):
self.value = value
def __str__(self):
return repr(self.value)
class Githubly:
def __init... | 3.21875 | 3 |