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 |
|---|---|---|---|---|---|---|
kickbase_api/models/league_user_stats.py | jhelgert/kickbase-api-python | 7 | 15800 | from datetime import datetime
from kickbase_api.models._transforms import parse_date, parse_key_value_array_to_dict
from kickbase_api.models.base_model import BaseModel
from kickbase_api.models.league_user_season_stats import LeagueUserSeasonStats
class LeagueUserStats(BaseModel):
name: str = None
profile_im... | 2.484375 | 2 |
ocradmin/lib/fcrepo/http/interfaces.py | mikesname/ocropodium | 2 | 15801 | <filename>ocradmin/lib/fcrepo/http/interfaces.py
""" Interfaces for FCRepoRequestFactory, FCRepoResponse and FCRepoResponseBody.
"""
from exceptions import NotImplementedError
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#
class I_FCRepoResponseBody:
def __init__(self, raw_conte... | 2.515625 | 3 |
mesh_utilities.py | qingfengxia/quasi_static_metal_cutting | 2 | 15802 | <gh_stars>1-10
#utf8
from __future__ import print_function, division
import subprocess
import os
import os.path
import sys
import time
default_tmp_mesh_filename = '/tmp/Mesh_1.med'
# salome 9.x may be too new for this script, some version released in 2018 is better
# salome_app = '/media/sf_OneDrive/Salome-9.8.0/salom... | 2.109375 | 2 |
cubi_tk/ena_constants.py | eudesbarbosa/cubi-tk | 3 | 15803 | <filename>cubi_tk/ena_constants.py<gh_stars>1-10
"""Values for controlled vocabularies from ENA.
Taken from
- https://ena-docs.readthedocs.io/en/latest/submit/reads/webin-cli.html
"""
# Constants for platform definitions.
LS454 = "LS454"
ILLUMINA = "ILLUMINA"
PACBIO_SMRT = "PACBIO_SMRT"
IONTORRENT = "IO... | 1.515625 | 2 |
analytics/utils.py | educreations/py-analytics | 10 | 15804 | <reponame>educreations/py-analytics
"""
Copyright 2012 <NAME> <<EMAIL>>
This file is provided to you 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 req... | 2.203125 | 2 |
lemkelcp/__init__.py | pritam-dey3/lemkelcp | 10 | 15805 | <filename>lemkelcp/__init__.py<gh_stars>1-10
from .lemkelcp import lemkelcp
| 1.070313 | 1 |
settings.py | ArneBinder/Pytorch-LRP | 117 | 15806 | <gh_stars>100-1000
"""
Settings for re-running the experiments from the paper "Layer-wise
relevance propagation for explaining deep neural network decisions
in MRI-based Alzheimer’s disease classification".
Please note that you need to download the ADNI data from
http://adni.loni.usc.edu/ and preprocess it using
htt... | 2.40625 | 2 |
compiler_test.py | zpcore/ACOW | 0 | 15807 | <reponame>zpcore/ACOW<filename>compiler_test.py
'''
# Test the compiler
'''
from ACOW import *
data = '''
a1 U[1,2] !a0&G[1,3]a3
'''
print('MTL Formula:',data)
# Test lex
print('\nLex Test:')
lexer.input(data)
for tok in lexer:
print(tok)
# Test parser
print('\nParser Test:')
result = parser.parse(data)
print(resul... | 2.234375 | 2 |
code.py | RanaTe/AntiLogOut | 0 | 15808 | <filename>code.py
import board
import time
import random
import usb_hid
from adafruit_hid.mouse import Mouse
from adafruit_hid.keyboard import Keyboard
mouse = Mouse(usb_hid.devices)
goright=True
while True:
#2 parts to sequence, move mostly right, then mostly left
# set up for big move
#longwait=ran... | 3.4375 | 3 |
insta/admin.py | Stephenremmi/insta-clone | 0 | 15809 | from django.contrib import admin
from .models import Post, Comment, UserProfile
class ProfileAdmin(admin.ModelAdmin):
filter_horizontal =("followers", "following",)
# Register your models here.
admin.site.register(Post)
admin.site.register(Comment)
admin.site.register(UserProfile, admin_class=ProfileAdmin)
| 1.804688 | 2 |
travelling/migrations/0001_initial.py | HerbyDE/jagdreisencheck-webapp | 0 | 15810 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.16 on 2018-11-27 14:43
from __future__ import unicode_literals
import ckeditor.fields
from django.conf import settings
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import django.db.models.deletion
import django_countries.fields
... | 1.828125 | 2 |
bio2.py | phenolophthaleinum/BioPython | 0 | 15811 | from Bio.SeqIO import parse
from Bio import SeqIO
from Bio.SeqRecord import SeqRecord
from Bio.Seq import Seq
from Bio.Alphabet import IUPAC, generic_dna
from Bio import Alphabet, Entrez
from Bio.SeqUtils import GC
from Bio.Blast import NCBIWWW, NCBIXML
from Bio import pairwise2
from Bio.pairwise2 import format_alignme... | 2.546875 | 3 |
room/easyctf/exploit/46635.py | danieldavidson/tryhackme-ctf | 0 | 15812 | <filename>room/easyctf/exploit/46635.py
#!/usr/bin/env python
# Exploit Title: Unauthenticated SQL Injection on CMS Made Simple <= 2.2.9
# Date: 30-03-2019
# Exploit Author: <NAME> @ Certimeter Group
# Vendor Homepage: https://www.cmsmadesimple.org/
# Software Link: https://www.cmsmadesimple.org/downloads/cmsms/
... | 2.15625 | 2 |
module3-nosql-and-document-oriented-databases/rpg_mongo.py | Dpgofast/DS-Unit-3-Sprint-2-SQL-and-Databases | 0 | 15813 | import pymongo
client = pymongo.MongoClient('''mongodb://dakotapope:<PASSWORD>wrd@
cluster0-shard-00-00-iaoct.mongodb.net:27017,cluster0-shard-00
-01-iaoct.mongodb.net:27017,cluster0-shard-00-02-iaoct.mongodb.
net:27017/test?ssl=true&replicaSet=Cluster0-shard-0&authSource=
admin&retryWrites=true''')
# investigate the ... | 2.546875 | 3 |
convertPP.py | Harry93x/FinancialToolbox | 0 | 15814 | <reponame>Harry93x/FinancialToolbox
#!/usr/bin/python3
import xlrd
import csv
import sys
import getopt
# input configuration
iColDate = 0
iColTransactionType = 1
iColAmount = 3
iColDescription = 6
transactionType = 'Repayment'
descriptionType = 'Interest'
#output configuration
outHeader = ['Datum', 'Typ', 'Wert']
ou... | 2.59375 | 3 |
lib/python3.7/site-packages/vine/__init__.py | nguyentranhoan/uit-mobile | 13 | 15815 | """Promises, promises, promises."""
from __future__ import absolute_import, unicode_literals
import re
from collections import namedtuple
from .abstract import Thenable
from .promises import promise
from .synchronization import barrier
from .funtools import (
maybe_promise, ensure_promise,
ppartial, preplace... | 2.109375 | 2 |
Ben_Manuscripts/transport/figures/hops_dwells.py | shirtsgroup/LLC_Membranes | 4 | 15816 | #!/usr/bin/env python
import numpy as np
import matplotlib.pyplot as plt
from LLC_Membranes.timeseries.forecast_ctrw import System
from LLC_Membranes.llclib import file_rw
import names
residues = ["GCL", "SOH"]
wt = 10
path = "/home/bcoscia/Documents/Gromacs/Transport/NaGA3C11"
colors = ['blue', 'red']
opacity = 1
n... | 1.992188 | 2 |
1450.py | sinasiruosnejad/leetcode | 0 | 15817 | <reponame>sinasiruosnejad/leetcode
def string_to_list(string,array):
x=input(string)
i=1
while x[i]!=']':
if x[i]!=',':
j=i
temp=''
while x[j]!=',':
if x[j]==']':
break
temp+=x[j]
j+=1
... | 3.625 | 4 |
backend/model/migrate/versions/4dbaa3104f4_.py | deti/boss | 7 | 15818 | """Added tariff
Revision ID: 4dbaa3104f4
Revises: <PASSWORD>
Create Date: 2015-05-27 16:00:09.343862
"""
# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = '<PASSWORD>'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
def upgrade(engine_name):
glob... | 1.65625 | 2 |
delay.py | MythologicalMC/Delay | 0 | 15819 | <filename>delay.py
#imports
import os
import subprocess
from colorama import init,Fore, Back, Style
import asyncio
import urllib.parse
import time
from time import perf_counter
init(convert=True)
#vars
ver = "Beta, Lots of commits going on!"
ping = 0
pings = []
tempping = 0
searches = 0
base = 300
delay = 0
gotQ = ""
d... | 2.859375 | 3 |
src/calc/parallel/calc_qual.py | paytonrodman/athena-analysis | 0 | 15820 | <gh_stars>0
#!/usr/bin/env python3
#
# calc_qual.py
#
# A program to calculate the quality factors and magnetic angle within some defined region
# of an Athena++ disk using MPI
#
# To run:
# mpirun -n [n] python calc_qual.py [options]
# for [n] cores.
#
import numpy as np
import os
import sys
sys.path.insert(0, '/home/... | 2.046875 | 2 |
config/access/model_base.py | torrua/loglan_converter | 0 | 15821 | <gh_stars>0
from sqlalchemy import Column, String, Integer, Text, Boolean, DateTime
from config.access import Base
from sqlalchemy.ext.declarative import declared_attr
from datetime import datetime
class BaseFunctions:
"""
Base class for common methods
"""
__tablename__ = None
@declared_attr
... | 2.46875 | 2 |
src/fixate/drivers/ftdi.py | stig999/Fixate | 1 | 15822 | import ctypes
import struct
import time
from fixate.core.common import bits
from fixate.core.exceptions import InstrumentError, InstrumentNotConnected
import fixate.config
import fixate.core.discover
def open(ftdi_description=""):
"""Open is the public api for the bit bang driver for discovering and opening a con... | 2.40625 | 2 |
Data Structures/Python/find-the-parity-outier.py | KhushMody/Ds-Algo-HacktoberFest | 12 | 15823 | <reponame>KhushMody/Ds-Algo-HacktoberFest
# You are given an array (which will have a length of at least 3, but could be very large) containing integers. The array is either entirely comprised of odd integers or entirely comprised of even integers except for a single integer N. Write a method that takes the array as an... | 4.375 | 4 |
geoalchemy2/tests/test_functional.py | fredj/geoalchemy2 | 0 | 15824 | import unittest
from nose.tools import eq_, ok_, raises
from sqlalchemy import create_engine, MetaData, Column, Integer, func
from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.declarative import declarative_base
from geoalchemy2 import Geometry
from sqlalchemy.exc import DataError, IntegrityError, InternalE... | 2.578125 | 3 |
WebEmpresarial/social/models.py | MarcosKlender/Web_Empresarial | 0 | 15825 | <reponame>MarcosKlender/Web_Empresarial<filename>WebEmpresarial/social/models.py
from django.db import models
# Create your models here.
class Link(models.Model):
key = models.SlugField(max_length = 100, unique = True, verbose_name = 'Nombre Clave')
name = models.CharField(max_length = 200, verbose_name = 'Red... | 2.28125 | 2 |
p138_copy_list_with_random_pointer.py | moonfruit/leetcode | 0 | 15826 | <reponame>moonfruit/leetcode
#!/usr/bin/python
# -*- utf-8 -*-
# Definition for singly-linked list with a random pointer.
# class RandomListNode:
# def __init__(self, x):
# self.label = x
# self.next = None
# self.random = None
class Solution:
# @param head, a RandomListNode
# @ret... | 3.71875 | 4 |
train.py | jmnybl/finnish-srl | 0 | 15827 | <gh_stars>0
from data_reader import Vocabulary, transform_data, save_vocabularies, Corpus
from model import build_model
from keras.callbacks import ModelCheckpoint
def train(args):
# ARGUMENTS
training_file=args.data
minibatch=64
max_sent_len_words=30
epochs=args.epochs
corpus=Corpu... | 2.453125 | 2 |
peekingduck/utils/requirement_checker.py | ericleehy/PeekingDuck | 1 | 15828 | <filename>peekingduck/utils/requirement_checker.py
# Copyright 2022 <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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | 2.203125 | 2 |
src/myproject/settings/admin_mail_console_handler.py | thinkAmi/DjangoCongress_JP_2019_talk | 1 | 15829 | <filename>src/myproject/settings/admin_mail_console_handler.py
from .base import *
# 後で確認できるよう、ファイルとして残しておく
EMAIL_BACKEND = 'django.core.mail.backends.filebased.EmailBackend'
# filebasedを使う場合は、メールの保存先も指定すること
# '.' の場合、カレントディレクトリに保存される
# EMAIL_FILE_PATH = '.'
EMAIL_FILE_PATH = str(pathlib.Path(BASE_DIR).joinpath('logs... | 1.90625 | 2 |
core/tests/machine_request.py | xuhang57/atmosphere | 0 | 15830 | from dateutil.relativedelta import relativedelta
from uuid import uuid4
import unittest
import pytz
from django.test import TestCase
from django.utils.timezone import datetime
from core.tests.helpers import CoreProviderMachineHelper, CoreMachineRequestHelper, CoreInstanceHelper
from service.machine import process_m... | 2.453125 | 2 |
infoblox_netmri/api/remote/models/device_zone_remote.py | IngmarVG-IB/infoblox-netmri | 0 | 15831 | from ..remote import RemoteModel
from infoblox_netmri.utils.utils import check_api_availability
class DeviceZoneRemote(RemoteModel):
"""
Zones defined on a traffic filtering device. On devices that do not natively support zones (e.g., Cisco routers), there is one zone per interface, plus an additional 'intern... | 2.625 | 3 |
nitmis_admin/controllers/register.py | kalesh13/nitmis | 0 | 15832 | from rest_framework.views import APIView
from rest_framework.response import Response
from django.shortcuts import render
from django.http.response import JsonResponse
from nitmis_admin.serializers.UserSerializer import UserSerializer
def create_user(role="Guest"):
"""
"""
def fun_wrapper(func):
d... | 2.15625 | 2 |
3_0_pgo_icp/solution/pose_graph_optimization/assignment_I_2/pgo_2D.py | karanchawla/ai_for_robotics | 65 | 15833 | <gh_stars>10-100
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Sun Apr 2 10:00 2017
@author: <NAME> (<EMAIL>)
"""
import math
from math import floor, ceil
import numpy as np
import matplotlib.pyplot as plt
from scipy.sparse import linalg as sla
from scipy import array, linalg, dot
from enum import Enum
... | 2.390625 | 2 |
simple_history/management/commands/_populate_utils.py | SummitESP/django-simple-history | 0 | 15834 | from django.utils.timezone import now
class NotHistorical(TypeError):
"""No related history model found."""
def get_history_model_for_model(model):
"""Find the history model for a given app model."""
try:
manager_name = model._meta.simple_history_manager_attribute
except AttributeError:
... | 2.578125 | 3 |
anagrams.py | zubrik13/coding_intrv_prer | 0 | 15835 | <filename>anagrams.py
"""
A student is taking a cryptography class and has found anagrams to be very useful.
Two strings are anagrams of each other if the first string's letters can be
rearranged to form the second string. In other words, both strings must
contain the same exact letters in the same exact frequency. ... | 4.28125 | 4 |
PhoenixNow/login.py | ECGHelloWorld/PhoenixNow | 2 | 15836 | from flask_login import LoginManager
from PhoenixNow.model import User
login_manager = LoginManager()
login_manager.login_view = "regular.signin"
@login_manager.user_loader
def load_user(user_id):
user = User.query.filter_by(id=user_id).first()
return user
| 2.3125 | 2 |
mobi_parse_data.py | josting/CS538_Project | 0 | 15837 | import os
import datetime as dt
import random
import networkx
# import matplotlib as mpl
import matplotlib.pyplot as plt
from const import *
activity = {}
with open(os.path.join(DATA_DIR, "mobiclique", "activity.csv")) as activity_fd:
for line in activity_fd.readlines():
line = line.strip()
... | 2.375 | 2 |
tests/tests_geomstats/test_general_linear.py | tfunatomi/geomstats | 2 | 15838 | <filename>tests/tests_geomstats/test_general_linear.py<gh_stars>1-10
"""Unit tests for the General Linear group."""
import warnings
import tests.helper as helper
import geomstats.backend as gs
import geomstats.tests
from geomstats.geometry.general_linear import GeneralLinear
RTOL = 1e-5
class TestGeneralLinear(ge... | 2.484375 | 2 |
teszt/test_feladat03-06.py | python-feladatok-tesztekkel/05-01-10-dolgozat | 0 | 15839 | <reponame>python-feladatok-tesztekkel/05-01-10-dolgozat<filename>teszt/test_feladat03-06.py
from unittest import TestCase
import os,sys,inspect
current_dir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parent_dir = os.path.dirname(current_dir)
sys.path.insert(0, parent_dir)
import feladat... | 2.4375 | 2 |
{{cookiecutter.project_name}}/pages/main_page.py | victory-sokolov/selenium-boilerplate | 0 | 15840 | from utils.Driver import Driver
from pages.base_page import BasePage
from pages.locators import MainPageLocators
class MainPage(BasePage):
def __init__(self, driver: Driver):
self.locators = MainPageLocators
super().__init__(driver=driver) | 2 | 2 |
boardgames/main/migrations/0001_initial.py | diophung/django-sample | 0 | 15841 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-08-16 07:49
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 = [
migratio... | 1.726563 | 2 |
src/tools/nuscenes-devkit/prediction/tests/test_mtp_loss.py | jie311/TraDeS | 475 | 15842 |
import math
import unittest
import torch
from nuscenes.prediction.models import mtp
class TestMTPLoss(unittest.TestCase):
"""
Test each component of MTPLoss as well as the
__call__ method.
"""
def test_get_trajectories_and_modes(self):
loss_n_modes_5 = mtp.MTPLoss(5, 0, 0)
los... | 2.59375 | 3 |
json2graph.py | daveshah1/hypergraph_part | 0 | 15843 | <reponame>daveshah1/hypergraph_part
#!/usr/bin/env python3
# Convert Yosys JSON to simple text hypergraph for performance testing
import sys, json
node_count = 0
edge2node = {}
netlist = None
with open(sys.argv[1]) as jf:
netlist = json.load(jf)
top_module = None
for name, module in sorted(netlist["modules"].ite... | 3.0625 | 3 |
tools/lstm_dql_6.py | alexis-jacq/signals | 1 | 15844 | from Tkinter import *
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import torch.autograd as autograd
from torch.autograd import Variable
master = Tk()
goal = 0
var_goal = StringVar()
GAMMA = 0.9
last_state = Variable(torch.Tensor([0,0,0,0,0,0])).u... | 2.859375 | 3 |
Engine/Shaders/compile_all_shader.py | ValtoGameEngines/Fish-Engine | 240 | 15845 | <reponame>ValtoGameEngines/Fish-Engine
import os
import sys
compiler = r'../Binary/RelWithDebInfo/ShaderCompiler'
#compiler = r'../Binary/Debug/ShaderCompiler'
shader_dirs = ['.', './Editor']
count = 0
for d in shader_dirs:
for fn in os.listdir(d):
print(fn)
ext = fn.split('.')[-1]
if ext in ['surf', 'shader'... | 2.296875 | 2 |
rbb_server/src/rbb_swagger_server/models/simulation_detailed.py | SK4P3/rbb_core | 55 | 15846 | <filename>rbb_server/src/rbb_swagger_server/models/simulation_detailed.py
# coding: utf-8
from __future__ import absolute_import
from datetime import date, datetime # noqa: F401
from typing import List, Dict # noqa: F401
from rbb_swagger_server.models.base_model_ import Model
from rbb_swagger_server.models.simulat... | 1.976563 | 2 |
src/pathlinker.py | melliott432/spras | 3 | 15847 | import docker
import os
import sys
import pandas as pd
import warnings
from src.PRM import PRM
from pathlib import Path
from src.util import prepare_path_docker
__all__ = ['PathLinker']
class PathLinker(PRM):
required_inputs = ['nodetypes', 'network']
@staticmethod
def generate_inputs(data, filename_map)... | 2.4375 | 2 |
stonesoup/hypothesiser/gaussianmixture.py | mgomesborges/Stone-Soup | 1 | 15848 | # -*- coding: utf-8 -*-
from .base import Hypothesiser
from ..base import Property
from ..types.multihypothesis import MultipleHypothesis
from ..types.prediction import (TaggedWeightedGaussianStatePrediction,
WeightedGaussianStatePrediction)
from ..types.state import TaggedWeightedGaussi... | 2.171875 | 2 |
apps/approval/api/serializers.py | emilps/onlineweb4 | 0 | 15849 | <reponame>emilps/onlineweb4
from django.core.exceptions import ValidationError as DjangoValidationError
from rest_framework import serializers
from apps.approval.models import CommitteeApplication, CommitteePriority
from apps.authentication.serializers import UserSerializer
class CommitteeSerializer(serializers.Mode... | 1.945313 | 2 |
visualization/histogram.py | SalikLP/classification-of-encrypted-traffic | 35 | 15850 | import pandas as pd
import numpy as np
from sklearn.preprocessing import LabelEncoder
from sklearn.preprocessing import StandardScaler
from sklearn.cross_validation import train_test_split
import utils
import glob, os
import pca.dataanalyzer as da, pca.pca as pca
from sklearn.metrics import accuracy_score
# visulaize ... | 2.75 | 3 |
examples/board_toolkit_simpletest.py | Neradoc/Adafruit_Board_Toolkit | 10 | 15851 | <reponame>Neradoc/Adafruit_Board_Toolkit
# SPDX-FileCopyrightText: Copyright (c) 2021 <NAME> for Adafruit Industries
#
# SPDX-License-Identifier: Unlicense
import adafruit_board_toolkit.circuitpython_serial
comports = adafruit_board_toolkit.circuitpython_serial.repl_comports()
if not comports:
raise Exception("No... | 2.171875 | 2 |
saq/utils.py | cofin/saq | 29 | 15852 | import time
import uuid
from random import random
def now():
return int(time.time() * 1000)
def uuid1():
return str(uuid.uuid1())
def millis(s):
return s * 1000
def seconds(ms):
return ms / 1000
def exponential_backoff(
attempts,
base_delay,
max_delay=None,
jitter=True,
):
... | 3.125 | 3 |
pipeline.py | sanidhya-singh/dagster-pipelines | 0 | 15853 | from dagster import job, op
@op
def get_name():
return "dagster"
@op
def hello(name: str):
print(f"Hello, {name}!")
@job(description="Hello world Dagster pipeline")
def hello_dagster():
hello(get_name()) | 2.46875 | 2 |
qulab/drivers/AFG3102.py | liuqichun3809/quantum-lab | 3 | 15854 | # -*- coding: utf-8 -*-
import time
import numpy as np
from qulab.device import BaseDriver, QInteger, QOption, QReal, QString, QVector
class Driver(BaseDriver):
error_command = '*ESR?'
support_models = ['AFG3102']
quants = [
QOption('Output',ch=1,
set_cmd='OUTP%(ch)d %(option)s', get_... | 2.015625 | 2 |
02-intermediate/lstm_network/main.py | kevin2018pg/pytorch-notes | 1 | 15855 | # -*- coding: utf-8 -*-
import torch
import torch.nn as nn
"""
输入3个句子,每个句子由5个单词构成,每个单词词向量10维
batch=3, seq_len=5, Embedding=10
"""
# 设置LSTM参数,词向量维数10,隐藏元维度20,2个LSTM隐藏层,双向LSTM
bilstm = nn.LSTM(input_size=10, hidden_size=20, num_layers=2, bidirectional=True)
# 如下表示输入句子
input = torch.randn(5, 3, 10)
# 初始化的隐藏元和记忆元,通常维度一样
... | 3.3125 | 3 |
meiduo_mall/apps/meiduo_admin/views/order.py | zzZaida/meiduo_backend | 0 | 15856 | from rest_framework.decorators import action
from rest_framework.response import Response
from rest_framework.viewsets import ModelViewSet
from apps.meiduo_admin.serializers.order import OrderInfoSerializer
from apps.meiduo_admin.utils import PageNum
from apps.orders.models import OrderInfo
class OrderModelViewSet(M... | 2.046875 | 2 |
QA/pycopia/remote/windows_server.py | kdart/pycopia3 | 3 | 15857 | <reponame>kdart/pycopia3
#!/usr/bin/python3.4
# vim:ts=4:sw=4:softtabstop=4:smarttab:expandtab
# 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
... | 1.890625 | 2 |
benchmark/info_locust.py | dmitryhd/avio | 2 | 15858 | from locust import HttpLocust, TaskSet
def login(l):
l.client.post("/login", {"username": "ellen_key", "password": "<PASSWORD>"})
def info(l):
l.client.get("/_info")
def profile(l):
l.client.get("/profile")
class UserBehavior(TaskSet):
tasks = {info: 1}
class WebsiteUser(HttpLocust):
task_... | 2.21875 | 2 |
userbot/plugins/funtxts.py | kumar451/CatUserbot | 0 | 15859 | import nekos
from ..utils import admin_cmd
@borg.on(admin_cmd(pattern = "tcat$"))
async def hmm(cat):
if cat.fwd_from:
return
reactcat = nekos.textcat()
await cat.edit(reactcat)
@borg.on(admin_cmd(pattern = "why$"))
async def hmm(cat):
if cat.fwd_from:
return
whycat = nekos... | 2.390625 | 2 |
tests/test_thread_python_exit.py | justengel/continuous_threading | 7 | 15860 | <filename>tests/test_thread_python_exit.py
import time
import continuous_threading
def test_thread():
class Thread(continuous_threading.Thread):
def _run(self, *args, **kwargs):
print('here')
th = Thread()
th.start()
time.sleep(0.1)
def test_continuous():
class CountingThrea... | 3 | 3 |
src/models/transformer_encoder.py | tsumita/implicit_emotion | 6 | 15861 | import copy
import torch.nn as nn
from .transformer import (Encoder,
EncoderLayer,
MultiHeadedAttention,
PositionwiseFeedforward,
PositionalEncoding)
class TransformerEncoder(nn.Module):
"""Transformer Encod... | 2.734375 | 3 |
bluebottle/members/migrations/0028_merge_20190215_1441.py | terrameijar/bluebottle | 10 | 15862 | <filename>bluebottle/members/migrations/0028_merge_20190215_1441.py
# -*- coding: utf-8 -*-
# Generated by Django 1.10.8 on 2019-02-15 13:41
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('members', '0026_auto_20180919_14... | 1.257813 | 1 |
src/globus_cli/login_manager/tokenstore.py | sirosen/temp-cli-test | 47 | 15863 | <reponame>sirosen/temp-cli-test
import os
import sys
import globus_sdk
from globus_sdk.tokenstorage import SQLiteAdapter
from ._old_config import invalidate_old_config
# internal constants
_CLIENT_DATA_CONFIG_KEY = "auth_client_data"
# env vars used throughout this module
GLOBUS_ENV = os.environ.get("GLOBUS_SDK_ENV... | 1.820313 | 2 |
launchMinecraft.py | Timurinyo/tchrHlprStudent | 0 | 15864 | <filename>launchMinecraft.py
#!/usr/bin/env python
#coding:utf-8
__author__ = 'CoderZh and Tymur'
import sys
from time import sleep
# Important for multithreading
sys.coinit_flags = 0 # pythoncom.COINIT_MULTITHREADED
import win32com
import win32com.client
import win32gui
import win32con
import pythonco... | 2.296875 | 2 |
trabajo/Plugins/test_plugin_MontoEscrito.py | f2scali/siendo | 0 | 15865 | <filename>trabajo/Plugins/test_plugin_MontoEscrito.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
__author__ = 'efrenfuentes'
import unittest
from plugin_MontoEscrito import numero_a_letras, numero_a_moneda
class TestNumeroLetras(unittest.TestCase):
def test_numero_demasiado_alto(self):
numero = 100000000... | 3.109375 | 3 |
setup.py | hivesolutions/pconvert | 4 | 15866 | <filename>setup.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import setuptools
setuptools.setup(
name = "pconvert-python",
version = "0.4.1",
author = "<NAME>.",
author_email = "<EMAIL>",
description = "PNG Convert",
license = "Apache License, Version 2.0",
keywords ... | 1.796875 | 2 |
tf2onnx/optimizer/optimizer_base.py | gcunhase/tensorflow-onnx | 1,473 | 15867 | <reponame>gcunhase/tensorflow-onnx
# SPDX-License-Identifier: Apache-2.0
"""Graph Optimizer Base"""
import copy
from .. import logging, utils
class GraphOptimizerBase(object):
"""optimizer graph to improve performance
"""
def __init__(self):
self._logger = logging.getLogger('.'.join(__name__.... | 2.1875 | 2 |
train.py | anishjain18/Trigger-Word-Detector | 15 | 15868 | <gh_stars>10-100
import numpy as np
from pydub import AudioSegment
import random
import sys
import io
import os
import glob
import IPython
from td_utils import *
from tensorflow.keras.callbacks import ModelCheckpoint
from tensorflow.keras.models import Model, load_model, Sequential
from tensorflow.keras.layers import ... | 2.34375 | 2 |
armchem/workspace.py | mmgalushka/armchem | 3 | 15869 | <reponame>mmgalushka/armchem
# =====================================================
# Copyright (c) 2017-present, AUROMIND Ltd.
# =====================================================
import os
from network import NeuralNetwork
from experiments import Experiment
from utils import save_object, load_object
# -------... | 2.21875 | 2 |
uge/objects/cluster_queue_v1_0.py | gridengine/config-api | 6 | 15870 | <reponame>gridengine/config-api<filename>uge/objects/cluster_queue_v1_0.py
#!/usr/bin/env python
#
# ___INFO__MARK_BEGIN__
#######################################################################################
# Copyright 2016-2021 Univa Corporation (acquired and owned by Altair Engineering Inc.)
# Licensed under the... | 1.773438 | 2 |
decomplz4l_prep/__init__.py | Tiempogithub/decomplz4l | 1 | 15871 | <gh_stars>1-10
#!/usr/bin/env python3
import os
import sys
import runpy
from intelhex import IntelHex
#import lz4.frame
import subprocess
import shutil
def get_section_from_elf(elf,section_name):
objdump = shutil.which('objdump')
cmd = [ objdump,elf,'-h','--section='+section_name]
out=""
res=subprocess... | 2.296875 | 2 |
application/views/service/service.py | celerysoft/scholar-tool-manager | 0 | 15872 | # -*- coding: utf-8 -*-
from flask import make_response, Blueprint
from app import derive_import_root, add_url_rules_for_blueprint
from application import exception
from application.model.service import Service
from application.model.service_template import ServiceTemplate
from application.util.database import session... | 2.09375 | 2 |
trello/searchs.py | fif911/trello3_little_bit_updated | 16 | 15873 | import json
import requests
class Searchs(object):
__module__ = 'trello'
def __init__(self, apikey, token=None):
self._apikey = apikey
self._token = token
def get(self, query, idOrganizations, idBoards=None, idCards=None, modelTypes=None, board_fields=None, boards_limit=None, ca... | 2.65625 | 3 |
architect/design/bounded_exogenous_parameters.py | MIT-REALM/architect | 2 | 15874 | <reponame>MIT-REALM/architect<gh_stars>1-10
"""Exogenous parameters are anything "uncontrollable" that affect the design; these are
what we consider robustness against and are typically drawn from some distribution
"""
from typing import Optional, Sequence, Tuple, Union
import jax
import jax.numpy as jnp
from jax._src... | 3 | 3 |
python/testData/quickdoc/AncestorClassDocstringForConstructor.py | jnthn/intellij-community | 2 | 15875 | <gh_stars>1-10
class Base:
"""Class docstring."""
class Sub(Base):
def __in<the_ref>it__(self):
pass
| 1.789063 | 2 |
courspider/department_calendar.py | Zylphrex/courspider | 0 | 15876 | <filename>courspider/department_calendar.py
import re
from courspider.faculty_calendar_resources.department import Department
from courspider.faculty_calendar_resources.url import URL
from courspider.course import Course
class DepartmentCalendar:
def __init__(self, session, url):
"""
Initialize a... | 3.234375 | 3 |
chrome/test/chromedriver/run_buildbot_steps.py | devasia1000/chromium | 2 | 15877 | <reponame>devasia1000/chromium
#!/usr/bin/env python
# Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Runs all the buildbot steps for ChromeDriver except for update/compile."""
import optparse
impor... | 2.09375 | 2 |
src/TheLanguage/Parser/Expressions/UnitTests/CastExpressionParserInfo_UnitTest.py | davidbrownell/DavidBrownell_TheLanguage | 0 | 15878 | # ----------------------------------------------------------------------
# |
# | CastExpressionParserInfo_UnitTest.py
# |
# | <NAME> <<EMAIL>>
# | 2021-10-04 09:14:16
# |
# ----------------------------------------------------------------------
# |
# | Copyright <NAME> 2021
# | Distributed under the B... | 2.21875 | 2 |
backend/api/models.py | pranav2812/9th-inter-iit-traffic-sign | 1 | 15879 | <filename>backend/api/models.py
from django.db import models
class File(models.Model):
id = models.AutoField(primary_key= True)
b64 = models.TextField(blank=False, null=False)
lastedit = models.DateTimeField(auto_now= True)
image_class = models.TextField(blank = True, default = "")
labels = models.TextField(blank... | 2.4375 | 2 |
release/Server/__init__.py | cdfmlr/readquickly_WeChatSmallApp | 2 | 15880 | '''
# ReadQuickly 后端
```
|-- Server
|-- __init__.py
|-- server.py (请求服务器)
|-- content.py (整合响应数据)
|-- spider (爬虫包)
|-- weather (天气包)
|-- notice (通知包)
```
''' | 1.125 | 1 |
JB/5.py | boostjanbjorge/adventofcode | 0 | 15881 | <filename>JB/5.py
import collections
import dataclasses
import itertools
@dataclasses.dataclass(frozen=True)
class Point:
x: int
y: int
@dataclasses.dataclass(frozen=True)
class Segment:
start: Point
stop: Point
@property
def slope(self):
dy = self.stop.y - self.start.y
dx =... | 3.25 | 3 |
readthedocs/search/parse_json.py | darrowco/readthedocs.org | 0 | 15882 | <filename>readthedocs/search/parse_json.py
"""Functions related to converting content into dict/JSON structures."""
import codecs
import json
import logging
from pyquery import PyQuery
log = logging.getLogger(__name__)
def generate_sections_from_pyquery(body):
"""Given a pyquery object, generate section dicts... | 3.25 | 3 |
pottermore/pottermore.py | Ricotjhe/kennnyshiwa-cogs | 0 | 15883 | <gh_stars>0
import contextlib
from redbot.core import commands, Config
from redbot.core.utils.menus import menu, DEFAULT_CONTROLS
import discord
import aiohttp
import random
slytherin = "https://cdn.shopify.com/s/files/1/1325/3287/products/HP8040B_930f8033-607f-41ee-a8e4-fa90871ce7a7.png?v=1546231154"
gryffindor = "... | 1.742188 | 2 |
contacts/views/contact_views.py | Onlynfk/Freshdesk-CRM-Platform | 0 | 15884 | from django.shortcuts import render
def contact(request):
return render(request, 'contacts/contact.html')
| 1.4375 | 1 |
algoritmos/PythonM2/desafio.py | MiguelTeixeiraUFPB/PythonM2 | 0 | 15885 | <gh_stars>0
idadevelho=0
s=0
f=0
for p in range(1,3):
print('---{}º pessoa---'.format(p))
nome=str(input('digite o {}º nome: '.format(p))).strip()
idade=int(input('digite a idade da {}º pessoa: '.format(p)))
peso=float(input('digite o peso da {}º pessoa: '.format(p)))
sexo=str(input('sexo[M/F]:... | 3.765625 | 4 |
createVideo.py | Thefalas/disksMD | 0 | 15886 | # -*- coding: utf-8 -*-
"""
Created on Thu May 3 18:33:28 2018
@author: malopez
"""
import pandas as pd
import matplotlib.pyplot as plt
import cv2
images_folder = "C:/Users/malopez/Desktop/disksMD/images"
data_folder = "C:/Users/malopez/Desktop/disksMD/data"
output_video = './video4.mp4'
particle_radius = 1.0
n_part... | 2.359375 | 2 |
utils/builder/register_builder/riscv/BootPriority.py | noahsherrill/force-riscv | 111 | 15887 | #
# Copyright (C) [2020] Futurewei Technologies, Inc.
#
# FORCE-RISCV is 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
#
# THIS SOFTWARE IS PR... | 1.734375 | 2 |
truffe2/generic/templatetags/generic_extras.py | JonathanCollaud/truffe2 | 9 | 15888 | <gh_stars>1-10
from django import template
from django.utils.safestring import mark_safe
import bleach
from bleach.sanitizer import BleachSanitizer
from bleach.encoding import force_unicode
from bootstrap3.renderers import FieldRenderer
from bootstrap3.text import text_value
import html5lib
import re
register = templ... | 2.03125 | 2 |
tests/conftest.py | inducer/courseflow | 284 | 15889 | <filename>tests/conftest.py<gh_stars>100-1000
import pytest
# from pytest_factoryboy import register
def pytest_addoption(parser):
parser.addoption(
"--slow", action="store_true", default=False, help="run slow tests",
)
parser.addoption(
"--all", action="store_true", default=False, help="r... | 2.109375 | 2 |
main.py | Kallu609/mp3-to-mp4-converter | 0 | 15890 | <filename>main.py<gh_stars>0
import subprocess
from mimetypes import MimeTypes
from os import devnull, getcwd, listdir, makedirs, walk
from os.path import basename, dirname, exists, isfile, join, splitext
from pprint import pprint
from urllib.request import pathname2url
ALLOWED_AUDIO_MIMETYPES = ['audio/mpeg']
ALLOWED... | 2.921875 | 3 |
lang/Python/terminal-control-cursor-positioning-1.py | ethansaxenian/RosettaDecode | 1 | 15891 | <filename>lang/Python/terminal-control-cursor-positioning-1.py
print("\033[6;3HHello")
| 1.835938 | 2 |
ambassador/tests/ambassador_test.py | tesserai/ambassador | 1 | 15892 | import sys
import difflib
import errno
import json
import logging
import functools
import os
import pytest
from shell import shell
from diag_paranoia import diag_paranoia, filtered_overview, sanitize_errors
VALIDATOR_IMAGE = "datawire/ambassador-envoy-alpine:v1.5.0-116-g7ccb25882"
DIR = os.path.dirname(__file__)
E... | 1.953125 | 2 |
geocode_missing.py | UoA-eResearch/billboards | 0 | 15893 | #!/usr/bin/env python3
import json
import googlemaps
import sys
import os
gmaps = googlemaps.Client(key=os.environ["GOOGLE_API_KEY"])
print(gmaps)
filename = sys.argv[1]
with open(filename) as f:
data = json.load(f)
for d in data:
if d.get("address") and not d.get("latitude"):
result = gmaps.geocode(... | 3.234375 | 3 |
tardis/plasma/properties/continuum_processes.py | AlexHls/tardis | 0 | 15894 | <gh_stars>0
import logging
import numpy as np
import pandas as pd
from numba import prange, njit
from tardis import constants as const
from tardis.plasma.exceptions import PlasmaException
from tardis.plasma.properties.base import (
ProcessingPlasmaProperty,
Input,
TransitionProbabilitiesProperty,
)
from ... | 1.726563 | 2 |
pull_related_videos.py | jgawrilo/youtube | 1 | 15895 | <reponame>jgawrilo/youtube<filename>pull_related_videos.py
#!/usr/bin/env python
from apiclient.discovery import build
from apiclient.errors import HttpError
from oauth2client.tools import argparser
import json
import os
import codecs
from bs4 import BeautifulSoup
import argparse
import requests
import sys
import goo... | 3.171875 | 3 |
day02/ex04/ai42/logging/log.py | d-r-e/Machine-Learning-Bootcamp | 0 | 15896 | <reponame>d-r-e/Machine-Learning-Bootcamp
# **************************************************************************** #
# #
# ::: :::::::: #
# logger.py ... | 2.796875 | 3 |
examples/avatar_example.py | ZSD-tim/dayu_widgets | 157 | 15897 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
###################################################################
# Author: <NAME>
# Date : 2019.2
# Email : <EMAIL>
###################################################################
from dayu_widgets.avatar import MAvatar
from dayu_widgets.divider import MDivider
fro... | 1.84375 | 2 |
ch9/note9.4.py | YChanHuang/Python-for-every-body-notes | 0 | 15898 | <reponame>YChanHuang/Python-for-every-body-notes
#Assignment 9.4
#print('Hello World')
fname = input('Enter name: ')
if len(fname) < 1 : fname = 'mbox-short.txt'
handle = open(fname)
di = {} #create an empty dictionary
for line in handle:
line = line.rstrip()
wds = line.split()
#the second for-loop to pri... | 3.734375 | 4 |
ava/common/check.py | indeedsecurity/ava-ce | 2 | 15899 | from bs4 import BeautifulSoup
from difflib import SequenceMatcher
class _Check:
"""
Parent check class. All other checks should be a subclass of this class.
"""
key = "check"
name = "Check"
description = "Parent check"
class _BlindCheck(_Check):
"""
These checks identify issues in in... | 3.03125 | 3 |