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 |
|---|---|---|---|---|---|---|
tests/test_models/test_ner_model.py | xyzhu8/mmocr | 0 | 24200 | <reponame>xyzhu8/mmocr
import copy
import os.path as osp
import tempfile
import pytest
import torch
from mmocr.models import build_detector
def _create_dummy_vocab_file(vocab_file):
with open(vocab_file, 'w') as fw:
for char in list(map(chr, range(ord('a'), ord('z') + 1))):
fw.write(char + '... | 2.25 | 2 |
Cita.py | Desquivel501/Backend_Proyecto2_IPC1 | 0 | 24201 | <reponame>Desquivel501/Backend_Proyecto2_IPC1
class Cita:
def __init__(self,id,solicitante,fecha,hora,motivo,estado,doctor):
self.id = id
self.solicitante = solicitante
self.fecha = fecha
self.hora = hora
self.motivo = motivo
self.estado = estado
self.doc... | 2.921875 | 3 |
recohut/models/layers/graph.py | sparsh-ai/recohut | 0 | 24202 | <gh_stars>0
# AUTOGENERATED! DO NOT EDIT! File to edit: nbs/models/layers/models.layers.graph.ipynb (unless otherwise specified).
__all__ = ['FiGNN_Layer', 'GraphLayer']
# Cell
import torch
import torch.nn as nn
import torch.nn.functional as F
from itertools import product
# Cell
class FiGNN_Layer(nn.Module):
de... | 1.984375 | 2 |
euchre.py | duck57/euchre.py | 1 | 24203 | #!venv/bin/python
# coding=UTF-8
# -*- coding: UTF-8 -*-
# vim: set fileencoding=UTF-8 :
"""
Double-deck bid euchre
Implementation is similar to the rules given by <NAME>
https://www.pagat.com/euchre/bideuch.html
Notable differences (to match how I learned in high school calculus) include:
* Minimum bid of 6 (w... | 3.40625 | 3 |
src/consumer/catalog-search/swagger_server/models/error_response.py | CADDE-sip/connector | 1 | 24204 | <gh_stars>1-10
# coding: utf-8
from __future__ import absolute_import
from datetime import date, datetime # noqa: F401
from typing import List, Dict # noqa: F401
from swagger_server.models.base_model_ import Model
from swagger_server import util
class ErrorResponse(Model):
"""NOTE: This class is auto generat... | 2.265625 | 2 |
dh_example.py | afakharany93/DH_Matrix_Python | 0 | 24205 | <reponame>afakharany93/DH_Matrix_Python
#!/usr/bin/env python
# coding: utf-8
from dh import dh_solver
#from IPython.display import Latex
import sympy
from sympy import Symbol
import numpy as np
#create an object
mtb = dh_solver()
# ## adding the dh paramters
# just use obj.add() method to add a set of dh param... | 3.375 | 3 |
src/python/pants/help/list_goals_integration_test.py | thamenato/pants | 0 | 24206 | <reponame>thamenato/pants
# Copyright 2019 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from pants.testutil.pants_integration_test import run_pants
def test_goals() -> None:
pants_run = run_pants(["goals"])
pants_run.assert_success()
as... | 2.34375 | 2 |
tests/data/custom_loader2.py | cambiegroup/aizynthfinder | 219 | 24207 | <gh_stars>100-1000
def extract_smiles():
return ["c1ccccc1", "Cc1ccccc1", "c1ccccc1", "CCO"]
| 1.515625 | 2 |
proa.py | andrehigher/ProA | 0 | 24208 | <gh_stars>0
""" A Python Class
A simple Python graph class to do essential operations into graph.
"""
import operator
import math
from random import choice
from collections import defaultdict
import networkx as nx
class ProA():
def __init__(self, graph):
""" Initializes util object.
"""
se... | 3.265625 | 3 |
fix-sfz.py | SpotlightKid/sfzparser | 5 | 24209 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import shutil
from os.path import basename, exists, isdir, splitext
from sfzparser import SFZParser
def main(args=None):
fn = args[0]
bn = splitext(basename(fn))[0]
parser = SFZParser(fn)
fixed = False
for name, sect in parser.sections:
# fi... | 2.6875 | 3 |
pytoolkit/applications/__init__.py | ak110/pytoolk | 26 | 24210 | """Kerasの各種モデル。"""
# pylint: skip-file
# flake8: noqa
from . import darknet53, efficientnet, xception
| 1.34375 | 1 |
tests/rest/integration/test_common_endpoints.py | Palem1988/huobi | 19 | 24211 | import unittest
from huobi.rest.client import HuobiRestClient
from huobi.rest.error import (
HuobiRestiApiError
)
import os
from os.path import join, dirname
from dotenv import load_dotenv
dotenv_path = join(dirname(dirname(dirname(dirname(__file__)))), '.env')
load_dotenv(dotenv_path)
class TestCommonEndpoint(... | 2.390625 | 2 |
gerritviewer/views/accounts.py | tivaliy/gerrit-quick-viewer | 0 | 24212 | #
# Copyright 2017 <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... | 1.984375 | 2 |
infra/tools/git-push-speed.py | mithro/chromium-infra | 0 | 24213 | # Copyright 2014 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.
"""Measures the average time used by git-push command in CQ based on data from
chromium-cq-status.appspot.com."""
import argparse
import json
import logging... | 2.515625 | 3 |
backoffice/transactions/utils.py | AlejandroUPC/pythonmicroservices | 0 | 24214 | <gh_stars>0
import random
def create_random_id():
return str(random.randint(100000,999999999999999)) | 1.890625 | 2 |
bitmovin_api_sdk/encoding/infrastructure/kubernetes/configuration/__init__.py | hofmannben/bitmovin-api-sdk-python | 0 | 24215 | from bitmovin_api_sdk.encoding.infrastructure.kubernetes.configuration.configuration_api import ConfigurationApi
| 1.023438 | 1 |
python/cudf/cudf/core/column/methods.py | shridharathi/cudf | 0 | 24216 | # Copyright (c) 2020, NVIDIA CORPORATION.
from __future__ import annotations
from typing import TYPE_CHECKING, Optional, Union, overload
from typing_extensions import Literal
import cudf
if TYPE_CHECKING:
from cudf.core.column import ColumnBase
class ColumnMethodsMixin:
_column: ColumnBase
_parent: O... | 2.265625 | 2 |
spa/tests/dom_helper.py | fergalmoran/dss.api | 0 | 24217 | from selenium.common.exceptions import NoSuchElementException, TimeoutException
class DomHelper(object):
driver = None
waiter = None
def open_page(self, url):
self.driver.get(url)
def reload_page(self):
self.driver.refresh()
def print_el(self, element):
print('tag: ' + e... | 2.765625 | 3 |
gravityspytools/search/models.py | Gravity-Spy/gravityspytools | 4 | 24218 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
from django.contrib.auth.models import User
from django.contrib.postgres.fields import ArrayField
# Create your models here.
"""
class NewSearch(models.Model):
SINGLEVIEW = 'similarityindex'
MULTIVIEW = 'updated_simi... | 2.390625 | 2 |
simple_menu/simple_encoder.py | mexclub/simple_menu | 0 | 24219 | from machine import Pin
class simple_encoder():
def __init__(self, ra, rb, pin_irq):
self.ra = ra
self.rb = rb
self.counter = 0
self.ra.irq(trigger=pin_irq, handler=self.turn)
self.rb.irq(trigger=pin_irq, handler=self.turn)
def turn(self, pin):
change... | 3.171875 | 3 |
Final/prediction/nb1.py | NaguGowda/machin-learning- | 0 | 24220 | # Example of Naive Bayes implemented from Scratch in Python
import csv
import random
import math
import xgboost as xgb
import matplotlib.pyplot as plt
import numpy as np
def loadCsv(filename):
lines = csv.reader(open(filename, "r"))
dataset = list(lines)
for i in range(len(dataset)):
dataset[i] = [flo... | 3.15625 | 3 |
wingstructure/data/wing.py | helo9/wingstructure | 7 | 24221 | <gh_stars>1-10
from collections import namedtuple
from copy import deepcopy
import numpy as np
# data type for 3D-Coordinates
Point = namedtuple('Point', 'x y z')
# monkey patch function
def serializesection(self):
data = dict(self._asdict())
data['pos'] = dict(self.pos._asdict())
return data
class _... | 2.703125 | 3 |
crossdock/problems/experiment/crossdock_15_25_15_5_5.py | krerkkiat/icpr-2019-public | 0 | 24222 | <gh_stars>0
# -*- coding: utf-8 -*-
"""
Cross-docking truck data.
This data is generated by a generate_dataset.py script.
Created: Feb 18, 2019 at 07:30:02 PM
Copyright (c) 2022, <NAME>
This souce code is licensed under BSD 3-Clause "New" or "Revised" License (see LICENSE for details).
"""
from pathlib import Path
... | 1.664063 | 2 |
CIFAR10/train.py | aidezone/pytorch-learning | 0 | 24223 | <gh_stars>0
import base
# 开始真正的模型训练
import torch
import torch.nn as nn
# 实例化网络
net = base.MyCustomNet()
# 定义数据集的训练迭代轮次
max_epoch = 5
# 定义学习率
learning_rate = 0.001
# 定义loss函数、定义优化器
import torch.optim as optim
criterion = nn.CrossEntropyLoss()
optimizer = optim.SGD(net.parameters(), lr=learning_rate, momentum=0.9)
... | 3.0625 | 3 |
coord2vec/models/baselines/coord2vec_model.py | jonzarecki/coord2vec | 0 | 24224 | <reponame>jonzarecki/coord2vec<gh_stars>0
import os
import random
from typing import List, Tuple, Callable
import torch
from ignite.contrib.handlers import ProgressBar, LRScheduler
from ignite.handlers import ModelCheckpoint
from sklearn.base import BaseEstimator, TransformerMixin
from torch import nn
from torch import... | 1.703125 | 2 |
PythonExercicios/ex045.py | Caio-Moretti/115.Exercicios-Python | 0 | 24225 | from random import choice
from time import sleep
jokenpo = ['Pedra', 'Papel', 'Tesoura']
jokenposter_stainger = choice(jokenpo)
jogador = int(input('Qual a sua jogada?'
'\n1. Pedra'
'\n2. Papel'
'\n3. Tesoura'
'\nEscolha: '))
print('\nJO.... | 3.59375 | 4 |
demo_backend/text_generator/apps.py | WallaceLiu/Web-Full-Stack-Practice | 33 | 24226 | from django.apps import AppConfig
class TextGeneratorConfig(AppConfig):
name = 'text_generator'
| 1.226563 | 1 |
tools/find_protoc.py | Kill-Console/xresloader | 219 | 24227 | #!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import os
import stat
protoc_exec = None
def find_protoc():
global protoc_exec
if protoc_exec is not None:
return protoc_exec
script_dir = os.path.dirname(os.path.realpath(__file__))
if sys.platform[0:5].lower() == "linux":
protoc_ex... | 2.515625 | 3 |
inventory/views.py | yellowjaguar5/lnldb | 5 | 24228 | <filename>inventory/views.py
from io import BytesIO
import json
import re
import requests
from django.conf import settings
from django.contrib import messages
from django.contrib.auth.decorators import login_required, permission_required
from django.core.exceptions import PermissionDenied
from django.core.paginator im... | 2.21875 | 2 |
tests/unit_tests/db_engine_specs/test_athena.py | awchisholm/superset | 2 | 24229 | <reponame>awchisholm/superset
# 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 (t... | 1.726563 | 2 |
apps/accounts/tests/functional/transactions/test_confirm_email.py | victoraguilarc/xib.li | 1 | 24230 | # -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
import pytest
from django.test import RequestFactory
from django.urls import reverse
from doubles import allow, expect
from rest_framework import status
from apps.accounts.models.choices import ActionCategory
from apps.accounts.services.auth import AuthService
from apps... | 2.0625 | 2 |
data/test/test_queue.py | giuseppe/quay | 2,027 | 24231 | <filename>data/test/test_queue.py
import json
import time
import pytest
from contextlib import contextmanager
from datetime import datetime, timedelta
from functools import wraps
from data.database import QueueItem
from data.queue import (
WorkQueue,
MINIMUM_EXTENSION,
queue_items_locked,
queue_items... | 2.3125 | 2 |
fortifyapi/__init__.py | brownsec/fortifyapi | 0 | 24232 | <gh_stars>0
__version__ = '1.0.19'
| 1.09375 | 1 |
18Host/TDT4110/PythonWorkspace/Oving5/Blackjack.py | MarcusTL12/School | 0 | 24233 | import random
def shuffle(cards):
for i in range(len(cards)):
randindex = random.randrange(0, len(cards))
cards[randindex], cards[i] = cards[i], cards[randindex]
def run():
stack = [2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10, 'A'] * 4
shuffle(stack)
stack_top = 51
dealer_cards = []
your_cards = []
deale... | 3.640625 | 4 |
tools/external_converter_v2/parser/operations/op_io.py | pangge/Anakin | 533 | 24234 | #! /usr/bin/env python
# Copyright (c) 2017, Cuichaowen. All rights reserved.
# -*- coding: utf-8 -*-
# ops helper dictionary
class Dictionary(object):
"""
Dictionary for op param which needs to be combined
"""
def __init__(self):
self.__dict__ = {}
def set_attr(self, **kwargs):
... | 2.09375 | 2 |
calibration/capture.py | dangthanhan507/odcl | 0 | 24235 | <reponame>dangthanhan507/odcl
import cv2
import os
import argparse
if __name__ == '__main__':
arg = argparse.ArgumentParser()
arg.add_argument('--o', required=True, help='output_folder')
opt = arg.parse_args()
cap = cv2.VideoCapture(0)
ret, img = cap.read()
print('Writing to chessboard file')
files = os.listdir... | 2.921875 | 3 |
commands/FBTextInputCommands.py | zddd/chisel | 1 | 24236 | <filename>commands/FBTextInputCommands.py<gh_stars>1-10
#!/usr/bin/python
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import os
import lldb
import fblldbbase as fb
... | 2.28125 | 2 |
tests/test_operator_web_site.py | luigi-riefolo/network_crawler | 0 | 24237 | """OperatorWebSite class unit test."""
from __init__ import json, os, time, unittest, \
webdriver, WebDriverException, OperatorWebSite
class TestOperatorWebSite(unittest.TestCase):
"""Unit test class for OperatorWebSite."""
def load_data(self):
""" Load the data file. """
self.data = N... | 3.171875 | 3 |
totality/test_main.py | str8d8a/totality-python | 0 | 24238 | from totality import Totality, Node, NodeId
def test_basic():
t = Totality()
coll = t.create_collection(username="system")
node_id = NodeId(node_type="facility")
node = Node(node_id, 34, -120, collection=coll)
print(node.to_doc())
assert t is not None | 2.5625 | 3 |
projects/DensePose/densepose/modeling/test_time_augmentation.py | bruce1408/detectron2_modify | 5 | 24239 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import torch
from fvcore.transforms import HFlipTransform
from detectron2.modeling.postprocessing import detector_postprocess
from detectron2.modeling.test_time_augmentation import GeneralizedRCNNWithTTA
class DensePoseGeneralizedRCNNWithTTA(Gene... | 1.851563 | 2 |
src/compath_resources/summarize.py | ComPath/resources | 3 | 24240 | # -*- coding: utf-8 -*-
"""Generate charts for the ComPath GitHub Pages site."""
import click
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
from more_click import verbose_option
from compath_resources import get_df
from compath_resources.constants import DATA_DIRECTORY, IMG_DIRECTORY
__a... | 2.46875 | 2 |
src/database/insert_data.py | johnnychiuchiu/Music-Recommender | 0 | 24241 | <filename>src/database/insert_data.py<gh_stars>0
import pandas as pd
import os
from schema import db
import random
class ReadData():
"""
Acquire song data from the url provided by Turi and save it into local database.
"""
def __init__(self):
self.SEED = 12345
def readSongData(self):
... | 3.65625 | 4 |
Codes/Prediction/RF_Prediction.py | sepehrgdr/Mode_Imputation | 0 | 24242 | # -*- coding: utf-8 -*-
"""
Created on Thu Feb 28 14:24:27 2019
@author: adarzi
"""
#Loading the libraries
import pandas as pd
import os
from os import sys
import pickle
#setting the directory
os.chdir(sys.path[0])
#loading the data:
data = pd.read_csv('../../Inputs/Trip_Data/AirSage_Data/trips_lon... | 2.484375 | 2 |
abc153_e.py | tkt989/atcoder | 0 | 24243 | import math
H, N = [int(n) for n in input().split()]
A = []
B = []
for _ in range(N):
a, b = [int(n) for n in input().split()]
A.append(a)
B.append(b)
p = []
for i in range(N):
p.append(A[i] / B[i])
for pp in p:
pass
# print(pp)
maisu = []
for i in range(N):
maisu.append(math.ceil(H / A[i]))
for m ... | 3.21875 | 3 |
util.py | ChannyHong/ISREncoder | 6 | 24244 | # Copyright 2020 Superb AI, Inc.
#
# 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 writi... | 2.21875 | 2 |
shortening_calculations.py | joferkington/oost_paper_code | 20 | 24245 | from uncertainties import ufloat
from utilities import min_value, max_value
def main():
print 'Plate motion rate parallel to section'
print plate_motion()
print 'Shortening (including ductile) from bed-length'
print bed_length_shortening()
print 'Estimated total shortening accomodated by OOSTS'
... | 3.0625 | 3 |
untested/people_multi/config.py | vishalbelsare/neworder | 17 | 24246 |
""" config.py
Microsimulation config for mulit-LAD MPI simulation
"""
import numpy as np
import glob
import neworder
# define some global variables describing where the starting population and the parameters of the dynamics come from
initial_populations = glob.glob("examples/people_multi/data/ssm_*_MSOA11_ppp_2011.cs... | 2.859375 | 3 |
openarticlegauge/view/issue.py | CottageLabs/OpenArticleGauge | 1 | 24247 | # present and accept dispute processing
from flask import Blueprint, request, make_response, render_template, flash, redirect
from openarticlegauge.core import app
import openarticlegauge.util as util
import openarticlegauge.models as models
blueprint = Blueprint('issue', __name__)
@blueprint.route("/", methods=['... | 2.34375 | 2 |
tutorials/auction/smartpy/smartpy_generated/nft_wallet/Dutch_pure.py | tqtezos/ticket-tutorials | 7 | 24248 | <gh_stars>1-10
import smartpy as sp
AUCTION_PARAMS_TYPE = sp.TRecord(opening_price = sp.TNat,
reserve_price = sp.TNat,
start_time = sp.TTimestamp,
round_time = sp.TInt,
ticket = sp.TTicket(sp.TNat))
METADATA_TYPE = sp.TMap(sp.TString, sp.TBytes)
TOKEN_METADATA_TYPE = sp.TBigMap(sp.TNa... | 1.984375 | 2 |
src/input_data_generation/Data_Generation.py | jwkim98/SocioCraft | 0 | 24249 | <filename>src/input_data_generation/Data_Generation.py
# 일반적으로 Data Generation file은 Group 별로 data를 생성 가능
# Group의 개념을 만들지 않으려면 모든 Group의 조건을 같이 하면 단 한개의 Group만 생성된 효과를 가져올 수 있음
import csv
import numpy as np
looptime=3 #Group 개수
number=[100,100,100] #각 Group당 사람수
number2=[100,100,100] #각 G... | 3.25 | 3 |
inaworld/tokens.py | epfahl/inaworld | 0 | 24250 | """Tokenize a document.
*** NLTK tokenization and this module have been deprecated in favor of a
sklearn-based solution. However, NLTK may offer more options for tokenization,
stemming, etc., this module is retained for future reference.
"""
import re
import nltk
import toolz as tz
re_not_alpha = re.compile('[^a-zA... | 3.734375 | 4 |
tests/server_state_item_test.py | whitphx/streamlit-server-state | 20 | 24251 | from unittest.mock import ANY, Mock, patch
import pytest
from streamlit_server_state.server_state_item import ServerStateItem
@pytest.fixture
def patch_is_rerunnable():
with patch(
"streamlit_server_state.server_state_item.is_rerunnable"
) as mock_is_rerunnable:
mock_is_rerunnable.return_val... | 2.5 | 2 |
sympycore/heads/arithmetic.py | radovankavicky/pymaclab | 96 | 24252 |
#obsolete, each head should be defined in a separate file
__all__ = ['FLOORDIV', 'MOD']
from .base import NaryHead
class ModHead(NaryHead):
"""
ModHead represents module n-ary operation,
data is a n-tuple of expression operands.
"""
op_mth = '__mod__'
op_rmth = '__rmod__'
op_symbol = '... | 3.015625 | 3 |
boxuegu/apps/courses/views.py | libin-c/bxg | 1 | 24253 | from django.views import View
class CourseListView(View):
pass | 0.890625 | 1 |
classification/admin/__init__.py | SACGF/variantgrid | 5 | 24254 | from classification.admin.classification_admin import *
from classification.admin.clinvar_export_admin import *
from classification.admin.condition_text_admin import *
| 1.132813 | 1 |
scripts/patch-uld-elf.py | cutty/uld-fdpic | 8 | 24255 | #!/usr/bin/env python
# Copyright (c) 2016, 2017 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify,... | 1.617188 | 2 |
glycowork/tests/test_hierarchyfilter.py | Old-Shatterhand/glycowork | 22 | 24256 | <filename>glycowork/tests/test_hierarchyfilter.py
import glycowork
from glycowork.glycan_data.loader import df_species
from glycowork.ml.train_test_split import *
train_x, val_x, train_y, val_y, id_val, class_list, class_converter = hierarchy_filter(df_species,
... | 2.578125 | 3 |
scripts/greaseweazle/tools/seek.py | pkorpine/Greaseweazle | 0 | 24257 | <gh_stars>0
# greaseweazle/tools/seek.py
#
# Greaseweazle control script: Seek to specified cylinder.
#
# Written & released by <NAME> <<EMAIL>>
#
# This is free and unencumbered software released into the public domain.
# See the file COPYING for more details, or visit <http://unlicense.org>.
description = "Seek to t... | 2.828125 | 3 |
find_duplicate_7kyu/find_the_duplicate.py | philipwerner/code-katas | 0 | 24258 | <reponame>philipwerner/code-katas
"""Kata: Find the Duplicated Number in a Consecutive Unsorted List - Finds and returns
the duplicated number from the list
#1 Best Practices Solution by SquishyStrawberry
def find_dup(arr):
return (i for i in arr if arr.count(i) > 1).next()
"""
def find_dup(arr):
"""This wi... | 3.96875 | 4 |
text_generator.py | agvergara/RNN_Text_Generator | 0 | 24259 | <reponame>agvergara/RNN_Text_Generator<gh_stars>0
#coding:cp1252
"""
@author: <NAME>
Generates text using word embeddings (still in process of study how word embeddings works)
"""
import sys
import text_utils
from rnn_class import TextGeneratorModel
MIN_WORD_FREQ = 10
SEED = "Nenita hello"
SEQUENCE_LEN ... | 3.09375 | 3 |
PivotExamples.py | KSim818/sandpit | 0 | 24260 | <filename>PivotExamples.py
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 18 16:14:01 2019
@author: KatieSi
"""
# https://jakevdp.github.io/PythonDataScienceHandbook/03.09-pivot-tables.html
import numpy as np
import pandas as pd
import seaborn as sns
titanic = sns.load_dataset('titanic')
titanic.head()
titanic.group... | 3.328125 | 3 |
pydex/utils/trellis_plotter.py | megansimwei/pydex | 0 | 24261 | <reponame>megansimwei/pydex
from matplotlib import pyplot as plt
import numpy as np
class TrellisPlotter:
def __init__(self):
self.cmap = None
self.colorbar_label_rotation = None
self.colobar_tick_fontsize = None
self.grouped_fun = None
self.fun = None
self.data = N... | 2.6875 | 3 |
ros_mqtt_bridge/ros_to_mqtt.py | CPFL/ros_mqtt_bridge | 5 | 24262 | <reponame>CPFL/ros_mqtt_bridge
#!/usr/bin/env python
# coding: utf-8
import yaml
import json
import rospy
import paho.mqtt.client as mqtt
from ros_mqtt_bridge.args_setters import ArgsSetters
class ROSToMQTT(ArgsSetters):
def __init__(self, from_topic, to_topic, message_type):
super(ROSToMQTT, self).__... | 2.390625 | 2 |
mmderain/models/backbones/rlnet.py | biubiubiiu/derain-toolbox | 4 | 24263 | from functools import partial
from typing import List, Optional, Sequence, Tuple
import torch
import torch.nn.functional as F
from torch import nn
from mmderain.models.common import sizeof
from mmderain.models.registry import BACKBONES
from mmderain.models.layers import SELayer_Modified
class ResidualBlock(nn.Modul... | 2.125 | 2 |
practice/calculator.py | kristenpicard/python-practice | 0 | 24264 | class Calculator:
def add(self,a,b):
return a+b
def subtract(self,a,b):
return a-b
def multiply(self,a,b):
return a*b
def divide(self,a,b):
return a/b
| 2.984375 | 3 |
10/lottery.py | sukio-1024/codeitPy | 0 | 24265 | <reponame>sukio-1024/codeitPy<gh_stars>0
from random import randint
# 무작위로 정렬된 1 - 45 사이의 숫자 여섯개 뽑기
def generate_numbers():
# 코드를 입력하세요
numbers = []
while (len(numbers) < 6):
number = randint(1, 45)
if number not in numbers:
numbers.append(number)
numbers.sort()
return ... | 3.421875 | 3 |
pyreach/tools/reach.py | google-research/pyreach | 13 | 24266 | <filename>pyreach/tools/reach.py
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 2.203125 | 2 |
issue_order/migrations/0005_auto_20170211_0033.py | jiejiang/courier | 0 | 24267 | # -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2017-02-11 00:33
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('issue_order', '0004_auto_20170210_2358'),
]
operations = [
migrations.Alter... | 1.59375 | 2 |
backend-project/small_eod/letters/migrations/0011_auto_20200618_1921.py | WlodzimierzKorza/small_eod | 64 | 24268 | <filename>backend-project/small_eod/letters/migrations/0011_auto_20200618_1921.py
# Generated by Django 3.0.7 on 2020-06-18 19:21
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('letters', '0010_remove_letter_address'),
... | 1.601563 | 2 |
classes/dns.py | double-beep/SmokeDetector | 464 | 24269 | import dns
import dns.resolver
import dns.rdatatype
def dns_resolve(domain: str) -> list:
addrs = []
resolver = dns.resolver.Resolver(configure=False)
# Default to Google DNS
resolver.nameservers = ['8.8.8.8', '8.8.4.4']
try:
for answer in resolver.resolve(domain, 'A').response.answer:
... | 2.96875 | 3 |
messaging/kombu_brighter/kombu_messaging.py | iancooper/RpcIsEvil | 0 | 24270 | """"
File : kombu_messaging.py
Author : ian
Created : 09-28-2016
Last Modified By : ian
Last Modified On : 09-28-2016
***********************************************************************
The MIT License (MIT)
Copyright © 2016 <NAME> <<EMAIL>>
Permission is hereby granted, free of charge, t... | 1.59375 | 2 |
evaluation/lcnn/postprocess.py | mlpc-ucsd/LETR | 90 | 24271 | import numpy as np
def pline(x1, y1, x2, y2, x, y):
px = x2 - x1
py = y2 - y1
dd = px * px + py * py
u = ((x - x1) * px + (y - y1) * py) / max(1e-9, float(dd))
dx = x1 + u * px - x
dy = y1 + u * py - y
return dx * dx + dy * dy
def psegment(x1, y1, x2, y2, x, y):
px = x2 - x1
py =... | 2.609375 | 3 |
core-python/Core_Python/com/LambdaWithFilterMapReduce.py | theumang100/tutorials-1 | 9 | 24272 | <filename>core-python/Core_Python/com/LambdaWithFilterMapReduce.py<gh_stars>1-10
from functools import reduce
from math import fsum
n = int(input("How many number you want to enter for even and odd numbers ? : "))
lst = []
for i in range(n):
j = int(input("Enter any positive number : "))
lst.append(j)
evens =... | 3.671875 | 4 |
prov_interop/tests/test_comparator.py | softwaresaved/provtoolsuite-interop-test-harness | 0 | 24273 | <reponame>softwaresaved/provtoolsuite-interop-test-harness
"""Unit tests for :mod:`prov_interop.comparator`.
"""
# Copyright (c) 2015 University of Southampton
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the "Software"), to de... | 1.882813 | 2 |
tests/auctionbets/test_hello_world.py | sam-bailey/auctionbets | 0 | 24274 | print("Test hello world")
| 1.28125 | 1 |
monai/_extensions/loader.py | tatuanb/monai_V1 | 2,971 | 24275 | # Copyright 2020 - 2021 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 law or agreed to in wri... | 1.734375 | 2 |
resources/__init__.py | tiralinka/amazon_fires | 1 | 24276 | <gh_stars>1-10
"""
This package contains modules built specifically for the project in question.
Below are decribed the modules and packages used in the notebooks of this project.
Modules
-----------
polynomials:
| This module groups functions and classes for generating polynomials
| whether fitting data or dire... | 1.4375 | 1 |
src/squad/common.py | nptdat/qanet | 12 | 24277 | import os
from typing import List, Optional
import pickle
import numpy as np
from utilities import augment_long_text, tokenize, tokenize_long_text, to_chars, align
from config import Config as cf
PAD = 0 # TODO: choose appropriate index for these special chars
UNK = 1
DEFAULT = {'PAD': PAD, 'UNK': UNK}
DEFAULT_C = {''... | 3.25 | 3 |
test/test_mean_functions.py | cics-nd/gptorch | 28 | 24278 | <gh_stars>10-100
# File: test_mean_functions.py
# File Created: Saturday, 13th July 2019 3:51:40 pm
# Author: <NAME> (<EMAIL>)
import pytest
import torch
from gptorch import mean_functions
class TestConstant(object):
def test_init(self):
dy = 2
mean_functions.Constant(dy)
mean_functions.... | 2.390625 | 2 |
elasticine/adapter.py | Drizzt1991/plasticine | 0 | 24279 | # -*- coding: utf-8 -*-
from elasticsearch import Elasticsearch
class ElasticAdapter(object):
""" Abstraction in case we will need to add another or change elastic
driver.
"""
def __init__(self, hosts, **es_params):
self.es = Elasticsearch(hosts, **es_params)
| 2.1875 | 2 |
cosmos/admin/createproject.py | kuasha/peregrine | 1 | 24280 | <reponame>kuasha/peregrine<filename>cosmos/admin/createproject.py
"""
Copyright (C) 2014 <NAME>
Website: http://cosmosframework.com
Author: <NAME>
License :: OSI Approved :: MIT License
"""
import os
import subprocess
from cosmos.admin.samples import barebonedef, simpledef, angulardef, angularbasicdef, adminpanel... | 2.203125 | 2 |
tests/commands/mc-1.14/test_loot.py | Le0Developer/mcast | 2 | 24281 |
from mcfunction.versions.mc_1_14.loot import loot, ParsedLootCommand
from mcfunction.nodes import EntityNode, PositionNode
def test_loot_spawn():
parsed = loot.parse('loot spawn 0 0 0 kill @e')
parsed: ParsedLootCommand
assert parsed.target_type.value == 'spawn'
assert isinstance(parsed.target, Posi... | 2.3125 | 2 |
torch_glow/tests/nodes/quantized_batchnorm3d_relu_test.py | andrewmillspaugh/glow | 1 | 24282 | <filename>torch_glow/tests/nodes/quantized_batchnorm3d_relu_test.py<gh_stars>1-10
from __future__ import absolute_import, division, print_function, unicode_literals
import unittest
import torch
import torch.nn as nn
from tests.utils import jitVsGlow
from torch.quantization import (
DeQuantStub,
QConfig,
Q... | 2.34375 | 2 |
tests/ext/test_paginator.py | Descent098/hyde | 804 | 24283 | <filename>tests/ext/test_paginator.py
# -*- coding: utf-8 -*-
"""
Use nose
`$ pip install nose`
`$ nosetests`
"""
from textwrap import dedent
from hyde.generator import Generator
from hyde.site import Site
from fswrap import File
TEST_SITE = File(__file__).parent.parent.child_folder('_test')
class TestPaginator(ob... | 2.5625 | 3 |
config.py | JackToaster/Reassuring-Parable-Generator | 47 | 24284 | import configparser as parser
import random
class config:
# load the configuration file
def __init__(self, config_filename):
self.load_config(config_filename)
def load_config(self, config_filename):
# create a config parser
config = parser.ConfigParser()
config.optionxform ... | 3.40625 | 3 |
doc/source/EXAMPLES/mu_allsky_reproj.py | kapteyn-astro/kapteyn | 3 | 24285 | import numpy
from kapteyn import maputils
from matplotlib.pyplot import show, figure
import csv # Read some poitions from file in Comma Separated Values format
# Some initializations
blankcol = "#334455" # Represent undefined values by this color
epsilon = 0.0000000001
figsize = (9,7) ... | 2.625 | 3 |
libs/Signals.py | lionheart/TimeTracker-Linux | 12 | 24286 | import sys
import gtk
from datetime import datetime
import gobject
from threading import Thread
class uiSignalHelpers(object):
def __init__(self, *args, **kwargs):
super(uiSignalHelpers, self).__init__(*args, **kwargs)
#print 'signal helpers __init__'
def callback(self, *args, **kwargs):
... | 2.296875 | 2 |
tests/app/main/views/test_feedback.py | alphagov-mirror/notifications-admin | 0 | 24287 | <reponame>alphagov-mirror/notifications-admin
from functools import partial
from unittest.mock import ANY, PropertyMock
import pytest
from bs4 import BeautifulSoup, element
from flask import url_for
from freezegun import freeze_time
from app.main.views.feedback import in_business_hours
from app.models.feedback import... | 2.046875 | 2 |
models/model.py | lyjeff/dogs-vs-cats | 0 | 24288 | import sys
import torch.nn as nn
from torchsummary import summary
from torchvision.models import vgg19, resnet50, densenet161, googlenet, inception_v3
from .MyCNN import MyCNN
def VGG19(all=False):
model = vgg19(pretrained=True)
# 把參數凍結
if all is False:
for param in model.parameters():
... | 2.5 | 2 |
adventofcode/2020/25/crack_key/__init__.py | bneradt/toy | 0 | 24289 | <filename>adventofcode/2020/25/crack_key/__init__.py<gh_stars>0
from .crack_key import derive_loop_size, derive_encryption_key
| 1.078125 | 1 |
guitarHarmony/scale.py | fuyuan-li/Guitar-Harmony | 0 | 24290 | from .interval import Interval
from .note import Note
class Scale():
"""
The scales class.
"""
scale_recipes = {
'major' : ['M2', 'M3', 'P4', 'P5', 'M6', 'M7', 'P8'],
'natural_minor': ['M2', 'm3', 'P4', 'P5', 'm6', 'm7', 'P8'],
'harmonic_minor': ['M2', 'm3', 'P4',... | 2.640625 | 3 |
TextAdventure.py | glors131/Portfolio1 | 0 | 24291 | <filename>TextAdventure.py<gh_stars>0
start = '''You wake up one morning and find yourself in a big crisis.
Trouble has arised and your worst fears have come true. Zoom is out to destroy
the world for good. However, a castrophe has happened and now the love of
your life is in danger. Which do you decide to save to... | 4.03125 | 4 |
catkin_workspace/src/project_weather_x/scripts/weather_server.py | NarendraPatwardhan/HuskyWeatherCast | 0 | 24292 | <reponame>NarendraPatwardhan/HuskyWeatherCast
#!/usr/bin/env python
from __future__ import division
from project_weather_x.srv import Weather,WeatherResponse
import os
import rospy
import numpy as np
import urllib2
import cv2
import json
def handle_weather(req):
print "Returning weather data for zipcode [%s]"%(r... | 2.921875 | 3 |
api/views.py | jacerong/normalesp | 2 | 24293 | <reponame>jacerong/normalesp
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os, re, sys
import pickle
from rest_framework.decorators import api_view, permission_classes
from rest_framework.permissions import IsAuthenticated
from rest_framework.response import Response
CURRENT_PATH = os.path... | 2.421875 | 2 |
main.py | Answeroid/fb-harvester | 0 | 24294 | from selenium import webdriver
from fb_auth import auth
from logger import Logger
def main():
# TODO add possibility to login to different FB accounts (use csv file to store them)
# TODO handle all exceptions especially when account was blocked
# TODO save automatic screenshots from time to time
# TOD... | 2.734375 | 3 |
src/dag_simulation.py | D-Stacks/kaspad-py-explorer | 6 | 24295 | import uuid
import random
import os
import math
import numpy as np
import simpy
import matplotlib.pyplot as plt
from simulation.ghostdag import block
from simulation.ghostdag.dag import select_ghostdag_k, DAG
from simulation.fakes import FakeDAG
from simulation.channel import Hub, Channel, PlanarTopology
from simulat... | 2.296875 | 2 |
web/kwmo/kwmo/controllers/skurl_teambox.py | tmbx/kas | 0 | 24296 | from kwmo.controllers.abstract_teambox import *
import time
from kwmo.lib.kwmo_kcd_client import KcdClient
from kwmo.lib.config import get_cached_kcd_external_conf_object
from kfs_lib import *
from kwmo.lib.base import init_session
from kwmo.lib.kwmolib import *
from kwmo.model.user import User
from kwmo.model.kfs_n... | 1.8125 | 2 |
src/modules/agents/n_rnn_agent.py | Sud0x67/mrmix | 4 | 24297 | <filename>src/modules/agents/n_rnn_agent.py<gh_stars>1-10
import torch.nn as nn
import torch.nn.functional as F
import torch as th
import numpy as np
import torch.nn.init as init
class NRNNAgent(nn.Module):
def __init__(self, input_shape, args):
super(NRNNAgent, self).__init__()
self.args = args
... | 2.78125 | 3 |
netsav/server/server.py | Turgon37/netsav | 0 | 24298 | <gh_stars>0
# -*- coding: utf8 -*-
# This file is a part of netsav
#
# Copyright (c) 2014-2015 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without... | 2 | 2 |
veros/setups/global_flexible/global_flexible.py | AkasDutta/veros | 115 | 24299 | <gh_stars>100-1000
#!/usr/bin/env python
import os
import h5netcdf
import scipy.ndimage
from veros import veros_routine, veros_kernel, KernelOutput, VerosSetup, runtime_settings as rs, runtime_state as rst
from veros.variables import Variable, allocate
from veros.core.utilities import enforce_boundaries
from veros.co... | 1.734375 | 2 |