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 |
|---|---|---|---|---|---|---|
utils/bypass_csv.py | WishesFire/TelegramParser-flexible | 1 | 40600 | <filename>utils/bypass_csv.py
import pandas as pd
import numpy as np
from datetime import datetime
def iter_csv(file):
data_list = list(file)[1:]
full_date_list = create_full_date_list(data_list)
start, finish = data_list[0][2], data_list[-1][2]
specific_start, specific_finish = start[:10].split('-'),... | 3.3125 | 3 |
cs15211/CombinationSum.py | JulyKikuAkita/PythonPrac | 1 | 40601 | <filename>cs15211/CombinationSum.py
__source__ = 'https://leetcode.com/problems/combination-sum/description/'
# https://github.com/kamyu104/LeetCode/blob/master/Python/combination-sum.py
# Time: O(n^m)
# Space: O(m)
#
# Description: Leetcode # 39. Combination Sum
#
# Given a set of candidate numbers (C) and a target n... | 3.453125 | 3 |
apps/qt_kmeans_mysqlventage.py | eavelardev/my-dev-repo | 0 | 40602 | <gh_stars>0
import sys
import argparse
import pandas as pd
from random import randrange
import numpy as np
from PySide2.QtCore import QAbstractTableModel, QModelIndex, QRect, Qt
from PySide2.QtGui import QColor, QPainter
from PySide2.QtWidgets import (QApplication, QGridLayout, QHeaderView,
QTableView, QWidget, QV... | 2 | 2 |
api/migrations/0001_initial.py | CraftyGirls/REST-Services | 0 | 40603 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.Create... | 1.78125 | 2 |
probe_f8_eps.py | bskinn/list-of-flake8-entrypoints | 1 | 40604 | import importlib.metadata as ilmd
from textwrap import dedent
def main():
for key in ["flake8.extension", "flake8.report"]:
print(
dedent(
f"""
{key}
{'=' * len(key)}
{ilmd.entry_points().get(key, "(none)")}
"""
)
)
if __name__ == "__main__":
... | 1.828125 | 2 |
app/main.py | jshcrm/weasley-clock | 0 | 40605 | <gh_stars>0
import kivy
kivy.require('1.0.6')
import json
import subprocess
from datetime import datetime, timedelta
from glob import glob
from kivy.app import App
from kivy.clock import Clock
from kivy.core.window import Window
from kivy.logger import Logger
from kivy.uix.relativelayout import RelativeLayout
from ki... | 2.609375 | 3 |
handlers/users/check_for_plagiat.py | sololvey/editorbot | 2 | 40606 | from aiogram import types
from aiogram.dispatcher import FSMContext
from aiogram.dispatcher.filters import Command
from antiplagiat import Antiplagiat
from data.config import ADVEGO_TOKEN
from loader import dp, _
api = Antiplagiat(ADVEGO_TOKEN)
async def antiplagiator(text):
result = api.unique_text_add(text)
... | 2.359375 | 2 |
nikkiepy/sockets.py | NikkieDev/nikkiepy | 0 | 40607 | <gh_stars>0
import socket
import os
def connection_test(host, port):
host = host
port = port
s = socket.socket()
get_client_addr = socket.gethostname()
client_addr = socket.gethostbyname(get_client_addr)
client_name = os.environ["COMPUTERNAME"]
print(f"CONNECTING TO {host}:{port... | 3.5625 | 4 |
arjuna-samples/workspace/arjex-new/tests/s01_config_and_selenium_wrapper/y23_dropdown.py | test-mile/arjuna | 9 | 40608 | '''
Testers use 3 approaches for Dropdown controls in web test automation using Selenium.
1. Using Selenium's Select class as it provides higher level methods.
2. Using sendKeys() method of WebElement.
3. (Especially for custom select controls) - Click the drop down control and then click the option.
Arjuna tries to ... | 2.765625 | 3 |
ax/benchmark/benchmark_method.py | sparks-baird/Ax | 0 | 40609 | # Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from dataclasses import dataclass
from ax.exceptions.core import UserInputError
from ax.modelbridge.generation_strategy import GenerationSt... | 2.171875 | 2 |
2020/d12/d12.py | adam-blinzler/advent_of_code_2020 | 0 | 40610 | <reponame>adam-blinzler/advent_of_code_2020
md = [0,0]
facing = "E"
def rotate(cw, val):
idx = 4 + cw * int((val/90) % 4)
mv = ['E','S','W','N']
c = mv.index(facing)
return mv[(idx + c) % 4]
def move(dr, val):
global ew
global ns
global facing
if dr == 'N':
md[1] += val
... | 3.5625 | 4 |
Codeforces/C_Killjoy.py | anubhab-code/Competitive-Programming | 0 | 40611 | for _ in range(int(input())):
n,x = map(int,input().split())
l = list(map(int,input().split()))
flag=2
if len(set(l)) == 1 and l[0] == x:
flag=0
elif x in l or sum([i-x for i in l])==0:
flag=1
if flag==0:
print(0)
elif flag==1:
print(1)
else:
print... | 2.734375 | 3 |
examples/random_points_to_surface.py | YuliangXiu/bvh-distance-queries | 9 | 40612 | # -*- coding: utf-8 -*-
# Max-Planck-Gesellschaft zur Förderung der Wissenschaften e.V. (MPG) is
# holder of all proprietary rights on this computer program.
# You can only use this computer program if you have closed
# a license agreement with MPG or you get the right to use the computer
# program from someone who is... | 2.015625 | 2 |
msgcode/index2.py | MisterZhouZhou/pythonLearn | 1 | 40613 | import PIL.Image,PIL.ImageDraw,PIL.ImageFont,PIL.ImageFilter
import random
#随机字母
def rndchar():
return chr(random.randint(65, 90))
#random.randint()函数生成随机数字,数字范围为在65 到90内,在此范围内的美国标准信息编码是大写的A-Z
#chr(kk) 函数,kk为整数,asc编码值,函数返回asc编码为kk 的对应的字符
#随机颜色1
def rndcolor():
return random.randint(64, 255),random.randint(64... | 3.234375 | 3 |
2015/src/Advent2015_12.py | davidxbuck/advent2018 | 1 | 40614 | # Advent of Code 2015
#
# From https://adventofcode.com/2015/day/12
import json
import re
filename = ''
data = [re.findall(r'(-?\d+)', row.strip()) for row in open(f'../inputs/Advent2015_12{filename}.json', 'r')]
print(f"AoC 2015 Day 12, Part 1 answer is {sum(int(x[0]) for x in data if x)}")
with open(f'../inputs/A... | 3.390625 | 3 |
Code/problems/xomo/xomo.py | rahlk/Experimental-Algorithms | 0 | 40615 | <reponame>rahlk/Experimental-Algorithms<filename>Code/problems/xomo/xomo.py
from __future__ import print_function, division
import sys, os
sys.path.append(os.path.abspath("."))
from problems.problem import *
from cocomo import Cocomo
__author__ = 'panzer'
class XOMO(Problem):
"""
XOMO
"""
def __init__(self):
... | 3.328125 | 3 |
laser_align.py | larry12193/triangulation_scanner | 6 | 40616 | <gh_stars>1-10
#!/usr/bin/env python
import sys
import time
import random
import pigpio
import cv2
import imutils
import numpy as np
import math
class laser_align:
def __init__(self):
# Define system properties
self.servo_pin = 18
self.laser_pin = 16
self.min_width = 550
... | 2.5625 | 3 |
google/ads/google_ads/v0/proto/services/keyword_view_service_pb2_grpc.py | jwygoda/google-ads-python | 0 | 40617 | # Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc
from google.ads.google_ads.v0.proto.resources import keyword_view_pb2 as google_dot_ads_dot_googleads__v0_dot_proto_dot_resources_dot_keyword__view__pb2
from google.ads.google_ads.v0.proto.services import keyword_view_service_pb2 as goog... | 1.703125 | 2 |
web/backend/service/security.py | Vikort/neo4j-platform | 0 | 40618 | from typing import Optional
from werkzeug.security import check_password_hash
from .models.user import User
def authenticate(username, password) -> Optional[User]:
user = User.find_by_username(username)
if user and check_password_hash(user.hashed_password, password):
return user
return None
de... | 2.484375 | 2 |
Practicas/Practica 3/FuncionesRRD.py | NacxitCotuha/ASR-2022-4CM13 | 0 | 40619 | <gh_stars>0
import os
import time
# RRD Librerias
import rrdtool
from pysnmp.hlapi import *
# Extras Librerias
from FuncionesExtras import *
def pathRRD( host: str, comunidad: str ) -> str:
if not os.path.isdir(DIRECTORY_RRD):
os.mkdir(DIRECTORY_RRD)
return f"{DIRECTORY_RRD}/{host}_{comunidad}.rrd"
... | 2.0625 | 2 |
scripts/python/do_nothing.py | catforward/batch-launcher | 0 | 40620 | <gh_stars>0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os, sys
print("my id is %s. wrote by %s." % \
(sys.argv[1], os.getenv("PROC_TYPE", default = "unknown")))
sys.exit(0) | 2.1875 | 2 |
setup.py | spapas/django-git | 1 | 40621 | #!/usr/bin/env python
from setuptools import setup, find_packages
setup(
name='django-git',
version='0.1.0',
description='Get git information for your django repository',
author='<NAME>',
author_email='<EMAIL>',
license='MIT',
url='https://github.com/spapas/django-git/',
zip_safe=False... | 1.179688 | 1 |
py/legacyanalysis/cosmos-6x.py | manera/legacypipe | 32 | 40622 | from __future__ import print_function
from astrometry.util.fits import *
import pylab as plt
import numpy as np
from glob import glob
from astrometry.util.plotutils import *
from astrometry.libkd.spherematch import *
from astrometry.util.resample import *
from astrometry.util.util import *
ps = PlotSequence('cosmos')
... | 2.03125 | 2 |
examples/usage/expressionsB.py | rmorshea/viewdom | 0 | 40623 | <gh_stars>0
from viewdom import html, render
def make_bigly(name: str) -> str:
return f'BIGLY: {name.upper()}'
name = 'viewdom'
result = render(html('<div>Hello {make_bigly(name)}</div>'))
# '<div>Hello BIGLY: VIEWDOM</div>'
# end-before
expected = '<div>Hello BIGLY: VIEWDOM</div>'
| 2.796875 | 3 |
legacy/models/resnet/tensorflow2/train_tf2_resnet.py | kevinyang8/deep-learning-models | 129 | 40624 | <reponame>kevinyang8/deep-learning-models<filename>legacy/models/resnet/tensorflow2/train_tf2_resnet.py
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this
# software and associated documentation files (the "S... | 1.3125 | 1 |
luna_ml/api/model_yaml.py | luna-ml/luna-ml | 5 | 40625 | import yaml
class ModelYaml():
FileName = "model.yaml"
def __init__(
self,
yamlText: str
):
o = yaml.load(
yamlText,
Loader=yaml.SafeLoader
)
ModelYaml._shouldNotEmpty(o, [
"version",
"kind",
"nam... | 2.53125 | 3 |
torchpq/CustomModule.py | francisr/TorchPQ | 0 | 40626 | import torch
import torch.nn as nn
class CustomModule(nn.Module):
def __init__(self):
super(CustomModule, self).__init__()
def load_state_dict(self, state_dict):
for k, v in state_dict.items():
if "." not in k:
assert hasattr(self, k), f"attribute {k} does not exist"
delattr(self, k)... | 2.546875 | 3 |
faketests/slowtests/test_3.py | Djailla/pytest-sugar | 418 | 40627 | import time
import pytest
@pytest.mark.parametrize("index", range(7))
def test_cat(index):
"""Perform several tests with varying execution times."""
time.sleep(0.2 + (index * 0.1))
assert True
| 2.109375 | 2 |
ex09-pg/ex09-pg.py | s0tt/rl-course | 0 | 40628 | import gym
import numpy as np
import matplotlib.pyplot as plt
def policy(state, theta):
""" TODO: return probabilities for actions under softmax action selection """
h = state @ theta
return np.exp(h)/np.sum(np.exp(h))
def generate_episode(env, theta, display=False):
""" enerates one episode and ret... | 3.625 | 4 |
Bite 105. Slice and dice.py | Guznin/PyBites | 1 | 40629 |
"""
Take the block of text provided and strip off the whitespace at both ends. Split the text by newline (\n) using split.
Loop through the lines and if the first character of each (stripped) line is lowercase, split the line into words and add the last word to the (given) results list, stripping the trailing dot (.)... | 4 | 4 |
main/migrations/0009_auto_20180512_1403.py | jfilter/MDMA | 4 | 40630 | <reponame>jfilter/MDMA<filename>main/migrations/0009_auto_20180512_1403.py
# Generated by Django 2.0.5 on 2018-05-12 14:03
import django.core.validators
from django.db import migrations, models
import main.models
class Migration(migrations.Migration):
dependencies = [
('main', '0008_auto_20180507_2011')... | 1.8125 | 2 |
recipes/Python/577462_A_Buttonbar_program_with_color_/recipe-577462.py | tdiprima/code | 2,023 | 40631 | '''
;#template` {-path} {-menu} {-s1} {-s2} {-s3}
;#option`-path`Path to controlling file`F`c:\source\python\projects\menu\buttonbar.py`
;#option`-menu`Path to menu file`F`c:\source\python\projects\menu\test.ini`
;#option`-s1`First section`X`info`
;#option`-s2`Second section`X`help`
;#option`-s3`Third section`X`data`
;... | 1.570313 | 2 |
main.py | kaankarakoc42/neutron-tk | 0 | 40632 | <reponame>kaankarakoc42/neutron-tk<gh_stars>0
from Neutron import NeutronApp,tk,Rotate,Translate,Painter
from PIL import Image,ImageTk
color="#1c1d22"
maincolor="#1c1c1d"
imagepath="image.png"
image = Image.open(imagepath)
app=NeutronApp(800,400)
@app.setStartScreen
def rotateScreen():
app.maincanvas=tk.Can... | 2.671875 | 3 |
ghostwriter/ghtest/test_postarticle.py | arthurmco/ghostwriter | 0 | 40633 | import unittest
from ghostwriter import app, mm
#
# Post basic test fixture(?)
# Copyright (C) 2017 <NAME>
#
class PostArticleTestCase(unittest.TestCase):
from flask import json
def setUp(self):
mm.setDatabaseURI('sqlite:////tmp/unittest.db')
mm.init()
mm.create()
self.app ... | 2.875 | 3 |
getting_started.py | amit-timalsina/Generative-Python-Transformer | 0 | 40634 | <<<<<<< HEAD
from curtsies.fmtfuncs import cyan, bold
=======
>>>>>>> 9a201987d7a6490e552e7d03d8281330895ef733
from github import Github
import time
from datetime import datetime
import os
ACCESS_TOKEN = open('token.txt', 'r').read()
g = Github(ACCESS_TOKEN)
print(g.get_user())
<<<<<<< HEAD
end_time = time.time() - ... | 2.28125 | 2 |
docs/meta/update_doc.py | ZhihongShao/cotk | 0 | 40635 | import os
import path
def get_location(text):
lines = text.split("\n")
res = []
for line in lines:
if not line.startswith("~~ location"):
break
_, _, key, path = line.split()
res.append((key, path))
return res
def render(text, key):
lines = text.split("\n")
... | 2.953125 | 3 |
sessions/session 4/queue_publish_read.py | IceCrew-Source/BachelorDIM-Lectures-Algorithms-2020 | 0 | 40636 | import argparse
import os
import pika
from decouple import config
import importlib
simple_queue_read = importlib.import_module('simple_queue_read')
simple_queue_publish = importlib.import_module('simple_queue_publish')
URL = config('URL')
url = os.environ.get('CLOUDAMQP_URL', URL)
params = pika.URLParameters(url)
pa... | 2.5 | 2 |
src/plex_posters/__dev/__init__.py | dtomlinson91/plex_posters | 0 | 40637 | from __future__ import annotations
from .__version__ import __version__ # noqa
from .lib import export
from typing import Type, TypeVar, List, Dict
import praw # type: ignore
import requests
__all__ = [] # type: List
__header__ = 'plex_posters'
# __section__ = 'module'
T_movie_poster_porn_scraper = TypeVar(
'... | 2.921875 | 3 |
translate.py | KTH1234/deep_summ | 0 | 40638 | #!/usr/bin/env python
from __future__ import division, unicode_literals
import argparse
from onmt.translate.Translator import make_translator
import onmt.io
import onmt.translate
import onmt
import onmt.ModelConstructor
import onmt.modules
import onmt.opts
import timeit
def main(opt):
translator = mak... | 2.1875 | 2 |
test/aftershock_unittest.py | uofuseismo/shakemap-aqms | 0 | 40639 | <filename>test/aftershock_unittest.py
#!/usr/bin/env python
"""aftershock_unittest runs unit tests on the aftershock script in shakemap-aqms"""
import os
import unittest
import time
import logging
import sqlite3
from aftershock import aftershockDB
from shakemap.utils.config import get_config_paths
from shakemap_aqm... | 2.53125 | 3 |
app/measurement/migrations/0018_auto_20201013_2006.py | pnsn/squac_api | 6 | 40640 | # Generated by Django 2.2.16 on 2020-10-13 20:06
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('measurement', '0017_auto_20200609_0533'),
]
operations = [
migrations.RemoveIndex(
model_name='measurement',
name='measurem... | 1.273438 | 1 |
src/lava/lib/dl/slayer/neuron/norm.py | timcheck/lava-dl | 37 | 40641 | <filename>src/lava/lib/dl/slayer/neuron/norm.py
# Copyright (C) 2022 Intel Corporation
# SPDX-License-Identifier: BSD-3-Clause
"""Neuron normalization methods."""
import torch
class MeanOnlyBatchNorm(torch.nn.Module):
"""Implements mean only batch norm with optional user defined quantization
using pre-hook... | 2.609375 | 3 |
src/streaming-programs/01-wordsplit_map.py | gofore/aws-emr | 2 | 40642 | <gh_stars>1-10
#!/usr/bin/python
import sys
import re
# Test application to check whether EMR pipeline and reading the data works
# This code is from the EMR example:
# https://s3.amazonaws.com/elasticmapreduce/samples/wordcount/wordSplitter.py
def main(argv):
pattern = re.compile("[a-zA-Z][a-zA-Z0-9]*")
for ... | 2.578125 | 3 |
domonic/constants/keyboard.py | Jordan-Cottle/domonic | 1 | 40643 | <reponame>Jordan-Cottle/domonic<filename>domonic/constants/keyboard.py
"""
domonic.constants.keyboard
====================================
"""
class KeyCode():
A = '65' #:
ALTERNATE = '18' #:
B = '66' #:
BACKQUOTE = '192' #:
BACKSLASH = '220' #:
BACKSPACE = '8' #:
C = '67' ... | 2.46875 | 2 |
setup.py | jeffFranklin/linkbot | 1 | 40644 | from setuptools import setup
install_requires = ['beautifulsoup4',
'simplejson',
'slacker',
'jira',
'requests',
'websocket-client']
setup(name='linkbot',
install_requires=install_requires,
description='slac... | 1.1875 | 1 |
tests/__init__.py | hmpf/easydmp | 5 | 40645 | import django
# Now this is ugly.
# The django.db.backend.features that exist changes per version and per db :/
if django.VERSION[:2] == (2, 2):
has_sufficient_json_support = ('has_jsonb_agg',)
if django.VERSION[:2] == (3, 2):
# This version of EasyDMP is not using Django's native JSONField
# implementatio... | 2.203125 | 2 |
query_research/bound_variables.py | sjuenger/WikiMETA | 0 | 40646 | <reponame>sjuenger/WikiMETA
import glob
import json
# to hand over the bound variables of a quuery
# e.g. ["var4", "<http://www.w3.org/ns/prov#wasDerivedFrom>"]
# for :
#SELECT ?var1 ?var2Label ?var3
#WHERE {
# BIND ( <http://www.w3.org/ns/prov#wasDerivedFrom> AS ?var4 ).
# ?var5 ?var6 ?var4 .
# ?var5 <http... | 2.953125 | 3 |
metaci/build/migrations/0030_build_priority.py | sfdc-qbranch/MetaCI | 48 | 40647 | # Generated by Django 2.2.5 on 2019-10-01 15:52
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("build", "0029_build_org_note")]
operations = [
migrations.AddField(
model_name="build", name="priority", field=models.IntegerField(default=0)... | 1.367188 | 1 |
work/MTRIX/submit_to_queue3.py | youdar/work | 0 | 40648 | from __future__ import division
from libtbx.command_line import easy_qsub
from misc_scripts import helpers
from misc_scripts.r_factor_calc import *
from iotbx import pdb
import cPickle as pickle
import os
'''
Submit to queue all files with good MTRIX records that also havestracture factor files
'''
def run():
# se... | 2.09375 | 2 |
server/controllers/invites.py | omerk2511/dropbox | 4 | 40649 | <reponame>omerk2511/dropbox
import functools
import sqlite3 as lite
from common import Codes, Message
from controller import controller
from validators import validator, existing_group
from auth import authenticated, group_owner
from ..models import Groups, Users, UsersGroups, Invites
INVITE_PAYLOAD = [
('group',... | 2.640625 | 3 |
pandas/tests/indexes/timedeltas/test_partial_slicing.py | k-fillmore/pandas | 2 | 40650 | <gh_stars>1-10
import numpy as np
from pandas import Series, timedelta_range
import pandas._testing as tm
class TestSlicing:
def test_partial_slice(self):
rng = timedelta_range("1 day 10:11:12", freq="h", periods=500)
s = Series(np.arange(len(rng)), index=rng)
result = s["5 day":"6 day"]... | 2.53125 | 3 |
czsc/__init__.py | vercity/czsc | 1 | 40651 | # coding: utf-8
from .analyze import CZSC
from .traders.advanced import CzscAdvancedTrader
from .utils.ta import SMA, EMA, MACD, KDJ
from .objects import Freq, Operate, Direction, Signal, Factor, Event, RawBar, NewBar
from . import aphorism
__version__ = "0.8.17"
__author__ = "zengbin93"
__email__ = "<EMAIL>"
__date_... | 1.523438 | 2 |
restaurant/migrations/0004_remove_recipe_ingreiends.py | turgayh/Recipe-Share | 1 | 40652 | # Generated by Django 3.0.2 on 2020-01-25 19:30
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('restaurant', '0003_recipe_ingreiends'),
]
operations = [
migrations.RemoveField(
model_name='recipe',
name='ingreiends',
... | 1.4375 | 1 |
smirk/migrations/0001_initial.py | ahmsayat/CyberSeed | 0 | 40653 | # -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-10-08 01:12
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations... | 1.703125 | 2 |
hargreaves/session/__init__.py | dastra/hargreaves-sdk-python | 0 | 40654 | <reponame>dastra/hargreaves-sdk-python
import logging
from requests_tracker.session import WebSessionFactory
from requests_tracker.storage import ICookieStorage
from ..config.models import ApiConfiguration
from ..utils.cookies import HLCookieHelper
from ..session.shared import LoggedInSession
logging.getLogger(__nam... | 2.5 | 2 |
todo/settings/develop.py | bzd111/todolist | 0 | 40655 | <gh_stars>0
from .base import *
ALLOWED_HOSTS = ["localhost", "0.0.0.0", "127.0.0.1"]
| 1.210938 | 1 |
api server/server/routes/front_routes.py | rabo452/flipbook | 0 | 40656 | # routes for front-end part of project
from flask import url_for, render_template, request
from server import app
@app.route('/', methods = ['GET'])
def index_page():
return render_template('/front-end/index.html')
@app.route('/login', methods = ['GET'])
def login_page():
return render_templat... | 2.46875 | 2 |
osp/graphs/osp_graph.py | davidmcclure/open-syllabus-project | 220 | 40657 | <reponame>davidmcclure/open-syllabus-project
import networkx as nx
import random
from osp.common.utils import query_bar
from osp.graphs.graph import Graph
from osp.citations.models import Text, Citation, Text_Index
from osp.corpus.models import Document
from itertools import combinations
from peewee import fn
from ... | 2.578125 | 3 |
Project/src/uff/ic/mell/sentimentembedding/modelos/modelo_transformer.py | MeLL-UFF/tuning_sentiment | 2 | 40658 | from uff.ic.mell.sentimentembedding.utils.data_converstion_utils import convert_tensor2array
from uff.ic.mell.sentimentembedding.modelos.modelo import Modelo
import pandas as pd
import numpy as np
import torch
from enum import Enum
from tokenizers import ByteLevelBPETokenizer
class ModeloTransformer(Modelo):
# m... | 2.5 | 2 |
service/src/service/edit_distance.py | xuqiongkai/ALTER | 8 | 40659 | import editdistance
class EditDistanceService:
INSTACE = None
@classmethod
def create(cls):
if cls.INSTACE is None:
cls.INSTACE = EditDistanceService()
@classmethod
def instance(cls):
if cls.INSTACE is None:
cls.create()
return cls.INSTACE
def... | 3.3125 | 3 |
tf_rl/test/utils_test/memory_save_test.py | Rowing0914/TF2_RL | 8 | 40660 | import gym
from tf_rl.common.memory import ReplayBuffer
size = 100000
env = gym.make("CartPole-v0")
memory = ReplayBuffer(size=size, traj_dir="./traj/")
state = env.reset()
action = env.action_space.sample()
next_state, reward, done, info = env.step(action)
env.close()
for _ in range(size):
memory.add(state, acti... | 2.140625 | 2 |
stacking/1.binary/stack_xgb_lgb.py | huseinzol05/Machine-Learning-Data-Science-Reuse | 26 | 40661 | import numpy as np
import pandas as pd
from sklearn.model_selection import StratifiedKFold
import lightgbm as lgb
import xgboost as xgb
# read dataset
df_train = pd.read_csv('train.csv')
df_test = pd.read_csv('test.csv')
# gini function
def gini(actual, pred, cmpcol = 0, sortcol = 1):
assert( len(actual) == len(p... | 2.28125 | 2 |
sdk/python/pulumi_ovh/get_vps.py | legitbee/pulumi-ovh | 0 | 40662 | <reponame>legitbee/pulumi-ovh<filename>sdk/python/pulumi_ovh/get_vps.py
# 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... | 2.0625 | 2 |
config_projector.py | edmcdonagh/drumminhands_projector | 6 | 40663 | #!/usr/bin/env python
# configure these settings to change projector behavior
server_mount_path = '//192.168.42.11/PiShare' # shared folder on other pi
user_name = 'pi' # shared drive login user name
user_password = '<PASSWORD>' # shared drive login password
client_mount_path = '/mnt/pishare' # where to find the share... | 2.828125 | 3 |
Python3/0758-Bold-Words-in-String/soln.py | wyaadarsh/LeetCode-Solutions | 5 | 40664 | class Solution:
def boldWords(self, words, S):
"""
:type words: List[str]
:type S: str
:rtype: str
"""
m = len(S)
flags = [False] * m
for word in words:
n = len(word)
for i in range(m - n + 1):
if S[i:i + n] == w... | 3.078125 | 3 |
quest/util/misc.py | sdc50/quest | 12 | 40665 | import os
import re
import warnings
from uuid import uuid4, UUID
import shapely.geometry
import geopandas as gpd
import pandas as pd
import numpy as np
from geojson import LineString, Point, Polygon, Feature, FeatureCollection, MultiPolygon
try:
import simplejson as json
except ImportError:
import json
from ... | 2.71875 | 3 |
xvqa2.py | frkl/SOBERT-XVQA-demo | 2 | 40666 | import torch
import torch.nn as nn
import torch.nn.functional as F
import torchvision.models
import torchvision.datasets.folder
import torchvision.transforms as transforms
import torchvision.transforms.functional as Ft
from pytorch_transformers import BertTokenizer
import os
import db
from PIL import Image
import cv2
i... | 1.8125 | 2 |
fzutils/memory_utils.py | superonesfazai/fzutils | 11 | 40667 | <gh_stars>10-100
# coding:utf-8
'''
@author = super_fazai
@File : memory_utils.py
@connect : <EMAIL>
'''
"""
memory utils
"""
from pprint import pprint
from weakref import WeakKeyDictionary
from functools import wraps
from inspect import stack as inspect_stack
from traceback import extract_stack
from sys import _... | 2.484375 | 2 |
molecule/default/tests/test_default.py | tottoto/ansible-role-kubectl | 0 | 40668 | import os
import testinfra.utils.ansible_runner
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
def test_kubectl_is_installed(host):
kubectl = host.package('kubectl')
assert kubectl.is_installed
| 1.742188 | 2 |
lisa/web_api/producer.py | benbenwt/lisa_docker | 0 | 40669 | <reponame>benbenwt/lisa_docker
from kafka import KafkaProducer, KafkaConsumer
from kafka.errors import kafka_errors
import traceback
import json
def produce(topic,value):
producer = KafkaProducer(
bootstrap_servers=['172.18.65.187:9092'],
key_serializer=lambda k: json.dumps(k).encode(),
val... | 1.976563 | 2 |
lightgallery_caption.py | kellpossible/lightgallery-markdown-caption | 0 | 40670 | <reponame>kellpossible/lightgallery-markdown-caption
from markdown import Extension
from markdown.treeprocessors import Treeprocessor
from markdown.util import etree
import re
class ImagesTreeprocessor(Treeprocessor):
def __init__(self, md):
Treeprocessor.__init__(self, md)
def run(self, root):
... | 2.609375 | 3 |
core/screen/screenshot_image.py | echim/pySteps | 8 | 40671 | import cv2
import numpy as np
from pyautogui import screenshot
from pyautogui import size as get_screen_size
from core.screen.screen_rectangle import ScreenRectangle
class ScreenshotImage:
def __init__(self, in_region: ScreenRectangle = None):
screen_width, screen_height = get_screen_size()
regio... | 2.90625 | 3 |
detection/models/__init__.py | DoomsdayT/Raspberry-Pi-Fall-Detection | 1 | 40672 | from . import expert
| 1.117188 | 1 |
tests/port_tests/utils.py | synapticarbors/wagyu | 1 | 40673 | from typing import (List,
Tuple)
from tests.utils import (RawPointsList,
RawPolygon,
enum_to_values)
from wagyu.bound import Bound as PortedBound
from wagyu.box import Box as PortedBox
from wagyu.edge import Edge as PortedEdge
from wagyu.enums impor... | 1.96875 | 2 |
django_oneskyapp/management/commands/pullonesky.py | goteamup/django-oneskyapp | 0 | 40674 | <gh_stars>0
# -*- coding: utf-8 -*-
from django.conf import settings
from django.core import management
from django_oneskyapp.utils import OneSkyApiClientException, OneSkyApiClient
import os
class Command(management.base.BaseCommand):
help = "Updates your .po translation files using makemessages and uploads them t... | 2.078125 | 2 |
sparksetup/__init__.py | PKPDAI/PKDocClassifier | 10 | 40675 | <reponame>PKPDAI/PKDocClassifier<filename>sparksetup/__init__.py
from .sparkconf import spark
| 0.957031 | 1 |
setup/patch-install-rdf.py | BearerPipelineTest/zotero-better-bibtex | 0 | 40676 | #!/usr/bin/env python3
import glob
import json
import xml.dom.minidom as minidom
import json
install = minidom.parse('build/install.rdf')
ta = install.getElementsByTagNameNS('*', 'targetApplication')[0]
with open('schema/supported.json') as f:
min_version = json.load(f)
for client, version in min_version.items():... | 2.296875 | 2 |
python/import-data-url.py | wizzardz/vehicle-statistics-india | 0 | 40677 | import urllib.request
import json
import sys
import os
data = ''
url = sys.argv[1]
output_folder = sys.argv[2]
file_name = sys.argv[3]
with urllib.request.urlopen(url) as response:
data = response.read().decode('utf-8')
index = 1
filename = output_folder + '/' + file_name + '.json'
os.makedirs(os.path.dirname(fil... | 3.109375 | 3 |
opt.py | ArmandB/RITnet | 0 | 40678 | from pprint import pprint
import argparse
def parse_args():
parser = argparse.ArgumentParser()
# Data input settings
parser.add_argument('--dataset', type=str, default='Semantic_Segmentation_Dataset/', help='name of dataset')
# Optimization: General
parser.add_argument('--bs', type=int, default = ... | 2.390625 | 2 |
Face Cluster/Project/Validation folder/FaceDetection.py | adius0711/CVIP | 0 | 40679 | <gh_stars>0
import cv2
import argparse
import os
import numpy as np
import json
from colab import files
image_types = (".jpg", ".jpeg", ".png", ".bmp", ".tif", ".tiff")
def list_files(basePath, validExts=None, contains=None):
# loop over the directory structure
for (rootDir, dirNames, filenames) ... | 3.078125 | 3 |
concept/tools/decorator.py | Nachtfeuer/concept-py | 2 | 40680 | <reponame>Nachtfeuer/concept-py
"""
Decorator tools.
.. module:: decorator
:platform: Unix, Windows
:synopis: decorator tools.
.. moduleauthor:: <NAME> <<EMAIL>>
=======
License
=======
Copyright (c) 2015 <NAME>
Permission is hereby granted, free of charge, to any person obtaining a copy ... | 2.609375 | 3 |
reframe/core/schedulers/torque.py | stevenvdb/reframe | 0 | 40681 | # Copyright 2016-2020 Swiss National Supercomputing Centre (CSCS/ETH Zurich)
# ReFrame Project Developers. See the top-level LICENSE file for details.
#
# SPDX-License-Identifier: BSD-3-Clause
#
# Torque backend
#
# - Initial version submitted by <NAME>, <NAME> (VUB)
#
import re
import os
import time
import reframe.u... | 1.992188 | 2 |
env/lib/python3.8/site-packages/unidecode/x09a.py | avdhari/enigma | 82 | 40682 | <filename>env/lib/python3.8/site-packages/unidecode/x09a.py
data = (
'E ', # 0x00
'Cheng ', # 0x01
'Xin ', # 0x02
'Ai ', # 0x03
'Lu ', # 0x04
'Zhui ', # 0x05
'Zhou ', # 0x06
'She ', # 0x07
'Pian ', # 0x08
'Kun ', # 0x09
'Tao ', # 0x0a
'Lai ', # 0x0b
'Zong ', # 0x0c
'Ke ', # 0x0... | 1.359375 | 1 |
test_series_size.py | soothingjennyg/pandasTestingProject | 0 | 40683 | <gh_stars>0
import pandas as pd
import unittest
class TestSeriesSize(unittest.TestCase):
"""
Test the pandas.size property.
size returns the number of elements in the Series.
"""
def setUp(self):
self.series1 = pd.Series(1)
self.series2 = pd.Series([1, 2, 3])
self.series3 ... | 3.296875 | 3 |
dqn.py | justinmilner1/Connect4-master | 0 | 40684 | import random
import logging
import numpy as np
import tensorflow as tf
class DeepQNetworkModel:
def __init__(self,
session,
layers_size,
memory,
default_batch_size=None,
default_learning_rate=None,
default_epsil... | 2.734375 | 3 |
Test.py | pgDora56/MakeVirtualBlogArticle | 0 | 40685 | <reponame>pgDora56/MakeVirtualBlogArticle<filename>Test.py
import MeCab
with open(r"output\417\001.txt", encoding="utf-8") as f:
s = f.read()
m = MeCab.Tagger().parse(s)
print(m)
m = MeCab.Tagger().parse("[NEWLINE]")
print(m)
| 2.4375 | 2 |
oops_fhir/r4/value_set/contact_point_system.py | Mikuana/oops_fhir | 0 | 40686 | <filename>oops_fhir/r4/value_set/contact_point_system.py
from pathlib import Path
from fhir.resources.valueset import ValueSet as _ValueSet
from oops_fhir.utils import ValueSet
from oops_fhir.r4.code_system.contact_point_system import (
ContactPointSystem as ContactPointSystem_,
)
__all__ = ["ContactPointSyst... | 1.882813 | 2 |
django_db_meter/views.py | djangothon/django-db-meter | 0 | 40687 | import json
from django.conf import settings
from django.core.urlresolvers import reverse
from django.http import HttpResponse
from django.db.models import get_apps, get_models
from django.shortcuts import render
from django.core.serializers.json import DjangoJSONEncoder
from django_db_meter.models import DBQueryMetr... | 2.03125 | 2 |
demo.py | smartninja/smartninja-mongo | 0 | 40688 | <reponame>smartninja/smartninja-mongo<filename>demo.py<gh_stars>0
import datetime
from smartninja_mongo.bson import ObjectId
from smartninja_mongo.connection import MongoClient
from smartninja_mongo.odm import Model
client = MongoClient('mongodb://localhost:27017/')
db = client.my_database
collection = db.users
us... | 2.984375 | 3 |
scripts/extract_coll_format.py | therosko/Thesis-NER-in-English-novels | 0 | 40689 | <gh_stars>0
####################################################################################################################################################
# Flair Dekker
import pandas as pd
import os
import csv
# import own script
from hyphens import *
from patch_flair_parsing import *
from calculate_metrics ... | 2.625 | 3 |
ml_model_evaluation/__init__.py | nkaenzig/ml_model_evaluation | 0 | 40690 | <gh_stars>0
"""Top-level package for ML Model Evaluation Toolkit."""
__author__ = """<NAME>"""
__email__ = "<EMAIL>"
__version__ = "0.1.0"
| 0.75 | 1 |
ion/agents/mission_executive.py | ooici/coi-services | 3 | 40691 | <gh_stars>1-10
"""
@package ion.agents.mission_executive
@file ion/agents/mission_executive.py
@author <NAME>
@brief A class for the platform mission executive
"""
import calendar
import gevent
import yaml
import time
from time import gmtime
import pytz
from datetime import datetime
from pyon.agent.agent impor... | 2.234375 | 2 |
fewshot/experiments/utils.py | renmengye/oc-fewshot-public | 18 | 40692 | """
Training utilities.
Author: <NAME> (<EMAIL>)
"""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import glob
import os
import sys
import tensorflow as tf
import time
from google.protobuf.text_format import Merge, MessageToString
from fewshot.data.data... | 2.140625 | 2 |
tests/test_submit.py | o-andrieiev/Universum | 21 | 40693 | <reponame>o-andrieiev/Universum<gh_stars>10-100
# pylint: disable = redefined-outer-name
import copy
import os
import shutil
import pytest
from universum import __main__
from . import git_utils, perforce_utils, utils
def test_error_no_repo(submit_environment, stdout_checker):
settings = copy.deepcopy(submit_env... | 1.96875 | 2 |
python/hello-python/ko_message/__init__.py | le3t/ko-repo | 4 | 40694 | <filename>python/hello-python/ko_message/__init__.py
"""
如果打算让外部使用包的内容
需要在__init__.py中添加允许外面引用的文件
"""
from . import receive_message
from . import send_message
| 1.53125 | 2 |
setup.py | andrewwstephens/GNIRS-Pype | 2 | 40695 | <gh_stars>1-10
# Based on STScI's JWST calibration pipeline.
from __future__ import print_function
from setuptools import setup, find_packages, Extension, Command
from glob import glob
# Open the README as the package long description
readme = open('README.rst', 'r')
README_TEXT = readme.read()
readme.close()
NAME =... | 1.742188 | 2 |
eudex/core.py | remiadon/eudex | 1 | 40696 | <reponame>remiadon/eudex
# Author: <NAME> <<EMAIL>>
# License: BSD 3 clause
def binary_to_int(b):
if isinstance(b, int):
return b
else:
return int(b, 2)
def char_code(s, idx=0):
return ord(s[idx])
PHONES = [
# +--------- Confident
# |+-------- Labial
# ||+------- Liquid
... | 2.75 | 3 |
berlin52sample/GA.py | sridhar9800/SymTSP | 1 | 40697 | # The original GA algorithm is here:
import numpy as np, random, operator, pandas as pd, matplotlib.pyplot as plt
import math
class City:
def __init__(self, x, y):
self.x = x
self.y = y
def distance(self, city):
xDis = abs(self.x - city.x)
yDis = abs(self.y - city.y)
... | 3.28125 | 3 |
test_query.py | kosugi/alfred.y-transit | 2 | 40698 | <gh_stars>1-10
# -*- coding: utf-8 -*-
import unittest
import re
from query import *
def squeeze(value):
value = value.replace('\r', '')
value = value.replace('\n', '')
return value
class QueryTestCase(unittest.TestCase):
def test_parse_names(self):
self.assertEqual(None, parse_names(u''))
... | 3 | 3 |
pgAdmin/pgadmin4/pkg/pip/setup_pip.py | WeilerWebServices/PostgreSQL | 0 | 40699 | <filename>pgAdmin/pgadmin4/pkg/pip/setup_pip.py
#########################################################################
#
# pgAdmin 4 - PostgreSQL Tools
#
# Copyright (C) 2013 - 2020, The pgAdmin Development Team
# This software is released under the PostgreSQL Licence
#
##############################################... | 1.632813 | 2 |