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 |
|---|---|---|---|---|---|---|
openstack_exporter/BaseCollector.py | sapcc/openstack-exporter | 0 | 49900 | # 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 applicable law or agreed to in... | 1.953125 | 2 |
military-overlay/utils-source-and-test-data/schema-creation-utilities/template-gdb-toolbox/scripts/ExportGDBFieldsToFolder.py | ArcGIS/military-symbol-editor-addin-wpf | 15 | 49901 | # ----------------------------------------------------------------------------------
# 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 ... | 1.609375 | 2 |
harness/tests/cli/test_auth.py | gh-determined-ai/determined | 0 | 49902 | <gh_stars>0
import contextlib
import json
import os
import shutil
from pathlib import Path
from typing import Iterator, Optional
import pytest
import requests_mock
from determined.common.api.authentication import Authentication, TokenStore
from determined.common.api.certs import default_load as certs_default_load
fro... | 1.898438 | 2 |
test_geo.py | ai387/ia-flood-risk-project | 0 | 49903 | <gh_stars>0
from math import sqrt
from tokenize import Number
from floodsystem.utils import sorted_by_key # noqa
from floodsystem.station import MonitoringStation # importing the classes that are made in submodule
from floodsystem.stationdata import build_station_list # importing all data abt the stations
from floods... | 2.828125 | 3 |
tests/utils/test_beta.py | greck2908/beyond | 33 | 49904 | <filename>tests/utils/test_beta.py
import numpy as np
from pytest import mark
from beyond.utils.beta import beta, beta_limit
from beyond.env.jpl import get_body
def test_beta(iss_tle):
orbit = iss_tle.orbit()
beta_ = beta(orbit)
beta_lim = beta_limit(orbit)
assert np.isclose(beta_, -0.018861895899... | 2.171875 | 2 |
src/lsd_lemon/lemon_resting.py | juhuntenburg/pipelines | 13 | 49905 | <gh_stars>10-100
from nipype.pipeline.engine import Node, Workflow
import nipype.interfaces.utility as util
import nipype.interfaces.io as nio
import nipype.interfaces.fsl as fsl
from func_preproc.strip_rois import strip_rois_func
from func_preproc.moco import create_moco_pipeline
from func_preproc.fieldmap_coreg impor... | 1.898438 | 2 |
settings.py | Emberwalker/Arke | 2 | 49906 | # Arke
# User-configurable settings.
# Dirty little seeekrits...
SECRET_KEY='much_sekrit_such_secure_wow'
# Database
# See http://docs.sqlalchemy.org/en/rel_0_9/core/engines.html#database-urls
# With DEBUG defined, this is ignored and a SQLite DB in the root folder is used instead.
# SQLite is probably not the best f... | 1.367188 | 1 |
Pacote download/ex012.py | SheilaLCC/Python-no-celular-android | 2 | 49907 | #crie um programa que leia o preço de um
#produto e mostre seu novo preço com 5%
#de desconto
p=float(input('Digite o preço do produto:R$ '))
pn=p-(p*5/100)
print ('O novo preço com desconto de 5% é:R$ {:.2f}'.format (pn))
| 3.515625 | 4 |
developmentHub/contacts/admin.py | MariiaBel/developmentHub | 0 | 49908 | <filename>developmentHub/contacts/admin.py
from django.contrib import admin
from .models import Contact
class ContactAdmin(admin.ModelAdmin):
list_display = ("name", "email", "subject", "body", "is_answered")
# добавляем интерфейс для поиска по тексту постов
search_fields = ("email",)
empty_value_dis... | 1.84375 | 2 |
gitlab/gitlab_mgr/gitlabmgr.py | charlessoft/docker_script | 0 | 49909 | # -*- coding: utf-8 -*-
import click
import gitlab
from colored import fg, bg, attr
from core import gitlabwrapper
from config import Config
from configparser import ConfigParser
from core.utils import read_config, print_green, print_red, create_gl
g_namespace_lst = {}
from prettytable import PrettyTable
# def re... | 2.1875 | 2 |
packages/vaex-ml/vaex/ml/_version.py | mgbin088/vaex | 1 | 49910 | <reponame>mgbin088/vaex<gh_stars>1-10
__version__ = '0.7.0'
__version_tuple__ = (0, 7, 0)
| 1.234375 | 1 |
screens.py | annego15/Pygame-Snake | 0 | 49911 | <gh_stars>0
from pygame.locals import *
import pygame
import os
import sys
from game import *
from ai import *
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
DARK_BLUE = (0, 0, 128)
DARK_RED = (128, 0, 0)
GREEN = (0, 255, 0)
BLUE = (0, 0, 255)
CYAN = (0, 255, 255)
board_width = 640 # board width in pixels
board_height =... | 2.671875 | 3 |
annotation/migrations/0010_one_off_recalculate_sample_stats.py | SACGF/variantgrid | 5 | 49912 | # Generated by Django 3.1 on 2020-11-23 02:24
from django.db import migrations
from manual.operations.manual_operations import ManualOperation
def test_has_sample_stats(apps):
SampleVariantAnnotationStats = apps.get_model("annotation", "SampleVariantAnnotationStats")
return SampleVariantAnnotationStats.obje... | 1.867188 | 2 |
ratgame.py | yanglusi/Programs | 0 | 49913 | <filename>ratgame.py
##########
### The below Python code is copyrighted by <NAME>. ###
### Contact: <EMAIL> or <EMAIL> ###
### Actual Program: http://bit.ly/2EQygrK ###
### Copyright © 2017 ###
##########
import turtle
import random
# name of the game
screen = turtle.Screen()
screen.title('Rat Game for Cats')
# th... | 3.59375 | 4 |
solutions/208_implement_trie.py | YiqunPeng/leetcode_pro | 0 | 49914 | class TrieNode:
def __init__(self, c=None, end=False):
self.c = c
self.children = {}
self.end = end
class Trie:
def __init__(self):
"""
Initialize your data structure here.
"""
self.root = TrieNode('')
def insert(self, word: str) -> None:
... | 4.125 | 4 |
ursina/editor/old/color_menu.py | jtiai/ursina | 1 | 49915 | <gh_stars>1-10
from ursina import *
class ColorMenu(Entity):
def __init__(self, scene_editor):
self.scene_editor = scene_editor
super().__init__(parent=self.scene_editor.ui_parent)
self.menu = Panel(
parent=self,
model='quad',
origin=(-.5,.5),
... | 2.46875 | 2 |
src/orderlyweb_client_wrapper.py | vimc/montagu-task-queue | 0 | 49916 | <reponame>vimc/montagu-task-queue<gh_stars>0
import montagu
import orderlyweb_api
import logging
def get_authorised_client(config):
try:
monty = montagu.MontaguAPI(config.montagu_url, config.montagu_user,
config.montagu_password)
ow = orderlyweb_api.OrderlyWebAPI... | 2.46875 | 2 |
tests/test_rand_histogram_shift.py | MONAI-Project/MONAI | 0 | 49917 | <reponame>MONAI-Project/MONAI
# Copyright (c) MONAI Consortium
# 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 l... | 1.460938 | 1 |
serivce/jwt_decoder/__init__.py | LupusAnay/gateway-prototype | 0 | 49918 | <reponame>LupusAnay/gateway-prototype
import jwt
def decode_auth_token(auth_token):
try:
payload = jwt.decode(auth_token, 'key', algorithm='HS256')
return payload
except jwt.ExpiredSignatureError:
return 'Signature expired. Please log in again.'
except jwt.InvalidTokenError:
... | 2.59375 | 3 |
app/main/forms.py | zhuojianyun/ubuntukgt | 0 | 49919 | from flask_wtf import FlaskForm
from wtforms import StringField, TextAreaField, BooleanField, SelectField,\
SubmitField,IntegerField,DateField
from wtforms.validators import DataRequired, Length, Email, Regexp
from wtforms import ValidationError
from flask_pagedown.fields import PageDownField
from ..models im... | 2.546875 | 3 |
pipe_tools/io/datepartitionedsink.py | GlobalFishingWatch/pipe-tools | 1 | 49920 | import random
import six
import warnings
from .partitionedsink import WritePartitionedFiles
from .partitionedsink import PartitionedFileSink
from .partitionedsink import T
import apache_beam as beam
from apache_beam import PTransform
from apache_beam import core
from apache_beam.transforms import window
from apache_b... | 2.046875 | 2 |
forNSF/generate_schedules.py | ctames/conference-host | 1 | 49921 | <filename>forNSF/generate_schedules.py
###
### generate_schedules.py
###
import os
import sys
import csv
import random
import datetime
from utils import LogWarning, LogMessage
import django
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "webApp.settings")
django.setup()
from django.shortcuts import render
from djang... | 2.09375 | 2 |
SOFTWARE/A64-TERES/u-boot_new/tools/buildman/test.py | xloem/DIY-LAPTOP | 6 | 49922 | #
# Copyright (c) 2012 The Chromium OS Authors.
#
# SPDX-License-Identifier: GPL-2.0+
#
import os
import shutil
import sys
import tempfile
import time
import unittest
# Bring in the patman libraries
our_path = os.path.dirname(os.path.realpath(__file__))
sys.path.append(os.path.join(our_path, '../patman'))
import boa... | 2.203125 | 2 |
layerindex/middleware.py | epyeoh/clear-linux-dissector-web | 0 | 49923 | <filename>layerindex/middleware.py
# layerindex-web - middleware definitions
#
# Copyright (C) 2019 Intel Corporation
#
# Licensed under the MIT license, see COPYING.MIT for details
from django.utils.deprecation import MiddlewareMixin
from django.http import HttpResponseRedirect
from django.core.urlresolvers import re... | 2.140625 | 2 |
facet/network/__init__.py | edponce/FACET | 2 | 49924 | from .client import SocketClient
from .server import (
SocketServer,
SocketServerHandler,
)
| 1.210938 | 1 |
misc/main.py | vishalbelsare/interpolation.py | 110 | 49925 | if True:
import numpy as np
d = 3
K = 50
N = 10 ** 6
a = np.zeros(3)
b = np.ones(3)
orders = np.array([K for i in range(d)])
coeffs = np.random.random([k + 2 for k in orders])
points = np.random.random((N, d)) # each line is a vector
points_c = points.T.copy() # each column i... | 2.4375 | 2 |
diames.py | ojalar/diameter-measurement | 0 | 49926 | <reponame>ojalar/diameter-measurement<gh_stars>0
import numpy as np
import cv2
import os
import sys
# This class contains the functionalities required for measuring diameters with a camera
class DiaMes:
def __init__(self):
# camera intrinsic parameters
self.mtx = None
# camera distortion co... | 2.921875 | 3 |
scripts/fixedTwoRows.py | Cognaiscance/btcTicker | 0 | 49927 | <reponame>Cognaiscance/btcTicker
import sys
import board
import digitalio
from PIL import Image, ImageDraw, ImageFont
import adafruit_ssd1306
from time import sleep
# Define the args
title_text = sys.argv[1]
row1_text = sys.argv[2]
row2_text = sys.argv[3]
night_mode = sys.argv[4] == "true"
font_size = int(sys.argv[5])... | 2.765625 | 3 |
webapp/users/admin.py | Sollimann/momentum_web | 0 | 49928 | <reponame>Sollimann/momentum_web
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from .models import User, Startup, Investor, Person, Industry, Sector, Status, Job, Type, Pub_or_priv, Field, Status_interest
# Register your models here.
admin.site.register(Job)
admin.site.... | 1.546875 | 2 |
move_safe/move_safe.py | maxathon2020/Move-Safe-Team | 1 | 49929 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""move_safe.py: get all the places in a radius using google place api ."""
__author__ = "<NAME>, <NAME>"
import populartimes
import json
import math
import requests
import geocoder
apiKey = ""
# get your current position
def my_current_location():
g = geocoder.ip('... | 3.578125 | 4 |
Help.py | djkirsch326/HaGaonHaMachane-py | 1 | 49930 | <filename>Help.py
import discord
from discord.ext import commands
from aiohttp import ClientSession
from sendText import create_embed
class Help(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.session = ClientSession(loop=bot.loop)
self.owner = "Acher#0495"
@commands.comma... | 2.65625 | 3 |
authentication/admin.py | nicbou/markdown-notes | 121 | 49931 | <filename>authentication/admin.py
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User
UserAdmin.list_display = ('username', 'email', 'first_name', 'last_name', 'is_active', 'date_joined')
admin.site.unregister(User)
admin.site.register(User, Use... | 1.765625 | 2 |
ews/migrations/0008_auto_20200731_0820.py | mrustl/plattform | 0 | 49932 | # Generated by Django 3.0.8 on 2020-07-31 06:20
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('ews', '0007_auto_20200729_1039'),
]
operations = [
migrations.AlterField(
model_name='featureda... | 1.601563 | 2 |
plugin/plugins/check-file-existence/src/check_ssh_file_existence.py | crazy-canux/xPlugin_Monitoring | 2 | 49933 | #!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
#===============================================================================
# Filename : check_ssh_file_existence
# Author : <NAME> <<EMAIL>>
# Description : Check on remote server if some files are present using SSH.
#---------------------------------... | 2.0625 | 2 |
n_choose_m_iterator/demo_n_choose_m.py | ClarkSims/Permutations | 0 | 49934 |
def n_choose_m_iterator(N, M, startpoint=None):
if startpoint is None:
subscripts = list(range(M))
else:
subscripts = copy.deepcopy(startpoint)
while True:
yield subscripts
off = M - 1
while off > -1:
rev_off = M - off
if subscripts[off] < N ... | 3.453125 | 3 |
tutorials/auto_tensorize/mapping_nets/auto_mapping_resnet18.py | QinHan-Erin/AMOS | 22 | 49935 | <gh_stars>10-100
"""
AutoTensorize: find mappings for ResNet-18 on GPU
===========================================
**Author**: `<NAME> <https://github.com/KnowingNothing>`
The way to find mappings for the whole network is
essentially to complete the mapping layer by layer.
Some layers themselves cannot be mapped to T... | 2.515625 | 3 |
0x0F-python-object_relational_mapping/100-relationship_states_cities.py | oluwaseun-ebenezer/holbertonschool-higher_level_programming | 0 | 49936 | #!/usr/bin/python3
'''Adds a State object and one of its City object children to a database.
'''
import sys
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker, relationship
from relationship_state import Base, State
from relationship_city import City
if __name__ == '__main__':
if len(sy... | 3.15625 | 3 |
pegleg/engine/exceptions.py | openstack/airship-pegleg | 9 | 49937 | <filename>pegleg/engine/exceptions.py
# Copyright 2018 AT&T Intellectual Property. All other 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/li... | 2.078125 | 2 |
noticebox/tests/base.py | mila/django-noticebox | 0 | 49938 | <filename>noticebox/tests/base.py
import os
from django.contrib.auth.models import User
from django.core import mail
from django.test import TestCase
TEMPLATE_DIRS = [os.path.abspath('%s/../templates/' % __file__)]
TEMPLATE_CONTEXT_PROCESSORS = ['noticebox.context_processors.notices']
class BaseNoticeTestCase(Tes... | 2.203125 | 2 |
zorg/buildbot/builders/CUDATestsuiteBuilder.py | antiagainst/llvm-zorg | 1 | 49939 | <gh_stars>1-10
from buildbot.process.properties import WithProperties
try:
# buildbot 0.8.5
from buildbot.steps.slave import RemoveDirectory
except:
# buildbot 0.8.12
from buildbot.plugins import steps
RemoveDirectory = steps.RemoveDirectory
from string import split
from zorg.buildbot.builders import ClangBu... | 1.5625 | 2 |
LeetCode/src/main/python/result/846_HandOfStraights.py | HbnKing/Algorithm | 3 | 49940 | #Author wangheng
class Solution:
def isNStraightHand(self, hand, W):
c = collections.Counter(hand)
for i in sorted(c):
if c[i] > 0:
for j in range(W)[::-1]:
c[i + j] -= c[i]
if c[i + j] < 0:
return False
... | 2.84375 | 3 |
main.py | zackbradys/wireshark-geolocator | 1 | 49941 | <filename>main.py<gh_stars>1-10
# Wireshark Geolocator (Python)
# Simple Python program using Wireshark and MaxMind's GeoLite2 to locate users via their internet protocol addresses.
# Visit the GitHub Repository at https://github.com/zackbradys/wireshark-geolocator.
# Last Updated: 20 Jan 2021
from geolite2 import geo... | 3.3125 | 3 |
coilutils/__init__.py | rehohoho/coiltraine | 204 | 49942 | <reponame>rehohoho/coiltraine<gh_stars>100-1000
from .attribute_dict import AttributeDict
#from .experiment_schedule import mount_experiment_heap, get_free_gpus, pop_half_gpu, pop_one_gpu | 1.15625 | 1 |
touchdown/tests/test_aws_elb_load_balancer.py | yaybu/touchdown | 14 | 49943 | # Copyright 2015 Isotoma Limited
#
# 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... | 1.8125 | 2 |
input/fountain/gen_p.py | Rintarooo/DTAM_Mapping | 0 | 49944 | <filename>input/fountain/gen_p.py
# https://github.com/qq456cvb/SfM/blob/23d36d70591ce024483c4136fd718421c4b129df/SFM/utils.py
# https://github.com/akshitj1/dtam/blob/bd027b6f76215cc71af382f5e7015f11a726cace/mapper.cpp
import os
def write_imgf_R_t(txtdir = 'urd/', imgdir = 'urd/', dst = "fou11.txt"):
with open(dst,... | 2.375 | 2 |
main.py | liuzhy71/DexiNed | 0 | 49945 | from __future__ import print_function
import argparse
import os
import platform
import time
import cv2
import h5py
import torch.optim as optim
from torch.utils.data import DataLoader
from datasets import DATASET_NAMES, TrainDataset, TestDataset, dataset_info
from losses import *
from model import DexiNed
from model_... | 2.09375 | 2 |
yahoo_weather/classes/errors.py | M-Ahadi/yahoo_weather | 7 | 49946 | <gh_stars>1-10
class Error:
unacceptable_json = "json input has unacceptable format."
| 1.320313 | 1 |
software/python/simple_pendulum/controllers/lqr/roa/plot.py | dfki-ric-underactuated-lab/torque_limited_simple_pendulum | 15 | 49947 | import numpy as np
import matplotlib.pyplot as plt
from matplotlib import patches
def get_ellipse_params(rho,M):
"""
Returns ellipse params (excl center point)
"""
#eigenvalue decomposition to get the axes
w,v=np.linalg.eigh(M/rho)
try:
#let the smaller eigenvalue define the width (m... | 3.3125 | 3 |
tempodb_archive.py | eman/tempodb-archive | 0 | 49948 | <filename>tempodb_archive.py
'''
Copyright (c) 2014, <NAME>
All rights reserved.
License BSD
'''
from __future__ import print_function
import argparse
import datetime
import sqlite3
import os
try:
import configparser
except ImportError:
import ConfigParser as configparser
from tempodb import Client
__version__... | 2.34375 | 2 |
training.py | denyssilveira/gsdtm_lmdtm_topic_model | 4 | 49949 | <filename>training.py
"""
GSDTM and LMDTM VAEs Implementation
Trains the models
"""
import tensorflow as tf
import numpy as np
import sys
import os
import model.gsdtm as gsdtm
import model.lmdtm as lmdtm
import model.data as data
import model.evaluate as evaluate
from model import utils
def train(dataset, vocabsiz... | 2.1875 | 2 |
aiotfm/utils/enum.py | Blank3495/aiotfm | 0 | 49950 | class EnumMeta(type):
base = False
def __new__(cls, name, bases, kw):
klass = type.__new__(cls, name, bases, kw)
if not EnumMeta.base:
EnumMeta.base = True
return klass
return klass()
class Enum(metaclass=EnumMeta):
def __getitem__(self, key):
if isinstance(key, int):
for k in dir(self):
if len... | 2.625 | 3 |
course/lesson07/task07/tail.py | mstepovanyy/python-training | 0 | 49951 | <gh_stars>0
#!/usr/bin/python3
"""
Tail
----
Write a program that prints ``N`` last lines of a file in reverse order (just
like a ``tail -r`` FreeBSD command). Both file name and a number of lines to
print shall be passed as command-line arguments.
Think of a memory-efficient yet fast way to implement this task.
"""
... | 4.25 | 4 |
venv/lib/python3.8/site-packages/pip/_vendor/tomli/__init__.py | Retraces/UkraineBot | 2 | 49952 | /home/runner/.cache/pip/pool/cf/51/25/b749cb02a5396340ce9fda7fffc4272d66af9443a947242291d6202aba | 0.761719 | 1 |
helper_func.py | akshay-121/SURP-Animal-species-detection-from-videos | 0 | 49953 | import cv2
import matplotlib.pyplot as plt
import numpy as np
import tensorflow as tf
from google.colab.patches import cv2_imshow
from tensorflow.keras.applications import *
from tensorflow.keras.layers import *
from tensorflow.keras.models import *
from math import *
import glob
import os
import time
from ... | 2.328125 | 2 |
server.py | fongchinghinunsw/WhatsApp | 0 | 49954 | <gh_stars>0
# Python 3.7
# Usage: python3 server.py server_port block_duration timeout
# coding: utf-8
import sys
from socket import *
from datetime import datetime
from threading import Timer, Condition, Thread
from helper import retrieve_components, decorate_chat_msg, is_existing_user, username2password
server_por... | 3.328125 | 3 |
utils.py | melmups/simple-link-extractor | 0 | 49955 | <gh_stars>0
from urllib import request
import os
def read_url_as_string(url, encoding='utf8'):
"""
Read the url specified as a string in the specified encoding
"""
# Send http request
fp = request.urlopen(url)
# Read response bytearray
responseBytes = fp.read()
# Decode the byte arra... | 3.4375 | 3 |
06/main.py | Sorebit/AoC2019 | 0 | 49956 | <filename>06/main.py
# https://adventofcode.com/2019/day/6
import sys
sys.path.append("../")
from modules.utils import check
# Global, so should be cleared if you want to run solve again
neighbours = {}
values = {}
parents = {}
visited = {}
NODE_ROOT = "COM"
def dfs(node):
if node not in neighbours:
... | 3.53125 | 4 |
planeSyntheticData/test.py | AndreaCodd/gamb | 2 | 49957 | <gh_stars>1-10
#
#.. create syth_test.geo file form this file
#
# python3 mkSyntheticGeoData2D.py test
#
#.. create 3D mesh syth_testmesh.msh
#
# gmsh -3 -format msh2 -o syth_testmesh.msh syth_test.geo
#
#.. run for synthetic data
#
# python3 mkSyntheticData2D.py -s synth -g -m test
#
# creating test_grav.n... | 2.5 | 2 |
transposition_cyphers/railfence.py | MahatKC/Daniao | 2 | 49958 | <filename>transposition_cyphers/railfence.py
import numpy as np
def rail_fence(plaintext, n):
if type(n) != int: raise NameError("Expected integer as parameter")
if n == 0: raise ZeroDivisionError
plaintext_length = len(plaintext)
line_size = int(np.ceil(plaintext_length/n))
cyphertext = ""
... | 3.1875 | 3 |
books/dl-for-nlp/word2vec/common.py | Bingwen-Hu/hackaway | 0 | 49959 | import random
import collections
import math
import os
import zipfile
import time
import re
import numpy as np
import tensorflow as tf
from matplotlib import pylab
from six.moves import range
from six.moves.urllib.request import urlretrieve
dataset_link = 'http://mattmahoney.net/dc/'
zip_file = 'text8.zip'
def data_d... | 2.65625 | 3 |
intro.py | tydyus/HardZone_enjam2017_exterieur | 0 | 49960 | import pygame
from pygame.locals import *
import time
from assets import *
from terrain import *
from player import *
from pnj import *
from carte import *
class intro():
time = 0
end = 670
def intro():
intro.time += 1
# arrivé dans le monde
s1 = 35
#vue du hl
s2 = ... | 2.703125 | 3 |
tests/stub.py | rafa-acioly/circuitpy | 0 | 49961 | <filename>tests/stub.py
from circuitpy.base import BaseCircuitBreaker
class StubStorage:
errors_quantity: int = 0
def increment(self, key: str) -> int:
self.errors_quantity += 1
def expire(self, key: str, ttl: int) -> None:
pass
def get(self, key: str) -> int:
return self.e... | 2.359375 | 2 |
dltb/thirdparty/tensorflow/v1.py | CogSciUOS/DeepLearningToolbox | 2 | 49962 | <gh_stars>1-10
"""Tensorflow version 1 access module.
from dltb.thirdparty.tensorflow.v1 import tensorflow as tf
"""
import sys
import logging
import tensorflow # pylint: disable=wrong-import-position
from . import TF_LOGGER
def disable_v2_behavior():
"""Disables TensorFlow 2.x behaviors.
This function can... | 2.234375 | 2 |
app1/migrations/0004_auto_20200131_1129.py | awzdevelopers/FlightStrips_django | 0 | 49963 | # Generated by Django 2.0.3 on 2020-01-31 07:59
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('app1', '0003_auto_20200129_0337'),
]
operations = [
migrations.AlterField(
model_name='flight',
name='stripImage',
... | 1.359375 | 1 |
iceworm/trees/_antlr/__init__.py | wrmsr/iceworm | 0 | 49964 | <filename>iceworm/trees/_antlr/__init__.py
from .IceSqlLexer import IceSqlLexer # noqa
from .IceSqlLexer import IceSqlParserConfig # noqa
from .IceSqlListener import IceSqlListener # noqa
from .IceSqlListener import IceSqlParserConfig # noqa
from .IceSqlParser import IceSqlParser # noqa
from .IceSqlParser import I... | 1.054688 | 1 |
_includes/code/shopping/cart.py | rajat19/grokking-system-design | 4 | 49965 | class Item:
def __init__(self, id, quantity, price):
self.__product_id = id
self.__quantity = quantity
self.__price = price
def update_quantity(self, quantity):
None
class ShoppingCart:
def __init__(self):
self.__items = []
def add_item(self, item):
None
def remove_item(self, item... | 2.984375 | 3 |
HerixWorkbench/widgets/spec_file_list.py | Phaulo71/HerixWorkbench | 0 | 49966 | <filename>HerixWorkbench/widgets/spec_file_list.py
#!/usr/bin/env python
"""
Copyright (c) UChicago Argonne, LLC. All rights reserved.
See LICENSE file.
"""
# -------------------------------------------Imports-------------------------------------------------------------------#
from __future__ import unicode_literals
... | 2.21875 | 2 |
app/utils.py | 1-gut/musicsamples | 0 | 49967 | <filename>app/utils.py<gh_stars>0
import csv
import datetime
from django.http import HttpResponse
def export_csv(queryset, study_name="gtrac"):
"""
Takes in queryset, returns csv download response
study_name parameter is optional to control the name of the csv file.
"""
current_date = datetime.da... | 2.8125 | 3 |
tools/toolkit_search.py | Altify-Development/Hacking-Tools | 1 | 49968 | import os , time
from client.client import client
from client.text_color import color
def main():
client().system("clear")
client().system(f"figlet Tool Kit Searcher")
client().puts(f"Welcome to Tool Kit Search Tool\n\ngithub.com/Altify-Development")
client().puts(f"{color.GREEN}[✔] St... | 2.890625 | 3 |
snippets/13.py | krrg/python-tutorial | 0 | 49969 | <filename>snippets/13.py
my_list = [3, 1, 4, 5] | 1.609375 | 2 |
main.py | Servuc/Concoction | 0 | 49970 | from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
from urlparse import urlparse, parse_qs
import argparse
import concoction
class WebServer(BaseHTTPRequestHandler):
def _set_headers(self):
self.send_response(200)
self.send_header('Content-type', 'text/plain')
self.end_headers()... | 2.953125 | 3 |
CalibPPS/ESProducers/python/ctppsRPAlignmentCorrectionsDataESSourceXML_cfi.py | ckamtsikis/cmssw | 852 | 49971 | import FWCore.ParameterSet.Config as cms
ctppsRPAlignmentCorrectionsDataESSourceXML = cms.ESSource("CTPPSRPAlignmentCorrectionsDataESSourceXML",
verbosity = cms.untracked.uint32(0),
MeasuredFiles = cms.vstring(),
RealFiles = cms.vstring(),
MisalignedFiles = cms.vstring()
)
| 1.109375 | 1 |
PG/5-TNPG/model.py | g6ling/Pytorch-Cartpole | 116 | 49972 | import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
from config import gamma, lr
def flat_grad(grads):
grad_flatten = []
for grad in grads:
grad_flatten.append(grad.view(-1))
grad_flatten = torch.cat(grad_flatten)
return grad_flatten
def flat_hessian(hessians... | 2.375 | 2 |
tests/dump_tests/module_tests/port_test.py | chaoskao/sonic-utilities | 91 | 49973 | import json
import os
import sys
import jsonpatch
import unittest
import pytest
from deepdiff import DeepDiff
from mock import patch
from dump.helper import create_template_dict, sort_lists
from dump.plugins.port import Port
from dump.match_infra import MatchEngine, ConnectionPool
from swsscommon.swsscommon import Soni... | 2.203125 | 2 |
Competitive_Programming/Stepping_stones_3.py | varshakancham/Data_Structure_n_Algorithms | 125 | 49974 | """
Vasu is running up a stone staircase with N stones, and can hop(jump) either 1 step, 2 steps or 3 steps at a time.
You have to count, how many possible ways Vasu can run up to the stone stairs.
Input Format:
Input contains integer N that is number of steps
Constraints:
1<= N <=30
Output Format:
Output f... | 4 | 4 |
python/SumProblem/SumProblem.py | taohu88/coding | 0 | 49975 | from numpy.random import randint
def find_sum(a_list, target):
r = []
sz = len(a_list)
for i in range(sz):
for j in range(i+1, sz):
if (a_list[i] + a_list[j]) == target:
r.append((a_list[i], a_list[j]))
return r
def fast_sum(a_list, target):
r = []
h = {}
... | 3.671875 | 4 |
neural_processes/base_map.py | yifan-you-37/rl_swiss | 56 | 49976 | from neural_processes.generic_map import GenericMap
class BaseMap(GenericMap):
'''
Parametrizing the mapping used in Neural Processes
f = BaseMap(..., deterministic=True)
y = f(x,z)
-- or --
f = BaseMap(..., deterministic=False)
y_mean, y_std = f(x,z)
The P... | 2.90625 | 3 |
src/qa/training/configuration.py | azadyasar/GenerativeQA | 0 | 49977 | <gh_stars>0
from qa.modeling import (Transformer,
Encoder,
Decoder)
from qa.util import init_weights, count_parameters
from qa.data import Vocabulary
import logging
logger = logging.getLogger("TrainerConfig")
class TransformerModelConfig(object):
def __init__(self,... | 2.28125 | 2 |
api/admin.py | jgeofil/avax-python | 25 | 49978 | <filename>api/admin.py
# avax-python : Python tools for the exploration of the Avalanche AVAX network.
#
# Documentation at https://crypto.bi
"""
Copyright © 2021 ojrdev
Support this Open Source project!
Donate to X-avax1qr6yzjykcjmeflztsgv6y88dl0xnlel3chs3r4
Permission is hereby granted, free of charge, to any per... | 1.992188 | 2 |
cupy_alias/padding/__init__.py | fixstars/clpy | 142 | 49979 | <gh_stars>100-1000
from clpy.padding import * # NOQA
| 0.960938 | 1 |
layoutlmv2/src/layoutlm/trainers/__init__.py | bjorz/unilm | 0 | 49980 | <filename>layoutlmv2/src/layoutlm/trainers/__init__.py
from .funsd_trainer import FunsdTrainer
| 1.179688 | 1 |
approval_system/forms.py | rmboot/approvalsystem | 3 | 49981 | <reponame>rmboot/approvalsystem
from flask_login import current_user
from flask_wtf import FlaskForm
from flask_ckeditor import CKEditorField
from flask_wtf.file import FileField, FileAllowed, FileRequired
from wtforms import StringField, SubmitField, BooleanField, PasswordField, SelectField, TextAreaField
from wtforms... | 2.0625 | 2 |
src/assistants/compliance/cleaning/preprocessing.py | the-scouts/assistants | 0 | 49982 | <reponame>the-scouts/assistants
from __future__ import annotations
import datetime
from pathlib import Path
from typing import Optional, TYPE_CHECKING
import warnings
import pandas as pd
import pandas.errors
from assistants.compliance.cleaning import canonicalisation
from assistants.compliance.util import fields
fro... | 2.3125 | 2 |
metarecord/admin/_common.py | kerkkoheiskanen/helerm | 0 | 49983 | from django.contrib import admin
from metarecord.forms import UTF8HStoreField
class StructuralElementAdmin(admin.ModelAdmin):
def get_form(self, request, obj=None, **kwargs):
kwargs['field_classes'] = {'attributes': UTF8HStoreField}
return super().get_form(request, obj, **kwargs)
| 1.75 | 2 |
metagrad/dataset.py | nlp-greyfoss/metagrad | 7 | 49984 | <gh_stars>1-10
from metagrad.tensor import Tensor
class Dataset:
def __getitem__(self, index):
return NotImplementedError
class TensorDataset(Dataset):
def __init__(self, *tensors: Tensor) -> None:
self.tensors = tensors
def __getitem__(self, index):
return tuple(tensor[index] ... | 2.546875 | 3 |
engine.py | pythonleo/ProjektVocho | 0 | 49985 | <gh_stars>0
import os
import subprocess
import wave
import statistics
from math import ceil
import librosa
import soundfile
import numpy
import scipy.io.wavfile
filter_low = 430 # Not sure of its purpose, mentioned in utau_output.txt
voicebank = "lty"
filename = "a.wav"
def freq(fname):
time_list = []
freq... | 2.640625 | 3 |
src/spider/spiders.py | jsrgqinbin/ok_ip_proxy_pool | 0 | 49986 | import asyncio
import random
import re
from abc import ABC
from typing import List, Iterable
from src.entity.proxy_entity import ProxyEntity
from src.enum.common import ProxyCoverEnum, ProxyTypeEnum
from src.log.logger import logger
from src.spider.abs_spider import AbsSpider
from bs4 import BeautifulSoup, Tag
from pyp... | 2.3125 | 2 |
search_rotated_sorted_array/solution.py | haotianzhu/C_Questions_Solutions | 0 | 49987 | class Solution(object):
def search(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: int
"""
if not nums:
return -1
lo = 0
hi = len(nums)-1
old_size = len(nums)
# if not rotated
if nums[lo] <= nums[hi]:
return self.binary_search(nums,lo,hi+1,target)
else:
# ext... | 3.796875 | 4 |
v1/confirmation_blocks/migrations/0001_initial.py | Kenan7/Bank | 2 | 49988 | <filename>v1/confirmation_blocks/migrations/0001_initial.py
# Generated by Django 3.0.6 on 2020-07-14 02:47
from django.db import migrations, models
import django.db.models.deletion
import uuid
class Migration(migrations.Migration):
initial = True
dependencies = [
('blocks', '0001_initial'),
... | 1.726563 | 2 |
main.py | Karaaslan29/gooz-operating-system-esp32 | 2 | 49989 | import gooz_basic
import dev.gooz_thread
import os
username = "Gorkem"
password = "<PASSWORD>"
login_flag = False
print("Welcome to GoozOS")
usr = input("Username: ")
if usr == username:
paswd = input("Password: ")
if paswd == password:
login_flag = True
else:
print("Wrong Password")
else:... | 2.640625 | 3 |
lightly/active_learning/scorers/__init__.py | CodeGuy-007/lightly | 1,515 | 49990 | """ Collection of Active Learning Scorers """
# Copyright (c) 2020. Lightly AG and its affiliates.
# All Rights Reserved
from lightly.active_learning.scorers.scorer import Scorer
from lightly.active_learning.scorers.classification import ScorerClassification
from lightly.active_learning.scorers.detection import Score... | 0.804688 | 1 |
AlphaZero/Nets.py | IvLabs/model-based-RL | 7 | 49991 | ## This File Contains all the different Neural Network Architectures used and the Loss function
import torch
import torch.nn as nn
import torch.nn.functional as functions
## Dense Network
class Dense(nn.Module):
def __init__(self):
super(Dense,self).__init__()
self.fc1 = nn.Linear(6*7,32) #board... | 3.203125 | 3 |
util/spark.py | Manish-22/Sentiment-Analysis-using-Spark-Streaming | 0 | 49992 | import findspark
findspark.init()
import time
from pyspark import SparkConf,SparkContext
from pyspark.streaming import StreamingContext
from pyspark.sql import Row,SQLContext
import sys
import requests
def aggregate_tweets_count(new_values, total_sum):
return sum(new_values) + (total_sum or 0)
conf=S... | 2.796875 | 3 |
load_csv.py | liuhuihuii/py_pandas_csv | 0 | 49993 | <reponame>liuhuihuii/py_pandas_csv
import ccxt
import datetime
import time
import math
import pandas as pd
###optimization####
##Const variables###
symbol = str('BTC/USD')
timeframe = str('5m') ##k线 目前仅支持 1m 5m 1h 1d
exchange = str('bitmex')
start_date = input('请输入开始日期,格式:yyyy-mm-dd HH:MM:SS: ')
... | 2.59375 | 3 |
plugins/dbnd-docker/src/dbnd_docker/kubernetes/kube_dbnd_client.py | ipattarapong/dbnd | 0 | 49994 | <filename>plugins/dbnd-docker/src/dbnd_docker/kubernetes/kube_dbnd_client.py
import logging
import pprint
import time
import typing
from datetime import datetime
from typing import Optional
from airflow.contrib.kubernetes.pod_launcher import PodStatus
from kubernetes import client
from kubernetes.client.rest import A... | 1.71875 | 2 |
playlists/tests/test_models.py | lund5000/chirpradio | 2 | 49995 | <gh_stars>1-10
###
### Copyright 2009 The Chicago Independent Radio Project
### 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/... | 1.898438 | 2 |
resources/fit_out_cost_prediction.py | simon-norman/api-cost-predictor | 0 | 49996 |
from flask import jsonify, Blueprint, request
from flask_restful import Resource, Api
from services.cost_prediction_model.cost_prediction_model import CostPredictionModel
from services.building_vol_calculator.building_vol_metres_calculator import BuildingVolMetresCalculator
from measurement.utils import guess
from s... | 2.28125 | 2 |
install/core/python/tank/commands/switch.py | JoanAzpeitia/lp_sg | 0 | 49997 | # Copyright (c) 2013 Shotgun Software Inc.
#
# CONFIDENTIAL AND PROPRIETARY
#
# This work is provided "AS IS" and subject to the Shotgun Pipeline Toolkit
# Source Code License included in this distribution package. See LICENSE.
# By accessing, using, copying or modifying this work you indicate your
# agreement to t... | 2.375 | 2 |
__init__.py | LAIRLAB/libpyarr | 1 | 49998 | <gh_stars>1-10
__all__ = ['gen_everything', 'code_gen', 't_code_gen', 'boost_util', 'pdbwrap']
| 1.085938 | 1 |
hunterdouglasplatinum/__main__.py | schwark/pyhunterdouglasplatinum | 0 | 49999 | from .hunterdouglasplatinum import HunterDouglasPlatinumHub
import argparse
import sys
import asyncio
def err(msg):
sys.stderr.write(msg+"\n")
async def main():
parser = argparse.ArgumentParser()
parser.add_argument("ip",
help="ip address of the hub")
parser.add_argument("-d", ... | 2.46875 | 2 |