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 |
|---|---|---|---|---|---|---|
MNIST/CNNClassifiaction.py | AliLotfi92/InfoMax_VAE | 8 | 12789851 |
import torch
from torch.autograd import Variable
import torch.nn as nn
from torchvision import datasets, transforms
from torch.utils.data import DataLoader
import torch.optim as optim
import math
import numpy as np
import os
import torch.nn.functional as F
import torch.nn.init as init
import matplotlib.pyplot as plt
... | 2.84375 | 3 |
binary_search.py | giuliasindoni/Algorithm-runtimes | 1 | 12789852 | import math
from quick_sort import quick_sort
import numpy
import time
import matplotlib.pyplot as plt
def binary_search(sortedarray, key):
left = 0
right = len(sortedarray) - 1
while left <= right:
mid = math.floor((left + right) / 2)
if key == sortedarray[mid]:
return mid
else:
if key < sortedarray[mi... | 3.6875 | 4 |
unittests/test_reporting_server.py | stepanandr/taf | 10 | 12789853 | # Copyright (c) 2011 - 2017, Intel Corporation.
#
# 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 agre... | 1.921875 | 2 |
python/en/archive/dropbox/miscellaneous_python_files/data4models_old_old.py | aimldl/coding | 0 | 12789854 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
data4models.py
# Sentiment Indentification for Roman Urdu
'''
import numpy as np
import pandas as pd
class Data:
# Constructor
def __init__( self, config ):
self.config = config
def split( self, df ):
'''
Sp... | 3.234375 | 3 |
rfcommands/cli/merge.py | ribosomeprofiling/RFCommands | 1 | 12789855 | <reponame>ribosomeprofiling/RFCommands<gh_stars>1-10
# -*- coding: utf-8 -*-
from .main import *
from ..merge.bowtie2_logs import merge_bowtie2_logs
from ..merge.overall_stats import merge_overall_stats
@cli.group()
def merge():
"""
Merges logs and csv files.
"""
pass
@merge.command()
@click.argument... | 2.46875 | 2 |
blockchains-cryptos/BTC_P2PKH_sigvef_eg.py | black-wolfie/blockchain-with-python-3 | 2 | 12789856 | # -*- coding: utf-8 -*-
"""
Created on Wed Jul 4 22:46:11 2018
"""
import BTC_P2PKH_sigvef as bv
# verifying two P2PKH Bitcoin signed messages
address = 'bitcoin:16vqGo3KRKE9kTsTZxKoJKLzwZGTodK3ce'
signature = ('HPDs1TesA48a9up4QORIuub67VHBM37X66skAYz0Esg23gdfMu'+
'CTYDFORc6XGpKZ2/flJ2h/DUF569FJxGoVZ50=')
me... | 2.640625 | 3 |
diayn/post_epoch_funcs/df_env_eval.py | fgitmichael/SelfSupevisedSkillDiscovery | 0 | 12789857 | <gh_stars>0
import numpy as np
import matplotlib.pyplot as plt
import torch
import torch.nn.functional as F
from diayn_cont.post_epoch_funcs.df_env_eval import DfEnvEvaluationDIAYNCont
import rlkit.torch.pytorch_util as ptu
from rlkit.samplers.data_collector.path_collector import MdpPathCollector
import self_supervi... | 1.992188 | 2 |
app/blueprints/api/v1/ag/__init__.py | Info-ag/labplaner | 7 | 12789858 | '''
basic blueprint routes for interacting with an AG
'''
# import third party modules
import re
from flask import Blueprint, request, jsonify, g, url_for, flash, redirect
from sqlalchemy.sql import exists, and_
from werkzeug.exceptions import BadRequest, PreconditionFailed
# import database instance
from app.models i... | 2.59375 | 3 |
invoked_dragoon.py | nisegami/dart-consistency-checker | 0 | 12789859 | from typing import List, Optional, Tuple
from framework import CardGroup, CardType, DeckList, Disruption, Manager, Card, Game
class InvokedDragoonManager(Manager):
# Invoked
aleister = Card("Aleister the Invoker", CardType.MONSTER)
invocation = Card("Invocation", CardType.SPELL)
meltdown = Card("Magic... | 2.375 | 2 |
py/g1/messaging/g1/messaging/parts/inprocs.py | clchiou/garage | 3 | 12789860 | <filename>py/g1/messaging/g1/messaging/parts/inprocs.py
from g1.bases import labels
from ..reqrep import inprocs
SERVER_LABEL_NAMES = (
# Input.
'server',
)
def define_server(module_path=None):
module_path = module_path or inprocs.__name__
module_labels = labels.make_labels(module_path, *SERVER_LABE... | 1.90625 | 2 |
src/data.py | szarta/stars-reborn | 0 | 12789861 | """
data.py
Contains and owns the loading and in-memory storage of all of the
pre-defined game data.
:author: <NAME>
:license: MIT, see LICENSE.txt for more details.
"""
import json
import jsonpickle
import gzip
Technologies = {}
Language_Map = {}
def load_language_map(filepath):
f = open(f... | 2.59375 | 3 |
mlxtend/mlxtend/_base/__init__.py | WhiteWolf21/fp-growth | 0 | 12789862 | # <NAME> 2014-2020
# mlxtend Machine Learning Library Extensions
# Author: <NAME> <<EMAIL>>
#
# License: BSD 3 clause
from ._base_model import _BaseModel
from ._cluster import _Cluster
from ._classifier import _Classifier
from ._regressor import _Regressor
from ._iterative_model import _IterativeModel
from ._multiclas... | 1.039063 | 1 |
apps/challenge/resources.py | mehrbodjavadi79/AIC21-Backend | 3 | 12789863 | from django.conf import settings
from import_export import resources, fields
from .models import Match
class MatchResource(resources.ModelResource):
team1 = fields.Field(attribute='team1__name',
column_name='team1')
team2 = fields.Field(attribute='team2__name',
... | 2.1875 | 2 |
dataset/index_file_by_accession.py | fubiye/edgar-abs-kg | 0 | 12789864 | import os
import json
BASE_DIR = r'D:\data\edgar\sampling\Archives\edgar\data'
if __name__ == '__main__':
index = dict()
for cik in os.listdir(BASE_DIR):
for accession in os.listdir(os.path.join(BASE_DIR, cik)):
for fileName in os.listdir(os.path.join(BASE_DIR, cik, accession)):
... | 2.609375 | 3 |
area51/apps.py | tailorv/neighbourshood | 0 | 12789865 | <gh_stars>0
from django.apps import AppConfig
class HoodappConfig(AppConfig):
name = 'area51'
def ready(self):
import area51.signals | 1.390625 | 1 |
model/load_data.py | Seraphyx/senti | 0 | 12789866 | <reponame>Seraphyx/senti<gh_stars>0
import csv
import sklearn
from sklearn.datasets import load_files
data_path = "../data/raw/movie_reviews"
class data(object):
def __init__(self, file=None, dataset=None):
self.file = file
self.dataset = dataset
self.read_dataset()
def read_tsv(self):
with open(self.fi... | 3.09375 | 3 |
docker/app/boto-ecs.py | 094459/blogpost-airflow-hybrid | 1 | 12789867 | <filename>docker/app/boto-ecs.py
import boto3
import json
# Thanks to https://hands-on.cloud/working-with-ecs-in-python-using-boto3/ for a good cheatsheet
client = boto3.client("ecs", region_name="eu-west-2")
## create a new task in ecs
response = client.register_task_definition(
containerDefinitions=[
... | 2.515625 | 3 |
exos/isn/ds1.py | ewen-lbh/school-stuff | 0 | 12789868 | x = 237
a = int(x / 100)
x = x - 100 * a
b = int(x / 10)
x = x - 10 * b
c = x
Resultat = a + b * 10 + c * 100
print(Resultat)
# >>> 732
L = [12, 8, 19, 7, 3, 10]
Resultat = [20 - L[i] for i in range(len(L))]
print(Resultat)
## >>> [8, 12, 1, 13, 17, 10]
Resultat = 0
for i in range(5):
Resultat += i + 1
print(... | 3.34375 | 3 |
build.py | iscc/iscc-core | 5 | 12789869 | <gh_stars>1-10
# -*- coding: utf-8 -*-
"""
Build cython extension modules.
The shared library can also be built manually using the command:
$ cythonize -X language_level=3 -a -i ./iscc_core/cdc.py
$ cythonize -X language_level=3 -a -i ./iscc_core/minhash.py
$ cythonize -X language_level=3 -a -i ./iscc_core/simhash.py
... | 2.15625 | 2 |
ctrl-alt-del.py | troglobit/awesome-config | 5 | 12789870 | <filename>ctrl-alt-del.py<gh_stars>1-10
#!/usr/bin/env python
import pygtk
pygtk.require('2.0')
import gtk
import os
if __name__ == "__main__":
dialog = gtk.MessageDialog(type=gtk.MESSAGE_WARNING)
dialog.set_position(gtk.WIN_POS_CENTER)
dialog.set_markup("<big><b>Shutdown computer now?</b></big>")
dia... | 2.734375 | 3 |
malcolm/modules/ADPandABlocks/parts/pandablocksdriverpart.py | MattTaylorDLS/pymalcolm | 0 | 12789871 | <reponame>MattTaylorDLS/pymalcolm
from malcolm.modules.ADCore.parts import DetectorDriverPart
from .pandablockschildpart import PandABlocksChildPart
class PandABlocksDriverPart(DetectorDriverPart, PandABlocksChildPart):
pass
| 1.445313 | 1 |
crud/migrations/0009_auto_20210701_0910.py | TownOneWheel/townonewheel | 0 | 12789872 | <filename>crud/migrations/0009_auto_20210701_0910.py
# Generated by Django 3.2.4 on 2021-07-01 09:10
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('crud', '0008_auto_20210701_0715'),
]
operations = [
migrations.AlterField(
... | 1.671875 | 2 |
investing_algorithm_framework/app/stateless/action_handlers/action_handler_strategy.py | investing-algorithms/investing-algorithm-framework | 1 | 12789873 | <reponame>investing-algorithms/investing-algorithm-framework
from abc import ABC, abstractmethod
class ActionHandlerStrategy(ABC):
@abstractmethod
def handle_event(self, payload, context):
pass
| 2.078125 | 2 |
atmosnet/utils.py | dnidever/atmosnet | 0 | 12789874 | <gh_stars>0
#!/usr/bin/env python
"""UTILS.PY - Utility functions
"""
from __future__ import print_function
__authors__ = '<NAME> <<EMAIL>>'
__version__ = '20210605' # yyyymmdd
import os
impo... | 2.328125 | 2 |
app/blueprints/sample_h5_api/v_user.py | lvyaoo/wx-open-project | 0 | 12789875 | <reponame>lvyaoo/wx-open-project
# -*- coding: utf-8 -*-
from flask import g
from . import bp_sample_h5_api
from .decorators import login_required
from ...api_utils import *
@bp_sample_h5_api.route('/current_user/', methods=['GET'])
@login_required
def get_current_user():
"""
获取当前微信用户详情
:return:
"""... | 2.109375 | 2 |
setup.py | WangTingZheng/explorer | 17 | 12789876 | import setuptools
with open("README.md", "r", encoding="UTF-8") as fh:
long_description = fh.read()
setuptools.setup(
name="file-explorer",
version="0.0.0",
author="WangTingZheng",
author_email="<EMAIL>",
description="A simple python cli file browser",
long_description=long_description,
... | 1.585938 | 2 |
warbend/game/mount_and_blade/native/__init__.py | int19h/warbend | 4 | 12789877 | from __future__ import absolute_import, division, print_function
import sys
from ....data import root, parent, transaction
from ...module_system import *
from ... import save
from .. import records
from .slots import Slots
globals().update(records(Slots()))
def load(*args, **kwargs):
from ... import load
r... | 1.828125 | 2 |
external/simpleWpsApp/pse_server/flow/urls.py | Ueda-Ichitaka/workflowPSE | 0 | 12789878 | <gh_stars>0
from django.conf.urls import url, include
from . import views
urlpatterns = [
# Serve web app
url(r'^$', views.index),
# Service api
url(r'^service/$', views.ServiceList.as_view()),
url(r'^service/(?P<pk>[0-9]+)/$', views.ServiceDetail.as_view()),
# Service Provider api
url(r'... | 1.75 | 2 |
trik/ya/regularization.py | hellotrik/trik | 0 | 12789879 | from ..sheng import V,Pow,Mul,ReduceSum,Abs
class RegularizationLayer:
def regularization_term(self, *args, **kwargs):
pass
class RegularizationL1(RegularizationLayer):
@staticmethod
def regularization_term(target_symbol: V, decay: float):
return target_symbol(Abs())(ReduceSum())(Mul(),d... | 2.875 | 3 |
task_0/3_euclidean_distance.py | Shobuj-Paul/Strawberry-Stacker | 0 | 12789880 | #Given 2 points (x1,y1) and (x2,y2), where x1, x2 are x-coordinates
#and y1, y2 are y-coordinates of the points.
#Your task is to compute the Euclidean distance between them.
#The distance computed should be precise up to 2 decimal places.
from math import sqrt
def compute_distance(x1, y1, x2, y2):
distance = sq... | 3.921875 | 4 |
solutions/0136.single-number/single-number.py | cocobear/LeetCode-in-Python | 0 | 12789881 | #
# @lc app=leetcode id=136 lang=python3
#
# [136] Single Number
#
from __future__ import annotations
# @lc code=start
class Solution:
def singleNumber(self, nums: List[int]) -> int:
res = nums[0]
for i in nums[1:]:
res ^= i
return res
tests = [
([2,2,1], 1),
... | 3.109375 | 3 |
signalr/hubs/__init__.py | talboren/signalr-client-py | 58 | 12789882 | from ._hub import Hub
| 1.117188 | 1 |
pygame/pong.py | sheepman39/school | 3 | 12789883 | <filename>pygame/pong.py<gh_stars>1-10
import pygame, random, sys
# this is based off of a tutorial from https://www.youtube.com/watch?v=Qf3-aDXG8q4
# starts pygame
pygame.mixer.pre_init(44100, -16, 2, 512)
pygame.init()
clock = pygame.time.Clock()
# main window
screen_width = 1280
screen_height = 960
screen = pygame... | 3.5625 | 4 |
py/stats_scanner.py | MarcGumowski/WorldCup2018TrueSkill | 2 | 12789884 | # ---------------------------------------------------------------------------- #
# World Cup: Stats scanner
# Ver: 0.01
# ---------------------------------------------------------------------------- #
#
# Code by <NAME>
#
# ---------------------------------------------------------------------------- #
import os
impor... | 2.265625 | 2 |
src/unsnap/decryptor.py | raschle/SnappyDecompiler | 1 | 12789885 | <reponame>raschle/SnappyDecompiler
import math, bz2, os
from snaplib.ppcrypto import ARC4
# _SNAPPY_EXPORT_KEY
encoder = ARC4("SynapseExport" + str(math.pi))
def decryptSnapSpy(file):
(filename_and_path, extension) = os.path.splitext(file)
with open(file, "rb") as binary_file:
data = binary_file.read... | 2.875 | 3 |
src/tools/dev/redmine/pyrmine/src/Connection.py | eddieTest/visit | 0 | 12789886 | <filename>src/tools/dev/redmine/pyrmine/src/Connection.py<gh_stars>0
#!/usr/bin/env python
#
# file: Connection.py
# author: <NAME> <<EMAIL>>
# created: 6/1/2010
# purpose:
# Provides a 'Connection' class that interacts with a redmine instance to
# extract results from redmine queries.
#
import urllib2,urllib,csv,ge... | 2.75 | 3 |
tests/integration_tests/conftest.py | TheCodeSummoner/dof-discord-bot | 2 | 12789887 | """
Configuration module containing pytest-specific hooks.
"""
import os
import logging
from . import helpers
from _pytest.config import Config as PyTestConfig
from dof_discord_bot.src.logger import Log
from dof_discord_bot.src import logger
def _reconfigure_logging():
"""
Helper function used to redirect all... | 2.515625 | 3 |
settings.py | psf/bpo-rietveld | 0 | 12789888 | <reponame>psf/bpo-rietveld
# Django settings for django_gae2django project.
# NOTE: Keep the settings.py in examples directories in sync with this one!
import os, ConfigParser, re, subprocess
DEBUG = False
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('<NAME>', '<EMAIL>'),
)
MANAGERS = ADMINS
_c = ConfigParser.ConfigP... | 1.921875 | 2 |
tests/test_utilities.py | andymeneely/attack-surface-metrics | 16 | 12789889 | import copy
import os
import unittest
import networkx as nx
from attacksurfacemeter import utilities
from attacksurfacemeter.call import Call
from attacksurfacemeter.call_graph import CallGraph
from attacksurfacemeter.environments import Environments
from attacksurfacemeter.loaders.cflow_loader import CflowLoader
fro... | 2.40625 | 2 |
output/models/ms_data/regex/regex_test_535_xsd/__init__.py | tefra/xsdata-w3c-tests | 1 | 12789890 | from output.models.ms_data.regex.regex_test_535_xsd.regex_test_535 import Doc
__all__ = [
"Doc",
]
| 1.039063 | 1 |
kodialect/models/textcnn/configuration_textcnn.py | jinmang2/KoBART-dialect | 3 | 12789891 | from transformers.configuration_utils import PretrainedConfig
class TextCNNConfig(PretrainedConfig):
def __init__(
self,
vocab_size=30000,
embed_dim=300,
filter_sizes=[1,2,3,4,5],
num_filters=[128]*5,
dropout=0.5,
num_labels=2,
id2label={0:"standard"... | 2.53125 | 3 |
com/Leetcode/728.SelfDividingNumbers.py | samkitsheth95/InterviewPrep | 0 | 12789892 | <reponame>samkitsheth95/InterviewPrep
from typing import List
class Solution:
def isValid(self, a):
theNum = a
while a > 0:
temp = a % 10
if not temp or theNum % temp:
return False
a = a // 10
return True
def selfDividingNumbers(sel... | 3.875 | 4 |
Project/dailyFresh/myDailyFresh/apps/goods/migrations/0002_auto_20210305_1756.py | chaofan-zheng/python_learning_code | 0 | 12789893 | # Generated by Django 2.2.17 on 2021-03-05 09:56
from django.db import migrations
import tinymce.models
class Migration(migrations.Migration):
dependencies = [
('goods', '0001_initial'),
]
operations = [
migrations.AlterModelOptions(
name='goodstest',
options={'v... | 1.429688 | 1 |
py3odb/cli/command.py | opus49/py3odb | 1 | 12789894 | """Module for abstract Command class to support argument parsing."""
from abc import ABC, abstractmethod
from argparse import RawTextHelpFormatter
class Command(ABC):
"""Abstract class that defines a command for argument parsing."""
help_text = None
def __init__(self, subparsers):
self.subparsers... | 3.765625 | 4 |
Unit 3 SC/acme_report.py | Tyler9937/DS-Unit-3-Sprint-1-Software-Engineering | 0 | 12789895 | # Importing needed library and Product class
import random
from acme import Product
# creating lists of adjectives and nouns
adjectives = ['Cool', 'Flavorful', 'Shiny', 'Awsome']
nouns = ['Phone', 'PS4', 'Computer', 'Anvil']
def generate_products(num_products=30):
'''
creates a list of products given the num... | 3.828125 | 4 |
move_1.py | Housebear/python-learning | 0 | 12789896 | #!/usr/bin/python3
# -*- coding:utf-8 -*-
# File Name: move_1.py
# Author: Lipsum
# Mail: <EMAIL>
# Created Time: 2016-05-11 18:25:12
def move(n, source, bridge, destination):
if n == 1:
print(source, '-->', destination)
else:
move(n-1, source, destination, bridge)
move(1, source, brid... | 3.515625 | 4 |
migrations/versions/8fb490efb894_.py | maiorano84/ctaCompanion | 2 | 12789897 | """empty message
Revision ID: 8fb490efb894
Revises: <KEY>
Create Date: 2020-06-15 20:33:31.609050
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '8fb490efb894'
down_revision = '<KEY>'
branch_labels = None
depends_on = None
def upgrade():
# ### commands a... | 1.882813 | 2 |
comment_list_brige.py | jonatep/ace-attorney-twitter-bot | 0 | 12789898 | class Comment:
def __init__(self, tweet):
self.author = Author(tweet.user.name)
self.body = tweet.full_text
if (len(self.body) == 0):
self.body = '...'
self.score = 0
class Author:
def __init__(self, name):
self.name = name
| 3.046875 | 3 |
wsgi_microservice_middleware/request_id.py | presalytics/WSGI-Microservice-Middleware | 1 | 12789899 | """
Middleware and logging filter to add request ids to logs and forward request Ids in downstream requests
"""
import logging
import re
import traceback
import datetime
import pythonjsonlogger
import pythonjsonlogger.jsonlogger
import wsgi_microservice_middleware
logger = logging.getLogger(__name__)
REQUEST_ID_HEA... | 2.703125 | 3 |
devops/__init__.py | crazypenguin/devops | 300 | 12789900 | <gh_stars>100-1000
from __future__ import absolute_import, unicode_literals
from .celery import app as celery_app
# from .job import scheduler # 第一个获取到文件锁的进程执行任务后,如果在运行中途进程关闭重新启动了一个新的,则依然会多次执行
__all__ = ['celery_app']
# __all__ = ['celery_app', 'scheduler']
# import pymysql
# pymysql.install_as_MySQLdb()
| 1.203125 | 1 |
helloworld.py | CptShock/AuroraModules | 0 | 12789901 | <gh_stars>0
import willie
@willie.module.commands('helloworld')
def helloworld(bot, trigger):
bot.say('Hello World!') | 1.828125 | 2 |
rattube.py | wormholesepiol/RatTube | 3 | 12789902 | # rattube.py
#
# Copyright 2020 <NAME> <<EMAIL>>
#
from termcolor import cprint
from pyfiglet import figlet_format
from pytube import YouTube
import time
from os import system, name
import sys
from colorama import init
init(strip=not sys.stdout.isatty())
class RatTube:
def limpiar_Pantalla(self... | 2.59375 | 3 |
django-api/rasaApp/urls.py | raghavwadhwa/RasaReactBOT | 0 | 12789903 | from rest_framework import routers
from .api import *
from . import api
from django.urls import path
urlpatterns = [
path('translate/', api.TranslateViewSet.as_view(), name='translate'),
path('response/', api.ResponseViewSet.as_view(), name='response'),
]
| 1.5625 | 2 |
src/ipdasite.theme/src/ipdasite/theme/tests/test_viewlets.py | NASA-PDS/planetarydata.org | 0 | 12789904 | # encoding: utf-8
# Copyright 2012 California Institute of Technology. ALL RIGHTS
# RESERVED. U.S. Government Sponsorship acknowledged.
from ipdasite.theme.testing import IPDA_SITE_THEME_INTEGRATION_TESTING
from Products.Five.browser import BrowserView as View
from zope.component import getMultiAdapter
from zope.viewl... | 1.90625 | 2 |
test/test_user_reset_password_requests_api.py | Apteco/apteco-api | 2 | 12789905 | # coding: utf-8
"""
Apteco API
An API to allow access to Apteco Marketing Suite resources # noqa: E501
The version of the OpenAPI document: v2
Contact: <EMAIL>
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import unittest
import apteco_api
from aptec... | 2.34375 | 2 |
objects_new/Sources_new.py | diogo1790team/inphinity_DM | 1 | 12789906 | <reponame>diogo1790team/inphinity_DM
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 27 15:31:49 2017
@author: <NAME>
"""
from SQL_obj_new.Source_sql_new import _Source_sql_new
class Source(object):
"""
This class treat the Sources object has it exists in SOURCES table database
By default, all FK are in t... | 2.5625 | 3 |
tests/python/unittest/test_tir_schedule_reorder.py | mozga-intel/tvm | 2 | 12789907 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 1.84375 | 2 |
Pages/MusicPage/Components/Head.py | Th3Wizard001/Amplify | 11 | 12789908 | import tkinter as tk
from PIL import ImageTk, Image
from Pages.MusicPage.Components.TextFrame import TextFrame
class Head(tk.Frame):
def __init__(self, master, image, text, data, *args, **kwargs):
tk.Frame.__init__(self, master, *args, *kwargs)
self['background'] = 'black'
self.photo = ima... | 2.828125 | 3 |
direct/data/sens.py | NKI-AI/direct | 57 | 12789909 | # coding=utf-8
# Copyright (c) DIRECT Contributors
from typing import List, Optional, Tuple, Union
import numpy as np
from scipy.stats import multivariate_normal as normal
def simulate_sensitivity_maps(
shape: Union[List[int], Tuple[int]], num_coils: int, var: float = 1, seed: Optional[int] = None
) -> np.ndarr... | 2.828125 | 3 |
aliOss/bucket_manage.py | sunnywalden/oss_management | 0 | 12789910 | <reponame>sunnywalden/oss_management
# !/usr/bin/env python
# coding=utf-8
# author: <EMAIL>
import oss2
import json
import base64
import os
import sys
import time
from itertools import islice
from utils.get_logger import Log
from utils.fonts_scanner import get_fonts_from_local
from conf import config
from aliOss.oss... | 2 | 2 |
cargonet/utils/convert.py | romnnn/rail-stgcnn | 2 | 12789911 | import torch
def nx_to_tg(g, node_features=None, edge_features=None, convert_edges=True):
node_features = node_features or []
edge_features = edge_features or []
n_nodes = g.number_of_nodes()
nodes = torch.zeros(n_nodes, len(node_features), dtype=torch.float)
for n, data in g.nodes(data=True):
... | 2.4375 | 2 |
BiCuOS_standardstate.py | MTD-group/BiMOQ-PourbaixDiagrams | 0 | 12789912 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jul 23 13:17:41 2018
@author: laurenwalters
"""
import numpy as np
import matplotlib.pyplot as plt
import random
#For saving/importing data
from numpy import asarray
from numpy import save
from numpy import load
#Created by <NAME>, 2018-2020
#Contribut... | 2.78125 | 3 |
masjid/views.py | 1935090/donation | 0 | 12789913 | from django.shortcuts import render
from .models import Masjid, SalahTime
from .serializers import MasjidSerializer, SalahTimeSerializer
from rest_framework import viewsets
from rest_framework.decorators import api_view
from masjid.models import Masjid
from rest_framework.response import Response
from rest_framework im... | 2 | 2 |
db-server/dbcon/migrations/0003_auto_20210528_1824.py | JannisBush/xs-leaks-browser-web | 0 | 12789914 | <gh_stars>0
# Generated by Django 3.2.3 on 2021-05-28 18:24
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('dbcon', '0002_auto_20210528_1657'),
]
operations = [
migrations.CreateModel(
name='... | 1.546875 | 2 |
ooppython3/modalidade.py | mpeschke/PARADIG-PROG-N1-OOP-PYTHON3 | 0 | 12789915 | # coding=UTF-8
"""
Módulo: Fornece a superclasse com todos os métodos necessários para
implementar uma modalidade de competição de olimpíadas.
"""
from ooppython3.adversario import Adversario
class Modalidade:
"""
Superclasse representando uma modalidade de competição das olimpíadas.
"""
_adversarios ... | 3.5 | 4 |
advancedapplication/test.py | wDove1/motorisedcameratracking | 0 | 12789916 | # import tkinter module
from tkinter import *
from tkinter.ttk import *
# creating main tkinter window/toplevel
master = Tk()
# this will create a label widget
l1 = Label(master, text = "Height")
l2 = Label(master, text = "Width")
# grid method to arrange labels in respective
# rows and columns as spec... | 3.96875 | 4 |
third_party/longstaff_schwartz/regression_basis.py | christiandorion/hecmtl | 17 | 12789917 | <reponame>christiandorion/hecmtl<filename>third_party/longstaff_schwartz/regression_basis.py
# -*- coding: utf-8 -*-
import numpy as np
from numpy.linalg import lstsq
class RegressionBasis:
def __init__(self, basis_functions):
self.basis_functions = basis_functions
def __str__(self):
return ... | 2.375 | 2 |
examples/views/dropdown.py | Mihitoko/pycord | 0 | 12789918 | <gh_stars>0
import discord
# Defines a custom Select containing colour options
# that the user can choose. The callback function
# of this class is called when the user changes their choice.
class Dropdown(discord.ui.Select):
def __init__(self, bot_: discord.Bot):
# For example, you can use self.bot to re... | 3.640625 | 4 |
ratings/urls.py | daltonamitchell/rating-dashboard | 1 | 12789919 | <gh_stars>1-10
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^new/$', views.create, name='new'),
url(r'^store/', views.store, name='store'),
url(r'^$', views.index, name='index'),
]
| 1.53125 | 2 |
app/resources/SearchEndpoint.py | ajlouie/ithriv_service-1 | 0 | 12789920 | <filename>app/resources/SearchEndpoint.py
import elasticsearch
import flask_restful
from flask import request, g
from app import elastic_index, RestException
from app.models import ThrivResource, Availability, ThrivInstitution
from app.models import Facet, FacetCount, Filter, Search
from app.resources.schema import Se... | 2.125 | 2 |
Python/lc_253_meeting_rooms_ii.py | cmattey/leetcode_problems | 6 | 12789921 | <gh_stars>1-10
# Time: O(nlogn)
# Space: O(n)
class Solution:
def minMeetingRooms(self, intervals: List[List[int]]) -> int:
import heapq
if not intervals:
return 0
intervals.sort(key = lambda interval:interval[0])
heap = []
heapq.heappush(heap, intervals[0][1]... | 2.921875 | 3 |
colab_transfer/transfer.py | woctezuma/google-colab-transfer | 11 | 12789922 | <reponame>woctezuma/google-colab-transfer<gh_stars>10-100
import glob
import os
import shutil
from pathlib import Path
from colab_transfer.google_drive import mount_google_drive, is_google_drive_mounted
from colab_transfer.utils import get_path_to_home_of_google_drive, get_path_to_home_of_local_machine
def copy_file... | 3.078125 | 3 |
lib/meshrenderer/gl_utils/__init__.py | THU-DA-6D-Pose-Group/self6dpp | 33 | 12789923 | # from .offscreen_context import OffscreenContext
import os
if os.environ.get("PYOPENGL_PLATFORM", None) == "egl":
from .egl_offscreen_context import OffscreenContext
else:
from .glfw_offscreen_context import OffscreenContext
from .fbo import Framebuffer
from .renderbuffer import Renderbuffer, RenderbufferMult... | 1.429688 | 1 |
Dictionary.py | FatalWhite/Python3Lab | 0 | 12789924 | <reponame>FatalWhite/Python3Lab<filename>Dictionary.py
# 딕셔너리 : 매핑 자료구조
# 키key에 값value을 연결시키는 방식으로 데이터를 다루는 방법 제공
# 키는 저장된 데이터를 식별하기 위한 번호나 이름
# 값은 각 키에 연결되어 저장된 테이터
# 따라서 키만 알면 데이터를 바로 찾을 수 있음
# 딕셔너리는 {} 에 키:값 형태로 이용
# 키:값이 여러개 존재할 경우, 로 구분
menu = { '1': 'newSungJuk', '2': 'showSungJuk',
'3': 'modifySungJuk'... | 2.25 | 2 |
tests/tests_bazaar.py | vitorruiz/tibia.py | 22 | 12789925 | <reponame>vitorruiz/tibia.py
import datetime
import unittest
from tests.tests_tibiapy import TestCommons
from tibiapy import Auction, AuctionOrder, AuctionOrderBy, AuctionSearchType, AuctionStatus, BattlEyeTypeFilter, \
BidType, \
CharacterBazaar, \
InvalidContent, PvpTypeFilter, \
Sex, SkillFilter, \
... | 2.4375 | 2 |
monobit/formats/hex.py | robhagemans/monobit | 74 | 12789926 | """
monobit.hex - Unifont Hex format
(c) 2019--2021 <NAME>
licence: https://opensource.org/licenses/MIT
"""
# HEX format documentation
# http://czyborra.com/unifont/
import logging
import string
from ..storage import loaders, savers
from ..streams import FileFormatError
from ..font import Font
from ..glyph import G... | 2.546875 | 3 |
csv_manager.py | Hey7ude/word-translate-practice | 0 | 12789927 | import csv
def open_file_or_create(name: str, mode):
try:
return open(name, mode)
except:
f = open(name, 'a')
f.close()
return open(name, mode)
def import_csv(words_list: list, class_name, filename = 'data.csv'):
csv_file = open_file_or_create(filename, 'r')
csv_reader... | 3.4375 | 3 |
dicewars/server/game.py | thejoeejoee/SUI-MIT-VUT-2020-2021 | 0 | 12789928 | import json
from json.decoder import JSONDecodeError
import logging
import random
import socket
import sys
from .player import Player
from .summary import GameSummary
MAX_PASS_ROUNDS = 8
MAX_BATTLES_PER_GAME = 10000 # obsevered maximum of 5671 over over 100k games
class Game:
"""Instance of the game
"""
... | 2.96875 | 3 |
gluoncv/data/video_custom/__init__.py | Kentwhf/gluon-cv | 48 | 12789929 | <reponame>Kentwhf/gluon-cv<gh_stars>10-100
# pylint: disable=wildcard-import
"""Video related tasks. Custom data loader
"""
from __future__ import absolute_import
from .classification import *
| 1.03125 | 1 |
object_fiware_converter.py | iml130/FiwareObjectConverter | 0 | 12789930 | # Copyright 2018 <NAME>
#
# 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... | 2.140625 | 2 |
Loops/ForLoop1.py | lytranp/Tutoring-PythonIntroduction | 0 | 12789931 | <gh_stars>0
## There are 2 types of loops:
# definite iteration
# and indefinite iteration until the program determines to stop it
## for loop: control statement that most easily supports definite iteration
for eachPass in range(4):
print("It's alive!", end = " ")
number = 2
exponential = 3
product = 1
for i in ... | 4.1875 | 4 |
code/012.py | i4leader/Python-Basic-Pratice-100question | 0 | 12789932 | <filename>code/012.py
#!/usr/bin/python3
import math
count = 0
leap = 1
for i in range(101,201):
k = int(math.sqrt(i+1))
for j in range(2,k+1):
if i%j == 0:
leap = 0
break
if leap == 1:
print(i)
count += 1
leap = 1
print("素数总计数:%d"%count)
| 3.796875 | 4 |
components/footer.py | nt409/dash_template | 0 | 12789933 | <filename>components/footer.py<gh_stars>0
import dash_html_components as html
footer = html.Footer([
html.Div(
html.Div([
html.A("Home", href="/", className="footer-navlink"),
html.A("Model", href="/model", className="footer-navlink"),
... | 2.140625 | 2 |
src/models/components/utils.py | philip-mueller/lovt | 3 | 12789934 | <filename>src/models/components/utils.py<gh_stars>1-10
from abc import ABC, abstractmethod
from dataclasses import dataclass
from functools import partial
from typing import Optional, Union, Tuple, Any
import torch
from omegaconf import MISSING
from torch import nn
import torch.nn.functional as F
from torch.utils.data... | 2.1875 | 2 |
sploits/startup/startup_sploit.py | vient/proctf-2019 | 2 | 12789935 | #!/usr/bin/python3
import socket
import requests
import sys
if len(sys.argv) < 3:
print("Usage: ./startup_sploit <host> <my_ip>")
exit(1)
PORT = 3255
HOST = sys.argv[1]
MYIP = sys.argv[2]
MYPORT = "0" * (921-len(MYIP)) + "4000"
MANIFEST = '{"links": [{"url": "http://mirror/wyjzmw.php", "checksum": "32bfce7a... | 2.390625 | 2 |
Patterns/Adapter_solution.py | alex123012/Coursera_Python_and_Django | 0 | 12789936 | <filename>Patterns/Adapter_solution.py
class MappingAdapter:
def __init__(self, adaptee):
self.adaptee = adaptee
def lighten(self, grid):
lights, obtacles = self.__find_all(grid)
height, width = len(grid[0]), len(grid)
self.adaptee.set_dim((height, width))
self.adaptee.s... | 3.03125 | 3 |
scripts/properties_parser.py | Cypheruim/minebot | 1 | 12789937 | from dataclasses import dataclass
# Parser to read and modify Minecraft server.properties files
@dataclass
class PropertiesParser:
file_path: str
data: dict
def __init__(self, file_path: str):
self.file_path = file_path
self.data = None
# Gets the value of property
def get(self... | 3.484375 | 3 |
iniciante/python/1065-pares-entre-cinco-numeros.py | tfn10/beecrowd | 0 | 12789938 | <filename>iniciante/python/1065-pares-entre-cinco-numeros.py
def pares():
valores_pares = i = 0
while i < 5:
numero = int(input())
if numero % 2 == 0:
valores_pares += 1
i += 1
print(f'{valores_pares} valores pares')
pares()
| 3.765625 | 4 |
readable/__init__.py | amalchuk/readable | 0 | 12789939 | # Copyright 2020-2021 <NAME>. All rights reserved.
# This project is licensed under the terms of the MIT License.
"""
Check and improve the spelling and grammar of documents.
"""
| 1.40625 | 1 |
ccal/is_str_version.py | alex-wenzel/ccal | 0 | 12789940 | def is_str_version(str_):
str_split = str_.split(sep=".")
return "." in str_ and len(str_split) == 3 and all(i.isnumeric() for i in str_split)
| 3.140625 | 3 |
python/13_File_IO/04_rw_binfile.py | ihaolin/script-repo | 0 | 12789941 | <reponame>ihaolin/script-repo
import array
nums = array.array('i', [1,2,3,4])
with open('data.bin', 'wb') as f:
f.write(nums)
a = array.array('i', [0,0,0,0,0,0])
with open('data.bin', 'rb') as f:
f.readinto(a)
print(a)
| 2.609375 | 3 |
setup.py | ASKBOT/askbot-slack | 3 | 12789942 | <gh_stars>1-10
from setuptools import setup
setup(
name="askbot-slack",
version="0.1.3",
classifiers=[
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.6",
"P... | 1.398438 | 1 |
yugioh/ISMCTS.py | mnoyes68/yu-gi-oh | 0 | 12789943 | <reponame>mnoyes68/yu-gi-oh<filename>yugioh/ISMCTS.py
import random
import math
import numpy as np
import logging
class Node():
def __init__(self, player, opponent, turn_number, is_player_turn):
self.player = player
self.opponent = opponent
self.info_set = InfoSet(player, opponent)
... | 2.734375 | 3 |
DynamicProgramming/PalindromicSubstrings.py | LinXueyuanStdio/leetcode | 0 | 12789944 | <filename>DynamicProgramming/PalindromicSubstrings.py<gh_stars>0
'''
Given a string, your task is to count how many palindromic substrings in this string.
The substrings with different start indexes or end indexes are counted as different substrings even they consist of same characters.
Example 1:
Input: "abc"
Output... | 4.15625 | 4 |
contentcuration/contentcuration/migrations/0040_file_assessment_item.py | Tlazypanda/studio | 1 | 12789945 | # -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-11-07 22:29
from __future__ import unicode_literals
import django.db.models.deletion
from django.db import migrations
from django.db import models
class Migration(migrations.Migration):
dependencies = [
('contentcuration', '0039_auto_20161101_1... | 1.484375 | 1 |
docs/conf.py | airr-community/airr-standards | 35 | 12789946 | <reponame>airr-community/airr-standards
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# airr-standards documentation build configuration file, created by
# sphinx-quickstart on Fri Nov 17 14:47:21 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possibl... | 1.625 | 2 |
A10/mapper.py | lrodrin/masterAI | 2 | 12789947 | #!/usr/bin/env python
#coding=utf-8
"""mapper.py"""
import sys
# los datos de entrada vienen por STDIN (standard input)
for line in sys.stdin:
# quitamos espacios de principio y fin de línea
line = line.strip()
# partimos la línea en palabras
words = line.split()
for word in words:
# se e... | 3.640625 | 4 |
xnr/WeiboCrawler.py | BingquLee/spiders | 0 | 12789948 | import time
from selenium import webdriver
from SinaLauncher import SinaLauncher
class WeiboCrawler(object):
def __init__(self):
self.driver = webdriver.Firefox()
def get_present_time(self):
present_time_stamp = time.localtime(int(time.time()))
present_time = time.strftime("%Y-%m-%d ... | 2.96875 | 3 |
experiments/bin_plot_11.02.21-BPE_Pressure_Deflection_20X.py | sean-mackenzie/gdpyt-analysis | 0 | 12789949 | # test bin, analyze, and plot functions
# imports
import os
from os.path import join
from os import listdir
import matplotlib.pyplot as plt
# imports
import numpy as np
import pandas as pd
from scipy.optimize import curve_fit
import filter
import analyze
from correction import correct
from utils import fit, function... | 2.296875 | 2 |
django_timeseries_tables/__init__.py | androbwebb/django-timeseries-tables | 0 | 12789950 | from .fields import NormalField, ForeignKey # noqa:F401
from .models import TimeSeriesModel # noqa:F401
__version__ = '0.1.3'
| 1.234375 | 1 |