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 |
|---|---|---|---|---|---|---|
maskrcnn_benchmark/layers/_utils.py | cxq1/paddle_VinVL | 0 | 49700 | <reponame>cxq1/paddle_VinVL
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import glob
import os.path
import os
import paddle
try:
from paddle.utils.cpp_extension import load as load_ext
# from torch.utils.cpp_extension import CUDA_HOME#todo
cuda_home = os.environ.get('CUDA_HOME')... | 2.0625 | 2 |
catalog/bindings/csw/function_name_type.py | NIVANorge/s-enda-playground | 0 | 49701 | from dataclasses import dataclass, field
from typing import Optional
__NAMESPACE__ = "http://www.opengis.net/ogc"
@dataclass
class FunctionNameType:
value: str = field(
default="",
metadata={
"required": True,
},
)
n_args: Optional[str] = field(
default=None,
... | 2.78125 | 3 |
sp_api/api/products/models/offer_type.py | lionsdigitalsolutions/python-amazon-sp-api | 0 | 49702 | # coding: utf-8
"""
Selling Partner API for Pricing
The Selling Partner API for Pricing helps you programmatically retrieve product pricing and offer information for Amazon Marketplace products. # noqa: E501
OpenAPI spec version: v0
Generated by: https://github.com/swagger-api/swagger-codegen.g... | 2.1875 | 2 |
web/mturk/scripts/Server.py | aleSuglia/cvdn | 52 | 49703 | <gh_stars>10-100
#!/usr/bin/env python
import argparse
import json
import numpy as np
import os
import pandas as pd
import time
class Game:
# Initialize the game.
def __init__(self, uid1, uid2,
house, target_obj, start_pano, end_panos, max_seconds_per_turn):
print("Game: initializing... | 2.796875 | 3 |
python/app/plugins/port/Mysql/Mysql_Weakpwd.py | taomujian/linbing | 351 | 49704 | #!/usr/bin/env python3
import pymysql
from urllib.parse import urlparse
class Mysql_Weakpwd_BaseVerify:
def __init__(self, url):
self.info = {
'name': 'Mysql 弱口令漏洞',
'description': 'Mysql 弱口令漏洞',
'date': '',
'exptype': 'check',
'type': 'Weakpwd'
... | 2.875 | 3 |
tests/integration/cattletest/core/test_container_logs.py | mbrukman/rancher-cattle | 0 | 49705 | from common_fixtures import * # NOQA
from test_docker import docker_context, TEST_IMAGE_UUID, if_docker
docker_context
def _get_container_logs_ip(host):
found_ip = None
for ip in host.ipAddresses():
if found_ip is None:
found_ip = ip
elif found_ip.role == 'primary':
f... | 2.0625 | 2 |
src/pfb/etl/etl.py | ianfore/pypfb | 0 | 49706 | <filename>src/pfb/etl/etl.py
import asyncio
from fastavro import reader
from aiohttp import ClientSession
class ETLHelper:
""" Asynchronous file helper class"""
def __init__(self, base_url, access_token):
self.base_url = base_url
self.token = access_token
self.headers = {
... | 2.484375 | 2 |
submissions/smart_modular_xgb/regressor.py | gpspelle/huawei-AI | 0 | 49707 | import numpy as np
from sklearn import multioutput
import xgboost as xgb
class Regressor():
def _init_(self):
super()._init_()
self.model = None
def fit(self, X, y):
# Create empty model made
self.model_bag = dict()
# Data bag
self.data_bag = di... | 2.328125 | 2 |
helium_commander/device_configuration.py | helium/helium-commander | 5 | 49708 | from __future__ import unicode_literals
from helium import Device, Configuration, DeviceConfiguration
def display_map(cls, client, uuid=False, include=None):
def _trim_id(res):
return res.id if uuid or client.uuid else res.short_id
def _config(self):
return _trim_id(self.configuration(use_in... | 2.3125 | 2 |
examples/ur_example.py | lzyang2000/kinpy | 53 | 49709 | import numpy as np
import kinpy as kp
arm = kp.build_serial_chain_from_urdf(
open("ur/ur.urdf").read(),
root_link_name="base_link",
end_link_name="ee_link",
)
fk_solution = arm.forward_kinematics(np.zeros(len(arm.get_joint_parameter_names())))
print(fk_solution)
| 2.171875 | 2 |
ch4/ch4_1.py | tdean1995/HFPythonSandbox | 1 | 49710 | <gh_stars>1-10
import pickle
man = []
other = []
try:
with open('sketch.txt') as data:
for each_line in data:
try:
(role, line_spoken) = each_line.split(':',1)
line_spoken = line_spoken.strip()
if role == 'Other Man':
... | 2.921875 | 3 |
days/07/part1.py | gr3yknigh1/aoc2021 | 0 | 49711 | from __future__ import annotations
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from typing import TypeVar
from typing import Iterable
T = TypeVar("T")
import os
BASE_PATH = os.path.dirname(__file__)
INPUT_PATH = os.path.join(BASE_PATH, "input.txt")
def median(iterable: Iterable[T]) -> T:
re... | 3.515625 | 4 |
project2.py | Shinyboii/2-Pygame | 0 | 49712 | import pygame
import os
pygame.init()
SCREEN_WIDTH = 800
SCREEN_HEIGHT = int(SCREEN_WIDTH * 0.8)
screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))
pygame.display.set_caption('Shooter')
#set framerate
clock = pygame.time.Clock()
FPS = 60
#define game variables
GRAVITY = 0.75
#define player action va... | 3.046875 | 3 |
promgen/version.py | PeterDaveHello/promgen | 0 | 49713 | __version__ = "0.39.dev"
| 1.078125 | 1 |
tests/app/api/business/brief_overview/test_get_publish_links.py | ArenaNetworks/dto-digitalmarketplace-api | 6 | 49714 | import pytest
from app.api.business import brief_overview_business
@pytest.fixture()
def publish_links():
return [
'How long your brief will be open',
'Description of work',
'Location',
'Review and publish your requirements',
'Question and answer session details',
... | 2.171875 | 2 |
examples/cantilever/main.py | iitrabhi/fenics-docker | 8 | 49715 | <gh_stars>1-10
from dolfin import *
set_log_level(0) #https://fenicsproject.org/qa/810/how-to-disable-message-solving-linear-variational-problem/
mul = 5
L = 25.
H = 1.
Nx = 250 * mul
Ny = 10 * mul
mesh = RectangleMesh(Point(0., 0.), Point(L, H), Nx, Ny, "crossed")
def eps(v):
return sym(grad(v))
E = Constant(1e... | 2.140625 | 2 |
trseeker/tools/classification.py | ad3002/Lyrebird | 0 | 49716 | <reponame>ad3002/Lyrebird<gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
#@created: 07.09.2010
#@author: <NAME>
#@contact: <EMAIL>
"""
"""
from collections import defaultdict
from collections import Counter
import math
from trseeker.tools.ngrams_tools import process_list_to_kmer_index
cl... | 2.453125 | 2 |
common/src/stack/command/stack/commands/remove/host/bootflags/__init__.py | khanfluence/stacki-cumulus-switch | 0 | 49717 | # @copyright@
# Copyright (c) 2006 - 2018 Teradata
# All rights reserved. Stacki(r) v5.x stacki.com
# https://github.com/Teradata/stacki/blob/master/LICENSE.txt
# @copyright@
#
# @rocks@
# Copyright (c) 2000 - 2010 The Regents of the University of California
# All rights reserved. Rocks(r) v5.4 www.rocksclusters.org
# ... | 2 | 2 |
docs/bayes_window_book/_build/jupyter_execute/lfp_example/lfp_stim_strength.py | mmyros/bayes_window_examples | 0 | 49718 | <reponame>mmyros/bayes_window_examples<filename>docs/bayes_window_book/_build/jupyter_execute/lfp_example/lfp_stim_strength.py
#!/usr/bin/env python
# coding: utf-8
# # LFP example with stim strength
# In[1]:
import numpy as np
import pandas as pd
from bayes_window import BayesWindow, BayesRegression
from bayes_win... | 2.46875 | 2 |
optimizer.py | sunshower76/Deep_Translation_Prior | 9 | 49719 | import os
import cv2
import gc
import random
import time
from tqdm import tqdm
import numpy as np
import matplotlib.pyplot as plt
import argparse
from glob import glob
import torch
import torch.nn as nn
import torchvision.transforms as transforms
from PIL import Image, ImageFilter
from models.OEFT import OEFT
parse... | 2.125 | 2 |
NeoMat_Text.py | dsiee/CircuitPython_NeopixelMatrix_Text | 1 | 49720 | <reponame>dsiee/CircuitPython_NeopixelMatrix_Text
import board as board
import neopixel as neopixel
import adafruit_framebuf as adafruit_framebuf
from math import ceil
class Matrix:
def __init__(self, pin, width, height, color):
self.width = width
self.height = height
self.color = color
... | 3.609375 | 4 |
FirestormProject/OldFireExtinguishing/VeryOld/simulator.py | sisl/rllab | 9 | 49721 | import tensorflow as tf
import numpy as np
import random
import time
from math import exp
from keras.models import Sequential
from keras.layers.core import Dense, Dropout, Activation
from keras.layers import Merge
from keras.optimizers import RMSprop, Adam
start_time = time.time()
class UAV_fire_extinguish(object):
... | 2.390625 | 2 |
SlideSeg/splitter.py | eDIMESLab/dermas | 1 | 49722 | <reponame>eDIMESLab/dermas
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import division
import os
import argparse
import SlideSeg
__author__ = '<NAME>'
__email__ = '<EMAIL>'
def parse_args ():
description = 'Histological Slide Annotation Splitter'
parser... | 2.578125 | 3 |
src/PrettyErrorsConfig.py | Potriashka/NewsHelper | 0 | 49723 | <filename>src/PrettyErrorsConfig.py
import pretty_errors
pretty_errors.configure(
separator_character = '*',
filename_display = pretty_errors.FILENAME_EXTENDED,
line_number_first = True,
display_link = True,
lines_before = 5,
lines_after = 2,
line_color = ... | 1.796875 | 2 |
src/apps/blog/forms.py | snicoper/snicoper.com | 2 | 49724 | from django import forms
class ArticleRecommendForm(forms.Form):
"""Formulario para recomendar articulo."""
name = forms.CharField(
label='Nombre'
)
from_email = forms.EmailField(
label='Tu email',
widget=forms.EmailInput()
)
to_email = forms.EmailField(
label='... | 2.28125 | 2 |
mundo-2/ex060.py | GustavoMendel/curso-python | 0 | 49725 | from time import sleep
print('\033[1:31m-=-\033[m' * 6)
print('\033[1m FATORIAL \033[m')
print('\033[1:31m-=-\033[m' * 6)
sleep(1)
numero = int(input('\033[1:33mDigite um número: \033[m'))
c = numero - 1
fatorial = numero
while c > 0:
fatorial = fatorial * c
c = c - 1
sleep(1)
print('O fatorial de {}... | 3.734375 | 4 |
thermister_table.py | thesteg/thermister_table | 0 | 49726 | #!/usr/bin/python
import math
import sys
#bValue = float(sys.argv[1])
#nomOhm = float(sys.argv[2])
#nomTemp = float(sys.argv[3])
#seriesR = float(sys.argv[4])
#adcRes = int(sys.argv[5])
bValue = 3750
nomOhm = 10000
nomTemp = 250
seriesR = 4700
adcRes = 10
adcMax = 2**adcRes
adcVal = 0
vals = [0] * adcMax
while ad... | 2.5625 | 3 |
myroot/apps.py | pinoylearnpython/dev | 2 | 49727 | from django.apps import AppConfig
from django.conf import settings
class myrootConfig(AppConfig):
""" Class to call our 'myroot' app structural name """
name = settings.APP_LABEL_MYROOT
| 1.6875 | 2 |
mathematics_dataset/util/probability.py | PhysicsTeacher13/Mathematics_Dataset | 1,577 | 49728 | # Copyright 2018 DeepMind Technologies 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 ag... | 3.640625 | 4 |
scikits/fitting/tests/test_nonlinlstsq.py | ska-sa/scikits.fitting | 5 | 49729 | ###############################################################################
# Copyright (c) 2007-2018, National Research Foundation (Square Kilometre Array)
#
# Licensed under the BSD 3-Clause License (the "License"); you may not use
# this file except in compliance with the License. You may obtain a copy
# of the ... | 2.28125 | 2 |
hivs_administrative/migrations/0006_add area type model.py | tehamalab/hivs | 0 | 49730 | # Generated by Django 2.0.7 on 2018-09-19 18:38
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('hivs_administrative', '0005_set_extras_default_value_to_callable'),
]
operations = [
migrations.CreateModel... | 1.71875 | 2 |
mlxtend/mlxtend/evaluate/__init__.py | WhiteWolf21/fp-growth | 0 | 49731 | <reponame>WhiteWolf21/fp-growth
# <NAME> 2014-2020
# mlxtend Machine Learning Library Extensions
# Author: <NAME> <<EMAIL>>
#
# License: BSD 3 clause
from .bootstrap import bootstrap
from .bootstrap_outofbag import BootstrapOutOfBag
from .bootstrap_point632 import bootstrap_point632_score
from .cochrans_q import coch... | 1.242188 | 1 |
pygears/lib/rounding.py | bogdanvuk/pygears | 120 | 49732 | from pygears import gear, datagear, alternative, module
from pygears.typing.qround import get_out_type, get_cut_bits
from pygears.typing import Uint, code, Bool, Int, Fixp, Ufixp
@datagear
def qround(din,
*,
fract=0,
cut_bits=b'get_cut_bits(din, fract)',
signed=b'din.signed... | 2.515625 | 3 |
test/test_topology.py | fyumoto/MHGAN | 17 | 49733 | import unittest
from mhgan import *
class Test_Topology(unittest.TestCase):
def test_io_tensors(self):
gan = WGAN(Generator([100], [28, 28, 1]), Discriminator())
self.assertEqual(type(gan.G), tf.Tensor)
self.assertEqual(type(gan.G), tf.Tensor)
self.assertEqual(type(gan.x), tf.Ten... | 2.46875 | 2 |
analyzer.py | christopher-wolff/News-Analysis | 0 | 49734 | """Main module."""
__authors__ = '<NAME>, <NAME>'
__version__ = '1.0'
__date__ = '9/10/2017'
import json
import os.path
import pickle
import random
import urllib
from bs4 import BeautifulSoup
from nltk.corpus import stopwords
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.feature_extracti... | 2.625 | 3 |
definitions.py | krolse/discord-bot | 0 | 49735 | <reponame>krolse/discord-bot
import os
ROOT_PATH = os.path.dirname(__file__)
PREFIX = '!'
| 1.46875 | 1 |
examples/config/xtpmNode.py | vinantip/pwrapi | 2 | 49736 | <reponame>vinantip/pwrapi
#!/usr/bin/python
from pyConfig import *
logging.basicConfig( format='%(levelname)s: %(message)s', level=logging.INFO )
plugins['CrayXTPM'] = 'libpwr_xtpmdev'
devices['XTPM-node'] = ['CrayXTPM','']
platform = Object( Platform, 'plat' )
platform.setAttrOp( Energy, Sum, Float )
platform.s... | 1.992188 | 2 |
gada_electronics/gada_electronics/doctype/sales_invoice/sales_invoice.py | rtghonorio/gada_electronics | 0 | 49737 | # -*- coding: utf-8 -*-
# Copyright (c) 2022, <NAME> and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class SalesInvoice(Document):
def validate (self):
if(self.posting_date > self.due_date):
frapp... | 2 | 2 |
sdk/python/pulumi_aws_native/glue/get_trigger.py | pulumi/pulumi-aws-native | 29 | 49738 | <reponame>pulumi/pulumi-aws-native<filename>sdk/python/pulumi_aws_native/glue/get_trigger.py<gh_stars>10-100
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulum... | 1.765625 | 2 |
main/migrations/0001_initial.py | Mohsen7640/PicoSchool | 48 | 49739 | <filename>main/migrations/0001_initial.py
# Generated by Django 3.2 on 2022-02-04 11:22
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='SiteSetting',
field... | 1.71875 | 2 |
0000 hihoOnce/175 Robots Crossing River/main.py | SLAPaper/hihoCoder | 0 | 49740 | from math import ceil
z, y, x = sorted(int(x) for x in raw_input().split())
if x <= y + z:
print int(ceil((x + y + z) / 20.0)) * 6
else:
run = (y + z) / 10
xr = x - 10 * run
nxr = (y + z) % 10
xr -= 15 - nxr if nxr < 8 else nxr
print int(run + 1 + ceil(xr / 15.0)) * 6
| 3.046875 | 3 |
script/Isin google Nordnet/isin-nordnet.py | pettersoderlund/fondout | 0 | 49741 | # -*- coding: UTF-8 -*-
import unicodedata
import openpyxl.reader.excel
import time
import datetime
import codecs
import mechanize
import cookielib
import re
import sys
from random import randint
def getNordnetIsin(br, nordnetUrl):
r = br.open(nordnetUrl)
result = re.search( r'<iframe src="?\'?([^"\'"]*)', ... | 2.609375 | 3 |
plugins/smtp/kpireport_smtp/output.py | diurnalist/kpireporter | 9 | 49742 | from datetime import datetime
from email.message import EmailMessage
from email.headerregistry import Address
from jinja2 import Markup
from premailer import transform
import smtplib
from kpireport.output import OutputDriver
class SMTPOutputDriver(OutputDriver):
"""Email a report's contents via SMTP to one or m... | 2.578125 | 3 |
src/examples/g_lists_and_tuples/main.py | acc-cosc-1336-spring-2022/acc-cosc-1336-spring-2022-rObErT-a93 | 0 | 49743 | <gh_stars>0
import lists
nums = [99,100,101,102]
lists.loop_list_w_for(nums)
print('----------')
for n in nums:
print(n)
print('*************')
num = [99,100,101,102]
lists.loop_list_w_while(num)
print('----------')
for n in num:
print(n)
print('**************')
lists.collect_home_values()
print('-------... | 3.875 | 4 |
bot.py | Aadhith-Ujesh/online_class_attending_bot | 0 | 49744 | <filename>bot.py
import pyautogui
import datetime
def attender(team,driver,t3):
from selenium import webdriver
import time
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
# dri... | 2.609375 | 3 |
pyeccodes/defs/grib1/2_233_1_table.py | ecmwf/pyeccodes | 7 | 49745 | <gh_stars>1-10
def load(h):
return ({'abbr': 'Reserved', 'code': 0, 'title': 'RESERVED Reserved Reserved'},
{'abbr': 'pres', 'code': 1, 'title': 'PRES Pressure Pa'},
{'abbr': 'msl', 'code': 2, 'title': 'MSL Mean sea level pressure Pa'},
{'abbr': 'ptend', 'code': 3, 'title': 'PTEN... | 2.203125 | 2 |
project_scripts/install_dependencies.py | Mlokos/portfolio | 0 | 49746 | <filename>project_scripts/install_dependencies.py
#!/bin/bash
import subprocess
import os
install_ruby_sass = 'sudo apt install ruby-sass'
try:
# pipe output to /dev/null for silence
null = open("/dev/null", "w")
subprocess.Popen("scss", stdout=null, stderr=null)
null.close()
except OSError:
print... | 2.421875 | 2 |
src/modules/network/python/__init__.py | ivanmurashko/kalinka | 0 | 49747 | <reponame>ivanmurashko/kalinka
from net import *
from defines import *
import cli
import proto
""" Creates a module instance
@param[in] server - the server instance
"""
def createModuleInstance(server):
return Net(server)
def importCLI(parent):
""" Import a CLI instance to main CLI
"""
netcli... | 1.90625 | 2 |
Python/Python For Absolute Beginner/mainfile.py | omkarsutar1255/Python-Data | 0 | 49748 | def printom(str):
return f"ye hath mujhe {str}"
def add(n1, n2):
return n1 + n2 + 5
print("and the name is", __name__)
if __name__ == '__main__':
print(printom("de de thakur"))
o = add(4, 6)
print(o)
| 3.5625 | 4 |
aionasa/exoplanet/_tests.py | nwunderly/aio-nasa | 2 | 49749 | from .api import Exoplanet
async def _test_method(ref, name, *args, **kwargs):
try:
result = await ref(*args, **kwargs)
try:
iter(result)
iterable = True
except TypeError:
iterable = False
print(
f"exoplanet.{name} success\n\t",
... | 2.59375 | 3 |
src/iJungle/config.py | microsoft/dstoolkit-anomaly-detection-ijungle | 3 | 49750 | __version__ = '0.1.73'
_MODEL_DIR = 'outputs'
| 1.070313 | 1 |
gazenet-ft.py | arangesh/GPCycleGAN | 26 | 49751 | <reponame>arangesh/GPCycleGAN<gh_stars>10-100
import os
import json
from datetime import datetime
from statistics import mean
import argparse
import numpy as np
import matplotlib
matplotlib.use('Agg')
from matplotlib import pyplot as plt
import torch
import torch.optim as optim
from torch.autograd import Variable
imp... | 1.96875 | 2 |
backend/secret_base/apps.py | tanzhiquan/DragonGoods | 0 | 49752 | from django.apps import AppConfig
class SecretBaseConfig(AppConfig):
name = 'secret_base'
| 1.148438 | 1 |
dezede/views.py | adrienlachaize/dezede | 15 | 49753 | <reponame>adrienlachaize/dezede
import datetime
import json
from collections import OrderedDict
from mimetypes import guess_type
from django.apps import apps
from django.contrib.contenttypes.models import ContentType
from django.contrib.sitemaps import Sitemap
from django.contrib.staticfiles.storage import staticfiles... | 1.65625 | 2 |
tortoise/tests/test_init.py | EtzelWu/tortoise-orm | 0 | 49754 | from tortoise import Tortoise
from tortoise.contrib import test
from tortoise.exceptions import ConfigurationError
from tortoise.tests.testmodels import Tournament
class TestInitErrors(test.SimpleTestCase):
async def setUp(self):
self.apps = Tortoise.apps
self.inited = Tortoise._inited
Tor... | 2.21875 | 2 |
video_verification.py | ChouaibBELILITA/Final_year_Project | 0 | 49755 | <filename>video_verification.py
from yolov3_tf2.utils import draw_outputs
from yolov3_tf2.dataset import transform_images
from yolov3_tf2.models import (
YoloV3, YoloV3Tiny
)
from absl.flags import FLAGS
from absl import app, flags, logging
import time
import os
import glob
import cv2
import matplotlib.pyplot as p... | 2.453125 | 2 |
rurusetto/wiki/migrations/0008_auto_20210802_2042.py | siddhantdixit/rurusetto | 19 | 49756 | <filename>rurusetto/wiki/migrations/0008_auto_20210802_2042.py<gh_stars>10-100
# Generated by Django 3.2.5 on 2021-08-02 20:42
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swa... | 1.492188 | 1 |
src/sas/sascalc/pr/c_extensions/__init__.py | andyfaff/sasview | 0 | 49757 | """
C extensions to provide the P(r) inversion computations.
"""
| 0.964844 | 1 |
nsmc_evaluation.py | alclone94/KorRoBERTa | 0 | 49758 | import torch
import argparse
import os
import glob
from torch.utils.data import DataLoader, SequentialSampler
from tqdm import tqdm
from nsmc_modeling import RobertaForSequenceClassification
from bert.tokenizer import Tokenizer
from dataset import NSMCDataSet
def _get_parser():
parser = argparse.ArgumentParser(... | 2.3125 | 2 |
scripts/motion_controller.py | SaeedAlRahma/baxter-object-manipulation | 0 | 49759 | #!/usr/bin/python
# Motion Controller
""" IMPORT MODULES """
import sys, struct, time, json
sys.path.insert(0, "/home/saeed/Klampt/iml-internal/Ebolabot")
#-----------------------------------------------------------
#Imports require internal folders
from Motion import motion
from Motion import config
#===========... | 2.328125 | 2 |
dynadb/migrations/0070_auto_20170107_1240.py | GPCRmd/GPCRmd | 3 | 49760 | <reponame>GPCRmd/GPCRmd<gh_stars>1-10
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2017-01-07 11:40
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('dynadb', '0069_auto_20170107_1203'),
]
operation... | 1.625 | 2 |
mne/tests/test_ola.py | rylaw/mne-python | 1,953 | 49761 | import numpy as np
from numpy.testing import assert_allclose
import pytest
from mne._ola import _COLA, _Interp2, _Storer
def test_interp_2pt():
"""Test our two-point interpolator."""
n_pts = 200
assert n_pts % 50 == 0
feeds = [ # test a bunch of feeds to make sure they don't break things
[n_... | 2.359375 | 2 |
src/test/tinc/tincrepo/mpp/gpdb/tests/storage/filerep/mpp18816/verify/verify.py | lintzc/GPDB | 1 | 49762 | """
Copyright (C) 2004-2015 Pivotal Software, Inc. All rights reserved.
This program and the accompanying materials are made available under
the terms of the 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
... | 1.765625 | 2 |
python/dc/roms_pv.py | subond/tools | 0 | 49763 | <filename>python/dc/roms_pv.py
def roms_pv(fname,tindices):
import h5py
u = dc_roms_read_data(fname,'u')
v = dc_roms_read_data(fname,'v')
| 1.890625 | 2 |
operations/pg/sprites_light.py | Sam-prog-sudo/MacGyver | 0 | 49764 | # encoding: utf-8
import pygame
from assets import constants as C
class Decor(pygame.sprite.Sprite):
def __init__(self, name, pos_tuple):
pygame.sprite.Sprite.__init__(self)
self.name = name
self.image = pygame.image.load(
self.full_path(C.IMAGES[name])
).convert()
... | 2.96875 | 3 |
pyopt/packing/rectangular/drawer.py | stonelake/pyoptimization | 0 | 49765 | __author__ = "<NAME>"
from random import randrange
from visual import *
from reports import ReportsBuilder
class BoxDrawer(object):
"""
Draws the boxes
"""
def __init__(self, packing_params=None, display_labels=True, **kwargs):
"""
Start the box drawing.
"""
... | 3.140625 | 3 |
info/views.py | RockyRoad29/flask-kit | 1 | 49766 | <reponame>RockyRoad29/flask-kit
# -*- coding: utf-8 -*-
"""
Example additional blueprint.
:copyright: (c) 2012 by <NAME>.
:license: BSD, see LICENSE for more details.
"""
from flask.templating import render_template
from flask.views import MethodView
from info import info
class HelpPageView(MethodView)... | 2.015625 | 2 |
strings/string.py | JOkendo/pyTopical | 0 | 49767 | <filename>strings/string.py
"""
PALINDROME
Palindrome is a word that reads the same foward and backward.
Checking a palindrome
"""
import sys
def isPalindrome(s):
low = 0
high = len(s) - 1
while low < high:
if s[low] != s[high]:
return False
low += 1
high -= 1... | 3.625 | 4 |
Python/generateObservations.py | kgkIEEE/Gemini2 | 1 | 49768 | import argparse
import csv
from skyfield import api
from skyfield.api import EarthSatellite
from skyfield.constants import AU_KM, AU_M
from skyfield.sgp4lib import TEME_to_ITRF
from skyfield.api import Topos, load
# Read TLE file and write key parameters in CSV format
def readTLE(tleFilename):
# Open... | 2.609375 | 3 |
src/service_stellar_signer/management/commands/set_backup_key.py | rehive/multisig-stellar-signer | 0 | 49769 | <filename>src/service_stellar_signer/management/commands/set_backup_key.py
from optparse import make_option
from django.core.management.base import BaseCommand, CommandError
from django.core.serializers.json import DjangoJSONEncoder
from django.contrib.auth.models import User
from service_stellar_signer.models import ... | 1.96875 | 2 |
moire/nn/functions/indexing.py | speedcell4/moire | 2 | 49770 | <filename>moire/nn/functions/indexing.py
import dynet as dy
import numpy as np
import moire
from moire import Expression
__all__ = [
'argmax', 'argmin',
'epsilon_argmax', 'epsilon_argmin',
'gumbel_argmax', 'gumbel_argmin',
]
def argmax(x: Expression, axis: int = None) -> int:
return int(x.npvalue().... | 2.1875 | 2 |
Hackathon/urls.py | alisha21puja/Hackathon1 | 0 | 49771 |
from django.contrib import admin
from django.urls import path, include
from Blog import views
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [
path('', include('home.urls'), name='home'),
path('aboutus/', include('aboutus.urls'), name='aboutus'),
path('accounts... | 1.84375 | 2 |
bin/Adenosine_to_inosine.py | castualwang/aimap | 0 | 49772 | #!/usr/bin/env python3
#
# aimap.py
#
# This code is part of the aimap package, and is governed by its licence.
# Please see the LICENSE file that should have been included as part of
# this package.
import json
import logging
import logging.handlers
import os
import subprocess
import pandas as pd
import gffutils
imp... | 2.5625 | 3 |
choicemodels/tools/simulation.py | UDST/choicemodels | 54 | 49773 | <filename>choicemodels/tools/simulation.py
"""
Utilities for Monte Carlo simulation of choices.
"""
import numpy as np
import pandas as pd
from multiprocessing import Process, Manager, Array, cpu_count
from tqdm import tqdm
import warnings
def monte_carlo_choices(probabilities):
"""
Monte Carlo simulation of... | 3.109375 | 3 |
IOUtilities.py | pumbas600/CriticalPath | 0 | 49774 | import csv
from _tkinter import TclError
import os.path as ospath
from enum import Enum
class Errors(Enum):
SUCCESS = 'Successfully completed the action.'
FILE_NOT_FOUND = "The file, {}, couldn't be found."
FILE_MADE = "The file, {}, didn't exist and so it has been created."
FILE_CURRENTLY_OPEN = 'The ... | 2.875 | 3 |
ULMFiT/ulmfit_test_punctuation.py | cahya-wirawan/language-modelling | 57 | 49775 | <gh_stars>10-100
from fastai.text import *
import numpy as np
from utils import beamsearch, beamsearch_punctuation
BOS = 'xbos' # beginning-of-sentence tag
FLD = 'xfld' # data field tag
# VERSION = '0.2'
LANG = 'id'
LM_PATH = Path(f'lmdata_0.2/{LANG}/')
LM_PATH_MODEL = LM_PATH/'models/wiki_id_lm.h5'
LM_PATH_ITOS =... | 2.25 | 2 |
Project/Unit_Tests/test_Window.py | gmgoodale/Team19-Zoltar-Stock-Trader | 0 | 49776 | # Class to test the GrapherWindow Class
class GrapherTester:
def __init__(self):
subject = Grapher()
testFileName = 'TestData.csv'
testStockName = 'Test Stock'
testGenerateGraphWithAllPositiveNumbers(testFileName, testStockName)
def createTestData(xAxis, yAxis):
# Genera... | 2.6875 | 3 |
kfac/layers/__init__.py | saeedsoori/kfac_pytorch | 35 | 49777 | <gh_stars>10-100
import torch.nn as nn
import kfac.modules as km
from kfac.layers.conv import Conv2dLayer
from kfac.layers.embedding import EmbeddingLayer
from kfac.layers.linear import LinearLayer
from kfac.layers.linear import LinearMultiLayer
__all__ = ['KNOWN_MODULES', 'get_kfac_layers', 'module_requires_grad']
... | 2.296875 | 2 |
src/pycomposite/composite_decorator.py | BstLabs/py-composite | 4 | 49778 | from collections import deque
from functools import reduce
from inspect import getmembers, isfunction, signature
from typing import Any, Iterable, List
from deepmerge import always_merger
def _constructor(self, *parts: List[Iterable[Any]]) -> None:
self._parts = parts
def _make_iterator(cls):
def _iterator... | 2.609375 | 3 |
populate_next_right_pointers.py | KevinLuo41/LeetCodeInPython | 19 | 49779 | #!/usr/bin/env python
# encoding: utf-8
"""
populate_next_right_pointers.py
Created by Shengwei on 2014-07-27.
"""
# https://oj.leetcode.com/problems/populating-next-right-pointers-in-each-node/
# tags: medium, tree, pointer, recursion
"""Given a binary tree
struct TreeLinkNode {
TreeLinkNode *left;
... | 4.125 | 4 |
renku/cli/config.py | tcchrist/renku-python | 0 | 49780 | # -*- coding: utf-8 -*-
#
# Copyright 2017-2020 - Swiss Data Science Center (SDSC)
# A partnership between École Polytechnique Fédérale de Lausanne (EPFL) and
# Eidgenössische Technische Hochschule Zürich (ETHZ).
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in c... | 1.890625 | 2 |
lux_dom/apps/core/models.py | mateuszdargacz/lux_dom | 0 | 49781 | # -*- coding: utf-8 -*-
__author__ = 'mateusz'
__date__ = '13.11.14 / 08:59'
__git__ = 'https://github.com/mateuszdargacz'
from django.db import models
from django.utils.translation import gettext_lazy as _
class HouseType(models.Model):
name = models.CharField(_('Nazwa'), max_length=56)
description = models... | 2.0625 | 2 |
Web3/Brownie_AaveInteraction/scripts/get_weth.py | C-Mierez/Web3-Solidity | 1 | 49782 | <reponame>C-Mierez/Web3-Solidity
from scripts.utils import get_account
from brownie import interface, config, network, accounts
from web3 import Web3
def get_weth():
"""
Mint wETH by depositing ETH
"""
account = get_account()
# Need to get the ABI and the Address of the contract
weth = inte... | 2.625 | 3 |
Dictionary.py | vitorbellotto/synonymme | 0 | 49783 | #!/bin/usr/python
#
# This class imports search results from
# DUDEN website and stores in a pickle for
# later use.
#
#############################################
import pprint, pickle
from bs4 import BeautifulSoup
import requests
import re
class Dictionary:
dict_pickle = "german_dict.pickle"
#meaning = list()
... | 3.375 | 3 |
vhdl-stuff/examples/test_srff.py | jwrr/fpga-stuff | 0 | 49784 | <reponame>jwrr/fpga-stuff
# test_srff.py
import random
import cocotb
from cocotb.clock import Clock
from cocotb.triggers import RisingEdge
from cocotb.triggers import FallingEdge
from cocotb.triggers import ClockCycles
@cocotb.test()
async def test_srff_simple(dut):
""" Test basic functionality of set/reset flop"... | 2.578125 | 3 |
cro_tax_debtors/spiders.py | arrrlo/python-croatian-tax-deptors-website-parser | 0 | 49785 | <gh_stars>0
import six
import requests
import lxml.html as lxml_html
from .debtors import Item, CategoryDone
if six.PY2:
import unidecode
from StringIO import StringIO
def prepare_content(response):
return response.content
def to_str(_text):
return unidecode.unidecode(_text)
else:
... | 2.5625 | 3 |
python/domain/bir2017/content/ch10.py | ICTU/document-as-code | 2 | 49786 | <reponame>ICTU/document-as-code<filename>python/domain/bir2017/content/ch10.py
# -*- coding: latin-1 -*-
"""
fragments - define text fragments in the document
"""
from domain.norm_document.model import Chapter, Section, Norm, Verifier
S1001 = Section(
identifier="10.01",
title="Cryptografsche beheersmaatr... | 2.8125 | 3 |
cs329s_waymo_object_detection/utils/train_utils.py | peterdavidfagan/waymo-object-detection | 0 | 49787 | import sys
import os
import numpy as np
import torchvision
from torchvision.models.detection.faster_rcnn import FastRCNNPredictor
from torchvision.models.detection import FasterRCNN
from torchvision.models.detection.rpn import AnchorGenerator
import wandb
import json
from cs329s_waymo_object_detection.utils.gcp_util... | 2.15625 | 2 |
dnbpy/policy.py | lantunes/dnbpy | 2 | 49788 | <reponame>lantunes/dnbpy
class Policy:
def select_edge(self, board_state, score=None, opp_score=None):
raise NotImplementedError
| 1.65625 | 2 |
qc_extended_vs_vaps.py | bvermeulen/Seistools | 0 | 49789 | <filename>qc_extended_vs_vaps.py
''' program to run extended QC parsing module
using various options: sequential, multiprocessing, threading
'''
import multiprocessing as mp
from pathlib import Path
import pandas as pd
from qc_extended import ExtendedQc
from qc_vaps import Vaps
from Utils.plogger import Logger, tim... | 2.5625 | 3 |
src/Project.py | atbe/231_grading_script_v2 | 0 | 49790 | import re
import subprocess
import getpass
# for testing purposes only.
EDITOR="gedit"
class Project:
"""
Used to model Project objects.
Attributes
-----------
project_path : Path
Used to indicate the path of the project folder.
number : int
Project number.
py_paths : li... | 3.109375 | 3 |
arni_countermeasure/src/arni_countermeasure/reaction_publish_rosout_node.py | UTNuclearRobotics/arni | 16 | 49791 | from reaction import *
import rospy
class ReactionPublishRosOutNode(Reaction):
"""A reaction that is able to publish a message on rosout."""
def __init__(self, autonomy_level, message, loglevel):
super(ReactionPublishRosOutNode, self).__init__(None, autonomy_level)
#: The message to publish... | 2.921875 | 3 |
tools/lint.py | WestHealth/zero-to-jupyterhub-k8s | 1 | 49792 | #!/usr/bin/env python3
"""
Lints the chart's yaml files without any cluster interaction. For this script to
function, you must install yamllint and kubeval.
- https://github.com/adrienverge/yamllint
- https://github.com/garethr/kubeval
"""
import argparse
import glob
import subprocess
def lint(config, values, kuber... | 2.390625 | 2 |
the-big-fan/python/iac/stacks/sharedinfrastack.py | InfrastructureHQ/CDK-Patterns | 0 | 49793 | <filename>the-big-fan/python/iac/stacks/sharedinfrastack.py
# Import Core Modules
# For consistency with other languages, `cdk` is the preferred import name for the CDK's core module.
from aws_cdk import core as cdk
# Import Security & Identity Related Modules
from aws_cdk import aws_iam
from aws_cdk.aws_iam import Po... | 1.265625 | 1 |
tests/util/pdf_utils.py | Worteks/OrangeAssassin | 0 | 49794 | from email.mime.application import MIMEApplication
from email.mime.multipart import MIMEMultipart
from io import BytesIO
import PyPDF2
def new_pdf(details, name, width=216, height=280):
"""Creates a new empty PDF file"""
pdfobj = PyPDF2.PdfFileWriter()
pdfobj.addMetadata(details)
pdfobj.addBlankPage(... | 3.015625 | 3 |
projet/propagation.py | xinyuhuang97/LU3IN003-Projet | 0 | 49795 | import numpy as np
import sys
import string
M=4
N=5
# grille rempli par sequence
s_grille=np.full((M+N,M+N),0)
# grille remplit par 0 -1 1
grille=np.full((M,N), -1)
#grille[1][0]=0
sequence1=[1,1]
sequence2=[2,1]
# non-colore -1
# blanche 0
# noire 1
def lire_fichier(s_grille):
#file=sys.argv[1:]
try:
... | 3.078125 | 3 |
scoring/clogp.py | MauriceKarrenbrock/reinvent-memory | 0 | 49796 | <gh_stars>0
# coding=utf-8
from typing import List
import numpy as np
from rdkit import Chem
from rdkit.Chem import rdMolDescriptors
class clogp(object):
""" Optimize strutures to have a predicted clogP within a particular range"""
def __init__(self, range: str):
try:
numbers = list(map... | 2.5625 | 3 |
reference/word2vec_basic_all_by_kim.py | KangByungWook/tensorflow | 0 | 49797 | <filename>reference/word2vec_basic_all_by_kim.py
# Copyright 2015 The TensorFlow Authors. 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/li... | 2.875 | 3 |
uontypes/units/mass.py | uon-language/uon-parser | 1 | 49798 | <filename>uontypes/units/mass.py
from uontypes.units.quantity import Quantity
class Mass(Quantity):
pass
class Kilogram(Mass):
def __str__(self):
return "kg"
def to_binary(self):
return b"\x21"
class Gram(Mass):
def __str__(self):
return "g"
def to_binary(self):
... | 3.046875 | 3 |
setup.py | jcomo/victor | 1 | 49799 | import sys
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
class Tox(TestCommand):
user_options = [('tox-args=', 'a', "Arguments to pass to tox")]
def initialize_options(self):
TestCommand.initialize_options(self)
self.tox_args = None
... | 2.09375 | 2 |