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 |
|---|---|---|---|---|---|---|
src/fullyautomatednutcracker/cogs/antiselfdeprecation.py | dovedevic/fullyautomatednutcracker | 5 | 21300 | from discord.ext import commands
import asyncio
import time
class AntiSelfDeprecation(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.bot.nono_words = []
self.dumb = ('im dumb', 'i\'m dumb', 'im stupid', 'i\'m stupid')
self.not_dumb = ('im not dumb', 'i\'m not dumb', ... | 2.671875 | 3 |
pyaff4/lexicon.py | timbolle-unil/pyaff4 | 0 | 21301 | # Copyright 2014 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | 1.625 | 2 |
dusted/dustforce/linux.py | AlexMorson/dustforce-tas-editor | 1 | 21302 | import queue
import threading
from subprocess import PIPE, Popen
procs = []
stdout = queue.Queue()
def process_stdout(proc):
while (line := proc.stdout.readline()) != b"":
stdout.put(line.decode().strip())
procs.remove(proc)
def create_proc(uri):
proc = Popen(["unbuffer", "xdg-open", uri], stdo... | 2.59375 | 3 |
joplin/pages/official_documents_page/factories.py | cityofaustin/joplin | 15 | 21303 | <filename>joplin/pages/official_documents_page/factories.py
import factory
from pages.official_documents_page.models import OfficialDocumentPage, OfficialDocumentCollectionOfficialDocumentPage
from pages.base_page.factories import JanisBasePageFactory
from pages.official_documents_collection.factories import OfficialDo... | 2.046875 | 2 |
flask_qa/routes/main.py | gouravdhar/youtube_video_code | 0 | 21304 | <reponame>gouravdhar/youtube_video_code<filename>flask_qa/routes/main.py
from flask import Blueprint, render_template, request, redirect, url_for
from flask_login import current_user, login_required
from flask_cors import CORS
from flask_qa.extensions import db
from flask_qa.models import Question, User, Stats, Not... | 2.546875 | 3 |
src/compas_rhino/utilities/misc.py | XingxinHE/compas | 235 | 21305 | <gh_stars>100-1000
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
try:
basestring
except NameError:
basestring = str
import os
import sys
import ast
from compas_rhino.forms import TextForm
from compas_rhino.forms import ImageForm
import System
i... | 1.78125 | 2 |
lib/utils/visualization/fixup_resnet.py | yandex-research/learnable-init | 4 | 21306 | import torch
import numpy as np
import matplotlib.pyplot as plt
from lib.utils import moving_average, check_numpy
@torch.no_grad()
def visualize_pdf(maml):
i = 0
plt.figure(figsize=[22, 34])
for name, (weight_maml_init, bias_maml_init) in maml.initializers.items():
weight_base_init, _ = maml.untra... | 2.359375 | 2 |
DataPreprocessing/load_diabetes.py | iosifidisvasileios/CumulativeCostBoosting | 0 | 21307 | <gh_stars>0
from __future__ import division
# import urllib2
import os, sys
import numpy as np
import pandas as pd
from collections import defaultdict
from sklearn import feature_extraction
from sklearn import preprocessing
from random import seed, shuffle
# sys.path.insert(0, '../../fair_classification/') # the code ... | 2.453125 | 2 |
python/scripts/copy_pin.py | ehabnaduvi/api-quickstart | 0 | 21308 | <filename>python/scripts/copy_pin.py
#!/usr/bin/env python
#
# Copying a pin is not representative of typical user behavior on Pinterest.
#
# This script is intended to demonstrate how to use the API to developers,
# and to provide functionality that might be convenient for developers.
# For example, it might be used a... | 3.09375 | 3 |
BL_ColorRamp4_MF.py | SpectralVectors/TransMat | 31 | 21309 | <reponame>SpectralVectors/TransMat
import unreal
BL_ColorRamp4 = unreal.AssetToolsHelpers.get_asset_tools().create_asset('BL_ColorRamp4', '/Engine/Functions/BLUI/', unreal.MaterialFunction, unreal.MaterialFunctionFactoryNew())
BL_ColorRamp4.set_editor_property("expose_to_library", True)
BL_ColorRamp4.set_editor_pr... | 1.867188 | 2 |
tools/log2csv.py | Haixing-Hu/lambda-tensorflow-benchmark | 0 | 21310 | import os
import re
import glob
import argparse
import pandas as pd
list_test = ['alexnet',
'inception3',
'inception4',
'resnet152',
'resnet50',
'vgg16']
# Naming convention
# Key: log name
# Value: ([num_gpus], [names])
# num_gpus: Since each log... | 2.09375 | 2 |
python/testData/keywordCompletion/noneInArgList.py | jnthn/intellij-community | 2 | 21311 | def foo(x=Non<caret>): | 1.320313 | 1 |
stellar_sdk/xdr/survey_response_body.py | Shaptic/py-stellar-base | 0 | 21312 | # This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
import base64
from xdrlib import Packer, Unpacker
from ..type_checked import type_checked
from .survey_message_command_type import SurveyMessageCommandType
from .topology_response_body import TopologyResponseBody
__all__ = ["S... | 2.21875 | 2 |
poll/migrations/0002_auto_20210114_2215.py | slk007/SahiGalat.com | 0 | 21313 | # Generated by Django 3.1.5 on 2021-01-14 22:15
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('poll', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Topic',
fields=[
('id', model... | 1.789063 | 2 |
Leetcode/Python/_1493.py | Xrenya/algorithms | 0 | 21314 | class Solution:
def longestSubarray(self, nums: List[int]) -> int:
k = 1
max_len, i = 0, 0
for j in range(len(nums)):
if nums[j] == 0:
k -= 1
if k < 0:
if nums[i] == 0:
k += 1
i += 1
max_... | 3.3125 | 3 |
setup.py | JakaKokosar/pysqlite3-binary | 0 | 21315 | <filename>setup.py
# -*- coding: ISO-8859-1 -*-
# setup.py: the distutils script
#
import os
import setuptools
import sys
from distutils import log
from distutils.command.build_ext import build_ext
from setuptools import Extension
# If you need to change anything, it should be enough to change setup.cfg.
PACKAGE_NAM... | 1.90625 | 2 |
gridder/gridder.py | PDFGridder/PDFGridder | 2 | 21316 | <reponame>PDFGridder/PDFGridder
#!/usr/bin/env python
import cairo
from .utils import hex_to_rgba, parse_unit
def parse_size(size):
"""take a size as str (es: 14px), return its value in px/pt as int
"""
if hasattr(size, 'isdigit'):
if size.isdigit():
return int(size)
return par... | 2.78125 | 3 |
wanikani_api/constants.py | peraperacafe/wanikani_api | 12 | 21317 | <filename>wanikani_api/constants.py
ROOT_WK_API_URL = "https://api.wanikani.com/v2/"
RESOURCES_WITHOUT_IDS = ["user", "collection", "report"]
SUBJECT_ENDPOINT = "subjects"
SINGLE_SUBJECT_ENPOINT = r"subjects/\d+"
ASSIGNMENT_ENDPOINT = "assignments"
REVIEW_STATS_ENDPOINT = "review_statistics"
STUDY_MATERIALS_ENDPOINT =... | 1.203125 | 1 |
utils/dataloader.py | Jiaqi0602/adversarial-attack-from-leakage | 9 | 21318 | <gh_stars>1-10
from inversefed import consts
import torch
from torchvision import datasets, transforms
class DataLoader:
def __init__(self, data, device):
self.data = data
self.device = device
def get_mean_std(self):
if self.data == 'cifar10':
mean, std = cons... | 2.484375 | 2 |
hintedhandoff_test.py | Ankou76ers/cassandra-dtest | 44 | 21319 | <gh_stars>10-100
import os
import time
import pytest
import logging
from cassandra import ConsistencyLevel
from dtest import Tester, create_ks
from tools.data import create_c1c2_table, insert_c1c2, query_c1c2
from tools.assertions import assert_stderr_clean
since = pytest.mark.since
ported_to_in_jvm = pytest.mark.po... | 1.984375 | 2 |
pre_definition/solve_caller.py | sr9000/stepik_code_task_baking | 0 | 21320 | <filename>pre_definition/solve_caller.py
from collections.abc import Iterable as ABCIterable
def call_with_args(func, args):
if isinstance(args, dict):
return func(**args)
elif isinstance(args, ABCIterable):
return func(*args)
else:
return func(args)
| 2.9375 | 3 |
wikipedia_test.py | pedrogengo/TopicBlob | 0 | 21321 | import wikipedia
from topicblob import TopicBlob
#get random wikipeida summaries
wiki_pages = ["Facebook","New York City","Barack Obama","Wikipedia","Topic Modeling","Python (programming language)","Snapchat"]
wiki_pages = ["Facebook","New York City","Barack Obama"]
texts = []
for page in wiki_pages:
text = ... | 3.328125 | 3 |
component/model/dmp_model.py | 12rambau/damage_proxy_maps | 1 | 21322 | <gh_stars>1-10
from sepal_ui import model
from traitlets import Any
class DmpModel(model.Model):
# inputs
event = Any(None).tag(sync=True)
username = Any(None).tag(sync=True)
password = Any(None).tag(sync=True)
| 1.6875 | 2 |
SaIL/envs/state_lattice_planner_env.py | yonetaniryo/SaIL | 12 | 21323 | #!/usr/bin/env python
"""An environment that takes as input databases of environments and runs episodes,
where each episode is a search based planner. It then returns the average number of expansions,
and features (if training)
Author: <NAME>
"""
from collections import defaultdict
import numpy as np
import os
from Sa... | 2.4375 | 2 |
opi_dragon_api/auth/__init__.py | CEAC33/opi-dragon-api | 0 | 21324 | from sanic_jwt import exceptions
class User:
def __init__(self, id, username, password):
self.user_id = id
self.username = username
self.password = password
def __repr__(self):
return "User(id='{}')".format(self.user_id)
def to_dict(self):
return {"user_id": self.... | 2.78125 | 3 |
tests/test_observable/test_dowhile.py | yutiansut/RxPY | 1 | 21325 | <filename>tests/test_observable/test_dowhile.py
import unittest
from rx.testing import TestScheduler, ReactiveTest
class TestDoWhile(ReactiveTest, unittest.TestCase):
def test_dowhile_always_false(self):
scheduler = TestScheduler()
xs = scheduler.create_cold_observable(
self.on_next(... | 2.671875 | 3 |
ZAP_Scripts/passive/14-4-2-api-content-disposition-header.py | YaleUniversity/ZAP_ASVS_Checks | 3 | 21326 | """
Script testing 14.4.2 control from OWASP ASVS 4.0:
'Verify that all API responses contain a Content-Disposition: attachment;
filename="api.json" header (or other appropriate filename for the content
type).'
The script will raise an alert if 'Content-Disposition' header is present but not follow the format - Cont... | 2.828125 | 3 |
server.py | Peopple-Shopping-App/mockserver | 1 | 21327 | import uvicorn
if __name__ == '__main__':
<<<<<<< HEAD
uvicorn.run('app.main:app', host='0.0.0.0', port=80)
=======
uvicorn.run('app.main:app', host='0.0.0.0', port=2323)
>>>>>>> c583e3d93c9b7f8e76ce1d676a24740b62ef3552
| 1.640625 | 2 |
9020/main.py | yeonghoey/baekjoon | 1 | 21328 | MAX_N = 10000 + 1
isprime = [True] * (MAX_N)
isprime[0] = False
isprime[1] = False
for i in range(2, MAX_N):
if not isprime[i]:
continue
for j in range(i+i, MAX_N, i):
isprime[j] = False
T = int(input())
for _ in range(T):
n = int(input())
for i in range(n//2, 1, -1):
if isprim... | 3.375 | 3 |
src/interview-cake/permutation-palindrome/test_permutation_palindrome.py | nwthomas/code-challenges | 1 | 21329 | <reponame>nwthomas/code-challenges
from permutation_palindrome import is_permutation_palindrome
import unittest
class TestIsPermutationPalindrome(unittest.TestCase):
def test_returns_true_if_possible_palindrome(self):
"""Returns true if a palindrome is possible with a given permutation of a string"""
... | 3.8125 | 4 |
sagemaker_tidymodels/tidymodels.py | tmastny/sagemaker-tidymodels | 3 | 21330 | <filename>sagemaker_tidymodels/tidymodels.py
from sagemaker.estimator import Framework
from sagemaker.model import FrameworkModel
from sagemaker.predictor import RealTimePredictor
import subprocess
def _run_command(command):
return (
subprocess.run(command.split(" "), stdout=subprocess.PIPE,)
.s... | 2.078125 | 2 |
articles/pdf2bib.py | kenbeese/articles | 4 | 21331 | # coding=utf-8
def pdf2text(pdf_path,encoding="ASCII7"):
import subprocess
import os.path
pdf_path = os.path.abspath(pdf_path)
subprocess.call(["pdftotext","-l","1","-enc",encoding,"-q",pdf_path])
text = os.path.splitext(pdf_path)[0] + ".txt"
return text
def pick_out_doi(txt):
import re
... | 3.0625 | 3 |
tensorflow/python/data/experimental/kernel_tests/serialization/textline_dataset_serialization_test.py | DanMitroshin/tensorflow | 4 | 21332 | # Copyright 2017 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/licenses/LICENSE-2.0
#
# Unless required by applica... | 1.867188 | 2 |
apps/news/forms.py | LishenZz/my_project | 0 | 21333 | #Author:<NAME>
from django import forms
from apps.forms import FormMixin
class PublicCommentForm(forms.Form,FormMixin):
#CharField字长在form可不定义,但是在model模型中必须定义
content=forms.CharField()
news_id=forms.IntegerField()
| 1.882813 | 2 |
data_preprocessing.py | hwRG/FastSpeech2-Pytorch-old-man_city | 0 | 21334 | ### Data Preprocessing
## 1. Json to Transcript
## 2. Aligner
## 3. Text Replace
from jamo import h2j
import json
import os, re, tqdm
import unicodedata
from tqdm import tqdm
import hparams as hp
name = hp.dataset
first_dir = os.getcwd()
transcript = name + '_transcript.txt'
dict_name = name + '_k... | 2.703125 | 3 |
cachet-tools/purge-cachet.py | thearifismail/black-box-tester | 0 | 21335 | #!/usr/bin/env python3
import requests
import os
import json
CACHET_HOSTNAME = os.environ.get("CACHET_HOSTNAME")
URL = f"https://{CACHET_HOSTNAME}/api/v1/components"
HEADERS = {
'X-Cachet-Token': os.environ.get("CACHET_TOKEN")
}
with requests.Session() as session:
session.headers.update(HEADERS)
respon... | 2.59375 | 3 |
astrophysics_toolset/utilities/tests/test_funcs.py | cphyc/astrophysics_toolset | 3 | 21336 | <reponame>cphyc/astrophysics_toolset
import numpy as np
from mpmath import besselj, mpf, pi, sqrt
from ..funcs import j1_over_x
@np.vectorize
def mpmath_jn_over_x(i, x):
xx = mpf(x)
if x == 0:
return float(1 / mpf(3))
else:
return float(sqrt(pi / mpf(2) / xx) * besselj(i + mpf("1/2"), xx)... | 1.992188 | 2 |
tools/isolate-run.py | France-ioi/taskgrader | 12 | 21337 | #!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
# Copyright (c) 2016 France-IOI, MIT license
#
# http://opensource.org/licenses/MIT
# This tool launches an isolated execution. It is intended as a wrapper around
# the execution of any command.
import argparse, os, sys
DEFAULT_EXECPARAMS = {
'timeLimitMs': 60000... | 2.609375 | 3 |
monitor/monitorlibs/sendemail.py | vaedit/- | 1 | 21338 | <reponame>vaedit/-<gh_stars>1-10
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import smtplib
from email.mime.text import MIMEText
from email.header import Header
#发送邮件函数
def smail(sub,body):
tolist = ["<EMAIL>", "<EMAIL>"]
cc = ["<EMAIL>", "<EMAIL>"]
sender = '管理员 <<EMAIL>>'
subject = sub
smtpserve... | 2.78125 | 3 |
submissions/abc146/f.py | m-star18/atcoder | 1 | 21339 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
from collections import deque
n, m = map(int, readline().split())
s = readline().rstrip().decode()[::-1]
index = 0
ans = deque([])
for i in range(n):
for j in range(m,... | 2.421875 | 2 |
src/tests/__init__.py | laichimirum/docker-appium-emulator | 8 | 21340 | """Unit test to test app."""
import os
from unittest import TestCase
import mock
from src import app
class TestApp(TestCase):
"""Unit test class to test other methods in the app."""
def test_valid_env(self):
key = 'ENV_1'
os.environ[key] = 'test'
app.get_or_raise(key)
del os... | 3.21875 | 3 |
tools/python-mock-server/python-mock-server.py | msmagnanijr/jboss-kie-modules | 8 | 21341 | #!/usr/bin/python3
import os
import sys
from http.server import HTTPServer, BaseHTTPRequestHandler
class MyHandler(BaseHTTPRequestHandler):
def do_GET(self):
# do not change paths
if self.path == '/apis/apps.openshift.io/v1/namespaces/testNamespace/deploymentconfigs?labelSelector=services.server... | 2.65625 | 3 |
test/nn/test_nonlinearities_fliprotations.py | steven-lang/e2cnn | 356 | 21342 | <gh_stars>100-1000
import unittest
from unittest import TestCase
from e2cnn.nn import *
from e2cnn.gspaces import *
import random
class TestNonLinearitiesFlipRotations(TestCase):
def test_dihedral_norm_relu(self):
N = 8
g = FlipRot2dOnR2(N)
r = FieldType(g, list(g.represent... | 2.46875 | 2 |
TestModule/AnonymousPlayerTest.py | INYEONGKIM/Quattro | 0 | 21343 | <filename>TestModule/AnonymousPlayerTest.py<gh_stars>0
import unittest
from QuattroComponents.Player import Anonymous_player
from QuattroComponents.Card import Card
from TestModule.GetMethodName import get_method_name_decorator
from collections import deque
def reset_player_attributes(anonymous: Anonymous_player):
... | 2.96875 | 3 |
octopus_deploy_swagger_client/models/phase_resource.py | cvent/octopus-deploy-api-client | 0 | 21344 | # coding: utf-8
"""
Octopus Server API
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: 2019.6.7+Branch.tags-2019.6.7.Sha.aa18dc6809953218c66f57eff7d26481d9b23d6a
Generated by: https://github.com/swagger-api... | 1.53125 | 2 |
src/cryptoadvance/specter/util/common.py | jonathancross/specter-desktop | 0 | 21345 | import re
def str2bool(my_str):
"""returns a reasonable boolean from a string so that "False" will result in False"""
if my_str is None:
return False
elif isinstance(my_str, str) and my_str.lower() == "false":
return False
elif isinstance(my_str, str) and my_str.lower() == "off":
... | 3.546875 | 4 |
pyspi/SPILike.py | grburgess/pyspi | 0 | 21346 | import collections
from typing import Optional
import numpy as np
from astromodels import Parameter, Model
from astromodels.functions.priors import Cosine_Prior, Uniform_prior
from threeML import PluginPrototype
from threeML.io.file_utils import sanitize_filename
from threeML.plugins.DispersionSpectrumLike import Dis... | 1.945313 | 2 |
dianna/visualization/image.py | cffbots/dianna | 0 | 21347 | import matplotlib.pyplot as plt
def _determine_vmax(max_data_value):
vmax = 1
if max_data_value > 255:
vmax = None
elif max_data_value > 1:
vmax = 255
return vmax
def plot_image(heatmap, original_data=None, heatmap_cmap=None, data_cmap=None, show_plot=True, output_filename=None): # ... | 3.5625 | 4 |
models/lenet.py | davidstutz/random-bit-error-robustness | 0 | 21348 | <reponame>davidstutz/random-bit-error-robustness<filename>models/lenet.py<gh_stars>0
import torch
import common.torch
from .classifier import Classifier
from .utils import get_normalization2d, get_activation
class LeNet(Classifier):
"""
LeNet classifier.
"""
def __init__(self, N_class, resolution=(1,... | 2.5625 | 3 |
project/server/main/modules/__init__.py | ardikabs/dnsmanager | 1 | 21349 | """ All Available Module on Server Belong to Here """
AVAILABLE_MODULES = (
"api",
)
def init_app(app, **kwargs):
from importlib import import_module
for module in AVAILABLE_MODULES:
import_module(
f".{module}",
package=__name__
).init_app(app, **kwargs) | 1.992188 | 2 |
slixmpp/plugins/xep_0380/eme.py | cnngimenez/slixmpp | 0 | 21350 | <reponame>cnngimenez/slixmpp<filename>slixmpp/plugins/xep_0380/eme.py
"""
Slixmpp: The Slick XMPP Library
Copyright (C) 2016 <NAME> <<EMAIL>>
This file is part of Slixmpp.
See the file LICENSE for copying permission.
"""
import logging
import slixmpp
from slixmpp.stanza import Message
from slixmpp.xm... | 1.929688 | 2 |
JSS Users Cleanup/setup.py | killahquam/JAMF | 34 | 21351 | #!/usr/bin/python
#<NAME> 2015
#Setup script to install the needed python modules
#Installs kn/Slack and python-jss modules
#We assume you have Git installed.......
import subprocess
import os
import sys
import shutil
clone_jss = subprocess.check_output(['git','clone','git://github.com/sheagcraig/python-jss.git'])
clo... | 2.46875 | 2 |
sharpy/linear/utils/sselements.py | ACea15/sharpy | 80 | 21352 | <filename>sharpy/linear/utils/sselements.py
"""
Linear State Space Element Class
"""
class Element(object):
"""
State space member
"""
def __init__(self):
self.sys_id = str() # A string with the name of the element
self.sys = None # The actual object
self.ss = None # The ... | 2.84375 | 3 |
pt_mesh_renderer/RasterizeTriangles.py | FuxiCV/pt_mesh_renderer | 61 | 21353 | # Copyright 2017 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 2.328125 | 2 |
datamining_assignments/datamining_assiment_3/nmf.py | xuerenlv/PaperWork | 1 | 21354 | # -*- coding: utf-8 -*-
'''
Created on Oct 27, 2015
@author: nlp
'''
import numpy as np
import math
# nmf 聚类主体
def nmf(file_list, k):
X = np.array(file_list).transpose()
m_x, n_x = X.shape
# 随机生成初始矩阵
U = np.random.rand(m_x, k)
V = np.random.rand(n_x, k)
is_convergence = False
count =... | 2.546875 | 3 |
heat2d.py | atk91/heat-batman | 0 | 21355 | <gh_stars>0
#!/usr/bin/env python
import numpy as np
import scipy.linalg as la
import matplotlib.pyplot as plt
from scipy.sparse.linalg import cgs
from scipy.sparse import csr_matrix
fig = plt.figure()
t_min = 0.0
t_max = 10.0
x_min = -10.0
x_max = 10.0
y_min = -10.0
y_max = 10.0
a = 1.0
c = 5.0
m = 400
n = 100
de... | 2.5 | 2 |
DQN DDQN Dueling/network.py | eayvali/DeepRL | 2 | 21356 | # -*- coding: utf-8 -*-
"""
Created on Sun Jan 19 23:19:43 2020
@author: elif.ayvali
"""
import torch
import torch.nn as nn
import torch.nn.functional as F
from collections import OrderedDict
class deep_Q_net(nn.Module):
"""Actor (Policy) Model."""
def __init__(self, state_size, action_size, seed):
... | 2.6875 | 3 |
bin/meyer.py | leipzig/meripseqpipe | 13 | 21357 | <gh_stars>10-100
# -*- coding: utf-8 -*-
"""
Created on Tue Apr 23 18:53:30 2019
@author: zky
"""
from sys import argv
from math import log
from scipy import stats
input_bin25_file = argv[1]
ip_bin25_file = argv[2]
input_total_reads_count = int(argv[3])
ip_total_reads_count = int(argv[4])
peak_windows_number = int(arg... | 2.296875 | 2 |
setup.py | jimbydamonk/jenkins-job-builder-addons | 8 | 21358 | <filename>setup.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools.command.test import test as TestCommand
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
with open('README.rst') as readme_file:
readme = readme_file.read()
with open('HISTORY.rst') as ... | 1.84375 | 2 |
arrp/utils/sanitize.py | LucaCappelletti94/arrp_dataset | 0 | 21359 | import numpy as np
import pandas as pd
from typing import Tuple, Dict
from .load_csv import load_raw_classes, load_raw_epigenomic_data, load_raw_nucleotides_sequences
from .store_csv import store_raw_classes, store_raw_epigenomic_data, store_raw_nucleotides_sequences
from auto_tqdm import tqdm
def drop_unknown_datapoi... | 2.671875 | 3 |
plugin.video.plexodus/resources/lib/indexers/fanarttv.py | MR-Unknown-Cm/addons | 1 | 21360 | # -*- coding: utf-8 -*-
'''
plexOdus Add-on
'''
import json
from resources.lib.modules import client
from resources.lib.modules import control
user = control.setting('fanart.tv.user')
if user == '' or user is None:
user = 'cf0ebcc2f7b824bd04cf3a318f15c17d'
headers = {'api-key': '3eb5ed2c401a206391ea8d1a031... | 2.265625 | 2 |
nuqql/conversation/helper.py | hwipl/nuqql | 3 | 21361 | """
nuqql conversation helpers
"""
import datetime
import logging
from typing import TYPE_CHECKING
import nuqql.win
from .conversation import CONVERSATIONS
from .logmessage import LogMessage
if TYPE_CHECKING: # imports for typing
# pylint: disable=cyclic-import
from nuqql.backend import Backend # noqa
... | 2.375 | 2 |
tests/gcs_test.py | rishi1111/vaex | 1 | 21362 | import vaex
import pytest
@pytest.mark.skipif(vaex.utils.devmode, reason='runs too slow when developing')
def test_gcs():
df = vaex.open('gs://vaex-data/testing/xys.hdf5?cache=false&token=anon')
assert df.x.tolist() == [1, 2]
assert df.y.tolist() == [3, 4]
assert df.s.tolist() == ['5', '6']
df = ... | 1.984375 | 2 |
arcutils/const.py | zhuitrec/django-arcutils | 0 | 21363 | <reponame>zhuitrec/django-arcutils
"""Constants."""
# A ``None``-ish constant for use where ``None`` may be a valid value.
NOT_SET = type('NOT_SET', (), {
'__bool__': (lambda self: False),
'__str__': (lambda self: 'NOT_SET'),
'__repr__': (lambda self: 'NOT_SET'),
'__copy__': (lambda self: self),
})()
... | 2.171875 | 2 |
students/K33422/Elizaveta_Makhotina/labs/lab1/3/server_html.py | agentofknowledge/ITMO_ICT_WebDevelopment_2020-2021 | 4 | 21364 | <gh_stars>1-10
import socket
print("Waiting for connections...")
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.bind(('', 9090))
sock.listen()
n_sock, addr = sock.accept()
print("Client connected! Sending HTTP-message")
conn.send(
b"HTTP/1.0 200 OK\nContent-Type: text/html\n\n" + open("index.ht... | 2.875 | 3 |
tests/test_private_storage.py | glasslion/django-qiniu-storage | 209 | 21365 | # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals, print_function
from datetime import datetime
import os
from os.path import dirname, join
import sys
import time
import unittest
import uuid
import logging
LOGGING_FORMAT = '\n%(levelname)s %(asctime)s %(message)s'
logging.basicConfig(lev... | 1.960938 | 2 |
inference_sagemaker_simple.py | benayas1/MNIST-deployment | 0 | 21366 | # This file implements functions model_fn, input_fn, predict_fn and output_fn.
# Function model_fn is mandatory. The other functions can be omitted so the standard sagemaker function will be used.
# An alternative to the last 3 functions is to use function transform_fn(model, data, input_content_type, output_content_ty... | 2.75 | 3 |
hw/scripts/__main__.py | jonasblixt/mongoose | 4 | 21367 | # -*- coding: utf-8 -*-
import kicad
import model
from stackups import JLCPCB6Layers
#from dram import lp4
# IMX8MM
# Diff pairs should be matched within 1ps
# CK_t/CK_c max 200 ps
# CA[5:0]
# CS[1:0] min: CK_t - 25ps, max: CK_t + 25ps
# CKE[1:0]
# DQS0_t/DQS0_c min: CK_t - 85ps, max CK_t + 85ps
# DQ[7:0]... | 1.960938 | 2 |
farms2face/subscriptions/views.py | dev1farms2face/f2f | 0 | 21368 | <reponame>dev1farms2face/f2f
from django.shortcuts import render
# Create your views here.
def subscribe(request):
return render(request, "subscribe.html",
{'data': {}})
| 1.554688 | 2 |
scripts/runOptimizer.py | sschulz365/PhC_Optimization | 2 | 21369 | <reponame>sschulz365/PhC_Optimization
#<NAME>, 2015
import random
import numpy
import subprocess
import constraints
from experiment import Experiment
from objectiveFunctions import WeightedSumObjectiveFunction, IdealDifferentialObjectiveFunction
from waveGuideMPBOptimizer import differentialEvolution, createPopulation,... | 2.453125 | 2 |
packages/w3af/w3af/core/data/url/handlers/cookie_handler.py | ZooAtmosphereGroup/HelloPackages | 3 | 21370 | <gh_stars>1-10
"""
cookie_handler.py
Copyright 2006 <NAME>
This file is part of w3af, http://w3af.org/ .
w3af is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation version 2 of the License.
w3af is distributed in the... | 2.125 | 2 |
setup.py | jigyasudhingra/music-recommendation-system | 2 | 21371 | import os
import urllib.request
from zipfile import ZipFile
HOME_DIRECTORY = os.path.join('datasets','raw')
ROOT_URL = 'https://os.unil.cloud.switch.ch/fma/fma_metadata.zip'
if not os.path.isdir(HOME_DIRECTORY):
os.makedirs(HOME_DIRECTORY)
zip_path = os.path.join(HOME_DIRECTORY, 'data.zip')
urllib.request.urlretr... | 2.828125 | 3 |
src/thesis/parsers/utils.py | emanuelevivoli/2021-Master-Thesis-UNIFI | 1 | 21372 | from thesis.parsers.classes import Args
def split_args(args: Args):
dataset_args = args.datatrain
training_args = args.training
model_args = args.model
embedding_args = args.embedds
visual_args = args.visual
run_args = args.runs
log_args = args.logs
return dataset_args, training_args... | 2.640625 | 3 |
tensorflow_examples/lite/model_maker/core/task/custom_model.py | Abhi1code/FaceMaskDetection | 1 | 21373 | # Copyright 2019 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/licenses/LICENSE-2.0
#
# Unless required by applica... | 2.21875 | 2 |
src/architectures/nmp/stacked_nmp/stacked_fixed_nmp.py | isaachenrion/jets | 9 | 21374 | import os
import logging
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from src.architectures.readout import READOUTS
from src.architectures.embedding import EMBEDDINGS
from .attention_pooling import POOLING_LAYERS
from ..message_passing import MP_LAYERS
from ..... | 1.960938 | 2 |
slixmpp/plugins/xep_0122/data_validation.py | anirudhrata/slixmpp | 86 | 21375 | <reponame>anirudhrata/slixmpp
from slixmpp.xmlstream import register_stanza_plugin
from slixmpp.plugins import BasePlugin
from slixmpp.plugins.xep_0004 import stanza
from slixmpp.plugins.xep_0004.stanza import FormField
from slixmpp.plugins.xep_0122.stanza import FormValidation
class XEP_0122(BasePlugin):
"""
... | 1.585938 | 2 |
q037.py | sjf/project_euler | 0 | 21376 | #!/usr/bin/env python3
import lib
N=1000000
sieve = lib.get_prime_sieve(N)
primes = lib.primes(N, sieve)
primes = primes[4:]
def is_truncatable(n):
num = n
c = 0
while num:
if not sieve[num]:
return False
num = int(num / 10)
c += 1
while c:
num = n % 10**c
if not sieve[num]:
r... | 3.234375 | 3 |
StationeersSaveFileDebugTools.py | lostinplace/StationeersSaveFileDebugTools | 0 | 21377 | <reponame>lostinplace/StationeersSaveFileDebugTools
import click
@click.group()
def cli():
pass
@cli.command("restore_atmo")
@click.argument('currentFile')
@click.argument('backupFile')
@click.argument('newFilePath')
def restore_atmo(current_file, backup_file, new_file_path):
from Utils.AtmoFileProcessing.R... | 2.4375 | 2 |
RL/get_depthmaps.py | RECON-Labs-Inc/svox2 | 0 | 21378 | <reponame>RECON-Labs-Inc/svox2
import sys
from pathlib import Path
from datetime import datetime
import argparse
import json
import torch
from torchvision.utils import save_image
import torchvision
import numpy as np
import matplotlib.pyplot as plt
from sklearn.cluster import KMeans
from sklearn.metrics import pairw... | 1.789063 | 2 |
monty/exts/info/global_source.py | onerandomusername/monty-python | 20 | 21379 | <filename>monty/exts/info/global_source.py
from __future__ import annotations
import os
from typing import TYPE_CHECKING, Final, List
from urllib.parse import urldefrag
import disnake
from disnake.ext import commands, tasks
from monty.log import get_logger
from monty.utils.helpers import encode_github_link
from mont... | 2.125 | 2 |
grr/core/grr_response_core/lib/rdfvalue_test.py | khanhgithead/grr | 4,238 | 21380 | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""Tests for utility classes."""
import datetime
import sys
import unittest
from absl import app
from absl.testing import absltest
from grr_response_core.lib import rdfvalue
from grr.test_lib import test_lib
long_string = (
"迎欢迎\n"
"Lorem ipsum dolor sit amet... | 2.140625 | 2 |
src/main/python/server/test.py | areichmann-tgm/client_travis | 0 | 21381 | <filename>src/main/python/server/test.py
import pytest
from server import rest
@pytest.fixture
def client():
rest.app.testing = True
#rest.app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///server.MyStudents'
client = rest.app.test_client()
yield client
def test_get(client):
res = client.get('... | 2.421875 | 2 |
helper-scripts/instrnocombine.py | felixaestheticus/realcode-validation | 0 | 21382 | #combine.py, combines available dictionaries into one, and generates csv file for latex
#f = open('dict_random')
mem_ops = 'MOVS','MOV','LDR','LDRH','LDRB','LDRSH','LDRSB','LDM','STR','STRH','STRB','STM'
ari_ops = 'ADDS','ADD','ADC','ADCS','ADR','SUBS','SUB','SBCS','RSBS','MULS','MUL','RSB','SBC'
com_ops = 'CMP','CM... | 1.945313 | 2 |
ip_client.py | HuiiBuh/checkers-master | 1 | 21383 | <gh_stars>1-10
#from src.piclient import PiClient
from src.streamclient import StreamClient
import math
options = {
"boarddetector": {
"prepare": {
"resize": [512, 512]
},
"corners": {
"maxcorners": 500,
"qualitylevel": 0.01,
"mindistance": 20... | 2.546875 | 3 |
registration_eval/different_days/dd_compute_dense_transformation_error.py | mirestrepo/voxels-at-lems | 2 | 21384 | #!/usr/bin/env python
# encoding: utf-8
"""
compute_transformation_error.py
Created by <NAME> on 2012-09-24.
Copyright (c) 2012 . All rights reserved.
This script computes the distances betweeen an estimated similarity transformation and its ground trutrransformation is used to transform a "source" coordinate system i... | 2.359375 | 2 |
migrations/versions/be21086640ad_country_added.py | anjinkristou/assistor | 1 | 21385 | <filename>migrations/versions/be21086640ad_country_added.py
"""Country added
Revision ID: be21086640ad
Revises: <PASSWORD>
Create Date: 2021-11-09 15:34:04.306218
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'be21086640ad'
down_revision = '<PASSWORD>'
branch... | 1.679688 | 2 |
pyxrd/scripts/generate_default_phases.py | PyXRD/pyxrd | 27 | 21386 | #!/usr/bin/python
# coding=UTF-8
# ex:ts=4:sw=4:et=on
# Copyright (c) 2013, <NAME>
# All rights reserved.
# Complete license can be found in the LICENSE file.
import os
from pyxrd.data import settings
from pyxrd.project.models import Project
from pyxrd.phases.models import Component, Phase
def generate_expandables(... | 2.234375 | 2 |
data/kaggle_python/interview_prac/FizzBuzz.py | MohanKrishna-RC/Python-Necessities | 0 | 21387 | <gh_stars>0
import sys
"""
Example :
Input:
2 (Test cases)
3 (Size of array)
0 1 1 (input)
3
0 1 2
"""
# To store no of test cases here (2).
# To store input here (0 1 1) and (0 1 2).
t = int(sys.stdin.readline())
# print(t)
l = []
while t:
#To store the size of array here (3).
n = int(sys.stdin.r... | 3.609375 | 4 |
wikipediabase/persistentkv.py | fakedrake/WikipediaBase | 1 | 21388 | """
Some persistent maps (gdbm) require special encoding of keys
and/or values. This is an abstraction for these kinds of quirks.
"""
from itertools import imap
import collections
import gdbm as dbm
import json
from sqlitedict import SqliteDict
import os
class EncodedDict(collections.MutableMapping):
"""
Sub... | 2.765625 | 3 |
SlidingWindows/Leetcode132.py | Rylie-W/LeetRecord | 0 | 21389 | class Solution:
def minCut(self, s: str) -> int:
dp=self.isPal(s)
return self.bfs(s,dp)
def isPal(self,s):
dp=[[False for i in s] for i in s]
for i in range(len(s)):
dp[i][i]=True
if i+1<len(s):
dp[i][i+1]=True if s[i]==s[i+1] else False
... | 3.015625 | 3 |
widgets/component.py | peskaf/ramAIn | 0 | 21390 | from PySide6.QtGui import QColor
from PySide6.QtWidgets import QFrame, QHBoxLayout, QWidget
from PySide6.QtCore import Qt, QSettings, QEvent
from utils import colors
import pyqtgraph as pg
import numpy as np
class ScrollablePlotWidget(pg.PlotWidget):
"""
Subclass of `pg.PlotWidget` that overrides `wheelEven... | 2.90625 | 3 |
Step 4 - Implement the tflite for raspberry pi/godlike_tflite_cam_script.py | monacotime/4.IoT-project-sem-5 | 0 | 21391 | <reponame>monacotime/4.IoT-project-sem-5
### IT WORKS BOIISSS WE DID IT!!!!###
#-------------------------------------------------------------
#Imports
#-------------------------------------------------------------
import tensorflow as tf
import numpy as np
from PIL import Image
import cv2
import colorsys
import rando... | 1.867188 | 2 |
maskrcnn_benchmark/modeling/backbone/res2net_builder.py | koseimori/Res2Net-maskrcnn | 31 | 21392 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
from collections import OrderedDict
from torch import nn
from maskrcnn_benchmark.modeling import registry
from maskrcnn_benchmark.modeling.make_layers import conv_with_kaiming_uniform
from . import fpn as fpn_module
from . import res2net
@regis... | 1.898438 | 2 |
code/tmp_rtrip/test/memory_watchdog.py | emilyemorehouse/ast-and-me | 24 | 21393 | """Memory watchdog: periodically read the memory usage of the main test process
and print it out, until terminated."""
import os
import sys
import time
try:
page_size = os.sysconf('SC_PAGESIZE')
except (ValueError, AttributeError):
try:
page_size = os.sysconf('SC_PAGE_SIZE')
except (ValueError, Attr... | 2.75 | 3 |
tests/conftest.py | charles-cooper/crvfunder | 6 | 21394 | <gh_stars>1-10
import pytest
pytest_plugins = ["fixtures.accounts", "fixtures.deployments"]
def pytest_sessionfinish(session, exitstatus):
if exitstatus == pytest.ExitCode.NO_TESTS_COLLECTED:
# we treat "no tests collected" as passing
session.exitstatus = pytest.ExitCode.OK
@pytest.fixture(auto... | 1.804688 | 2 |
sdk/python/pulumi_databricks/permissions.py | pulumi/pulumi-databricks | 0 | 21395 | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from . import ... | 1.507813 | 2 |
file/txt2bin.py | QPointNotebook/PythonSample | 0 | 21396 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from file.file import file
class txt2bin( file ):
def read( self, file ):
datas = []
with open( file, 'r', encoding='utf-8' ) as f:
lines = f.readlines()
for line in lines:
data = line.... | 3.4375 | 3 |
PGPs_tensorflow/Examples/Airline.py | maziarraissi/ParametricGP | 43 | 21397 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: <NAME>
"""
import sys
sys.path.insert(0, '../PGP/')
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from parametric_GP import PGP
if __name__ == "__main__":
# Import the data
data = pd.read_pickle('airline.pickle')
... | 2.65625 | 3 |
django_project/proj/settings/local.py | robabram/Quickstart-Secure-Django-Template | 9 | 21398 | <reponame>robabram/Quickstart-Secure-Django-Template<gh_stars>1-10
#
# Author: <NAME> <<EMAIL>>
#
# This file is subject to the terms and conditions defined in the
# file 'LICENSE', which is part of this source code package.
#
import os
from proj.settings.base import *
#
# Logging
#
LOGGING = {
'version': 1,
... | 1.765625 | 2 |
pyfos/utils/system_security/seccertmgmt_show.py | madhavinaiduprathap/pyfosbrocade | 44 | 21399 | #!/usr/bin/env python3
# Copyright 2018 Brocade Communications Systems LLC. 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 also obtain a copy of the License at
# http://www.apache.org/licenses/LICENS... | 2.234375 | 2 |