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 |
|---|---|---|---|---|---|---|
auglichem/test/test_molecule.py | BaratiLab/AugLiChem | 16 | 44400 | <gh_stars>10-100
import sys
sys.path.append(sys.path[0][:-14])
import shutil
import numpy as np
import warnings
from tqdm import tqdm
import torch
from torch_geometric.data import Data as PyG_Data
from auglichem.molecule import RandomAtomMask, RandomBondDelete, Compose, OneOf, MotifRemoval
from auglichem.molecule.da... | 1.976563 | 2 |
Cleaning/Readings/readings_clean.py | aliasger3008/GWL-analysis | 0 | 44401 | <gh_stars>0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Dec 5 02:49:34 2021
@author: aliasger
"""
import pandas as pd
meta_data = pd.read_csv("/Users/aliasger/Desktop/Github/GWL-time-series-analysis/Scraping/scrape_meta_data.csv")
meta_data = meta_data.to_dict()
meta_data_id = meta_data["ID"]... | 2.515625 | 3 |
dicer/query_results.py | thehyve/transmart-hyper-dicer | 3 | 44402 | from dicer.transmart import Hypercube, TreeNodes, Dimensions, Studies, RelationTypes, Relations
class QueryResults:
def __init__(self,
observations: Hypercube,
tree_nodes: TreeNodes,
dimensions: Dimensions,
studies: Studies,
rela... | 2.1875 | 2 |
src/clophfit/old/dil_correction.py | darosio/ClopHfit | 0 | 44403 | #!/usr/bin/python
#
import argparse
import os
import pandas as pd
corr = {'pH': [1, 1.02, 1.04, 1.06, 1.08, 1.1, 1.12],
'cl': [1.000000, 1.017857, 1.035714, 1.053571, 1.071429, 1.089286,
1.107143, 1.160714, 1.196429]}
corr = {'pH': [1, 1.02, 1.04, 1.06, 1.08, 1.1],
'cl': [1.000000, 1.... | 2.765625 | 3 |
src/bot/cocoa/src/basic/systems/cmd_system.py | s-akanksha/DialoGraph_ICLR21 | 12 | 44404 | from system import System
from src.basic.sessions.cmd_session import CmdSession
class CmdSystem(System):
def __init__(self):
super(CmdSystem, self).__init__()
@classmethod
def name(cls):
return 'cmd'
def new_session(self, agent, kb):
return CmdSession(agent, kb)
| 2.75 | 3 |
Graph/Solutions_Three.py | daniel-zeiler/potential-happiness | 0 | 44405 | <reponame>daniel-zeiler/potential-happiness
import collections
import heapq
from typing import List
def all_paths_source_to_target(graph):
result = []
def traverse(node, path_so_far, visited):
if node == len(graph) - 1:
result.append(path_so_far)
else:
for adjacent in ... | 3.328125 | 3 |
main.py | romuloschiavon/OnlineGameStore | 0 | 44406 | <gh_stars>0
##################################################################
#! !#
#! !#
#! MÓDULO PRINCIPAL !#
#! ... | 3.4375 | 3 |
timeclock/logic/controller.py | mikejarrett/company-time-clock | 0 | 44407 | <reponame>mikejarrett/company-time-clock
# -*- coding: utf-8 -*-
"""
Classes that control the "punching in" and "punching out" to keep track of
time, tasks and thing else that needs to be tracked via time
"""
from datetime import datetime, timedelta
import logging
from sqlalchemy import or_
from sqlalchemy.orm import ... | 2.78125 | 3 |
flask_app/main.py | SamuelHoward/open-source-platform | 0 | 44408 | # Import necessary modules
from flask import render_template, request, redirect, url_for, flash, Blueprint
from flask_app import app, db
from flask_app.decorators import check_confirmed
from flask_app.models import *
from flask_login import login_required, current_user
from sqlalchemy import or_, and_, func
import rand... | 2.34375 | 2 |
pyschism/param/schout.py | pmav99/pyschism | 0 | 44409 | from datetime import timedelta
import logging
from typing import Union
from pyschism.enums import (
IofHydroVariables,
IofDvdVariables,
IofWwmVariables,
IofGenVariables,
IofAgeVariables,
IofSedVariables,
IofEcoVariables,
IofIcmVariables,
IofCosVariables,
IofFibVariables,
Iof... | 2.34375 | 2 |
test/unit/test_fastly.py | alphagov/collectd-cdn | 2 | 44410 | <reponame>alphagov/collectd-cdn
from ..helpers import *
import json
import copy
import datetime
class TestFastly(object):
def setup(self):
self.collectd = MagicMock()
self.modules = patch.dict('sys.modules', {'collectd': self.collectd})
self.modules.start()
from collectd_cdn impor... | 2.15625 | 2 |
pyfr/backends/base/types.py | jappa/PyFR | 0 | 44411 | # -*- coding: utf-8 -*-
from abc import ABCMeta, abstractmethod, abstractproperty
from collections import Sequence
import numpy as np
class MatrixBase(object):
__metaclass__ = ABCMeta
_base_tags = set()
@abstractmethod
def __init__(self, backend, ioshape, iopacking, tags):
self.backend = ... | 2.828125 | 3 |
src/coloring/remove_graphics.py | Nazime/coloring | 22 | 44412 | import re
from typing import List
from .consts import *
# =================== #
# INTERNALS FUNCTIONS #
# =================== #
def my_re_escape(text):
escape_char = r"[]"
returned_text = ""
for c in text:
if c in escape_char:
returned_text += "\\"
returned_text += c
retur... | 3.4375 | 3 |
tests/rules/test_gcloud_cli.py | ronandoolan2/thefuck | 0 | 44413 | <reponame>ronandoolan2/thefuck<gh_stars>0
import pytest
from thefuck.rules.gcloud_cli import match, get_new_command
from thefuck.types import Command
no_suggestions = '''\
ERROR: (gcloud) Command name argument expected.
'''
misspelled_command = '''\
ERROR: (gcloud) Invalid choice: 'comute'.
Usage: gcloud [optional f... | 2.234375 | 2 |
app.py | AbhijithGanesh/Flask-HTTP-Server | 0 | 44414 | from flask import Flask,render_template as render, request
from models import *
app = Flask(__name__,template_folder='./templates')
@app.route('/GETPage',methods = ['GET'])
def Gpage():
return f"You have landed on the page which allows the {request.method} method."
@app.route('/POSTPage', methods = ['GET','P... | 2.75 | 3 |
locations.py | dragonfly-ai/MineCraft-pi-py-pie | 0 | 44415 | server = "uri.pi"
port = 4711
# well World
home = Vec3(-66.9487,7.0,-39.5313)
| 1.257813 | 1 |
Giveme5W1H/examples/datasets/news_cluster/data_fixer.py | bkrrr/Giveme5W | 410 | 44416 | <reponame>bkrrr/Giveme5W
import glob
"""
this script is fixing errors found in the data, after processing
"""
# final fixes for known errors
for filepath in glob.glob('output/*.json'):
# Read in the file
with open(filepath, 'r') as file:
filedata = file.read()
# AIDA has a wrong URL for the D... | 3.015625 | 3 |
supervised_learning/0x08-deep_cnns/4-main.py | kyeeh/holbertonschool-machine_learning | 0 | 44417 | <filename>supervised_learning/0x08-deep_cnns/4-main.py
#!/usr/bin/env python3
import tensorflow.keras as K
resnet50 = __import__('4-resnet50').resnet50
if __name__ == '__main__':
model = resnet50()
model.summary()
| 1.828125 | 2 |
catlaser/raspberryPi/laser_driver/driver_loop.py | boonepeter/cat-laser | 0 | 44418 | <reponame>boonepeter/cat-laser<gh_stars>0
# Raspberry Pi Cat Laser Driver
# This code controls the laser pointer servos to target the laser at different
# locations. Make sure to modify the MQTT_SERVER variable below so that it points
# to the name or IP address of the host computer for the cloud server VM (i.e. the
#... | 2.84375 | 3 |
KnowledgeMapping/SpiderExp/1-Code/law_site/sign_in_class.py | nickliqian/ralph_doc_to_chinese | 8 | 44419 | <reponame>nickliqian/ralph_doc_to_chinese
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import requests
from lxml import etree
import time
import re
from fateadm_api import get_value, roll_back_order
class Sign2Download(object):
def __init__(self, key_word, province_name, start_page, size, judgeDateBegin, judgeDateEn... | 2.234375 | 2 |
app/core/db.py | oxfn/owtest | 0 | 44420 | <filename>app/core/db.py
import logging
from typing import Iterable, Type
from bson import ObjectId
from fastapi import Depends
from motor.core import AgnosticClient, AgnosticCollection, AgnosticDatabase
from motor.motor_asyncio import AsyncIOMotorClient
from pymongo.results import InsertOneResult
from app.models imp... | 2.125 | 2 |
0104/test5.py | eto/study | 0 | 44421 | # file handling
# 1) without using with statement
file = open('t1.txt', 'w')
file.write('hello world !')
file.close()
# 2) without using with statement
file = open('t2.txt', 'w')
try:
file.write('hello world')
finally:
file.close()
# 3) using with statement
with open('t3.txt', 'w') as file:
file.write('h... | 3.890625 | 4 |
plbmng/utils/logger.py | ogajduse/plbmng | 0 | 44422 | <reponame>ogajduse/plbmng
import logging
import sys
from loguru import logger as base_logger
logger = base_logger
def init_logger() -> None:
"""Initialize logger, set log format and the base logging level."""
global logger
logger.remove()
logger.add(
sink=sys.stdout,
level=logging.IN... | 2.5 | 2 |
src/orion/core/cli/frontend.py | dendisuhubdy/evolve | 1 | 44423 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# pylint: disable=too-few-public-methods
"""
Web application endpoint
========================
Starts an http endpoint to serve requests
"""
import logging
import mimetypes
import os
import site
import sys
import falcon
from gunicorn.app.base import BaseApplication
logg... | 2.203125 | 2 |
tinkerbell/app/make.py | plang85/tinkerbell | 0 | 44424 | <gh_stars>0
import numpy as np
import tinkerbell.domain.point as tbdpt
import tinkerbell.domain.make as tbdmk
def exponential_decline(y_i, d, x):
"""
Parameters
----------
y_i: float
Start value.
d: float
Decline rate (positive).
x: float
Independent variable.
"""
... | 2.40625 | 2 |
scripts/keypoints/demo.py | gachiemchiep/gluon-cv | 0 | 44425 | from __future__ import division
import argparse, logging, os, math, tqdm
import numpy as np
import mxnet as mx
from mxnet import gluon, nd, image
from mxnet.gluon.data.vision import transforms
import matplotlib.pyplot as plt
import gluoncv as gcv
from gluoncv import data
from gluoncv.data import mscoco
from gluoncv.... | 2.125 | 2 |
src/obmak_debug.py | jeppeter/py-obcode | 0 | 44426 | #! /usr/bin/env python
import sys
import os
import extargsparse
import re
import time
##importdebugstart
sys.path.append(os.path.abspath(os.path.dirname(__file__)))
from strparser import *
from filehdl import *
from fmthdl import *
from extract_ob import *
from obmaklib import *
##importdebugend
REPLACE_IMPORT_LIB=1... | 2.1875 | 2 |
changePositionToIndexUpstream.py | oicr-gsi/bam-statistics | 0 | 44427 | #!/usr/bin/python
## my upstream target intervals were of size 1000 each.
import sys
# use stdin if stdin is full
if not sys.stdin.isatty():
indexFile = sys.stdin
#otherwise, read from input
else:
try:
input_file = sys.argv[1]
except IndexError:
message = 'need filename as first argument if stdin is not ful... | 2.984375 | 3 |
engine/graphics/tests/test_cross_box.py | codehearts/pickles-fetch-quest | 3 | 44428 | from ..cross_box import CrossBox
from unittest.mock import Mock, patch
from pyglet.gl import GL_LINES
import unittest
class TestCrossBox(unittest.TestCase):
"""Test rendering of cross box graphics."""
def setUp(self):
"""Provides the following to all tests:
* ``self.rectangle``: Mock rectang... | 2.9375 | 3 |
boolmininfo/two_input/two_input_canalization.py | godzilla-but-nicer/boolmininfo | 0 | 44429 | import pandas as pd
from tqdm import tqdm
from ..binarize import to_binary
from cana.boolean_node import BooleanNode
# set up variables
n_inputs = 2**2
n_rules = 2**(2**2)
df_dict = []
for rule in tqdm(range(n_rules)):
canal = {} # becomes row of dataframe
arr = to_binary(rule, digits=4)
print(arr)
... | 2.59375 | 3 |
telethon/default.py | yeung1704/Telethon | 1 | 44430 | <reponame>yeung1704/Telethon
"""
Sentinel module to signify that a parameter should use its default value.
Useful when the default value or ``None`` are both valid options.
"""
| 1.359375 | 1 |
p5lib/diagManager.py | panwalas/SDC-P5 | 1 | 44431 | <reponame>panwalas/SDC-P5<gh_stars>1-10
#!/usr/bin/python
"""
diagManager.py: version 0.1.0
History:
2017/01/29: coding style phase1:
reformat to python-guide.org code style
http://docs.python-guide.org/en/latest/writing/style/
which uses PEP 8 as a base: http://pep8.org/.
2017/01/0... | 2.359375 | 2 |
resources/python/KemendagriKTP/main.py | freezyoff/kosan-server | 0 | 44432 | <reponame>freezyoff/kosan-server
import os
import sys
import glob
import options as setting
import xlsToCsv as csvConverter
import csvParser as parser
import dbProvider as db
def printProgress(prefix="", iteration=1, maxIteration=1, size=30, file=sys.stdout):
iteration = int(iteration)
size = int(size)
maxIteratio... | 2.421875 | 2 |
posts/views.py | JySa65/platzi-gram | 0 | 44433 | from django.shortcuts import render
from django.views.generic import ListView, CreateView, DetailView
from django.contrib.auth.mixins import LoginRequiredMixin
from posts.models import Post
from posts.forms import PostForm
from django.urls import reverse_lazy
# Create your views here.
class PostListView(LoginRequired... | 2.1875 | 2 |
training_engine.py | DDMAL/Calvo-classifier | 0 | 44434 | import cv2
import numpy as np
import random as rd
import os
from tensorflow.keras.models import Sequential, Model
from tensorflow.keras.layers import Dense, Dropout, Activation, Flatten
from tensorflow.keras.layers import Conv2D, MaxPooling2D, Input
from tensorflow.keras.optimizers import Adadelta
from tensorflow.keras... | 2.796875 | 3 |
board/views.py | mijiFernandes/pa_1 | 0 | 44435 | from django.views.generic import ListView, DetailView, TemplateView, CreateView, UpdateView, DeleteView
from board.models import Post
from django.contrib.auth.mixins import LoginRequiredMixin
from django.urls import reverse_lazy
from mysite.views import OwnerOnlyMixin
from django.conf import settings
#--- ListView
c... | 2.09375 | 2 |
froide/problem/models.py | OpendataCH/froide | 0 | 44436 | from django.conf import settings
from django.db import models
from django.dispatch import Signal
from django.utils import timezone
from django.utils.translation import gettext_lazy as _
from froide.foirequest.models import FoiMessage
from .utils import inform_user_problem_resolved
class ProblemChoices(models.TextCh... | 2.15625 | 2 |
s5/pipe.py | aut-ce/CE304-OS-Lab | 1 | 44437 | # In The Name of God
# =======================================
# [] File Name : pipe.py
#
# [] Creation Date : 27-11-2019
#
# [] Created By : <NAME> <<EMAIL>>
# =======================================
import os
def child(n, w):
print('I am Child')
f = os.fdopen(w, 'w')
# the old way
f.write('hello %d... | 3.140625 | 3 |
twilio_notification.py | srisankethu/cowin-service | 0 | 44438 | from twilio.rest import Client
from twilio.twiml.voice_response import Gather, VoiceResponse
import os
class TwilioNotification:
def __init__(self, sid, auth_token):
self.client = Client(sid, auth_token)
def send_call(self, action_url, contacts):
response = VoiceResponse()
gather = ... | 2.9375 | 3 |
dh_abstracts/app/abstracts/migrations/0019_auto_20200331_1723.py | dSHARP-CMU/dhweb_app | 3 | 44439 | <gh_stars>1-10
# Generated by Django 3.0.4 on 2020-03-31 21:23
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('abstracts', '0018_auto_20200331_1715'),
]
operations = [
migrations.RemoveField(
model_name='work',
name='pub... | 1.296875 | 1 |
Project_CaesarCipher/main.py | PratyushPriyam/Python_Projects | 0 | 44440 | from art import logo
def cipher(text_txt, shift_number, direction_dir):
encryption_text = ""
shift_number = shift_number % 26
if "decode" in direction_dir:
shift_number *= -1
for lett in text_txt:
if lett in alphabet:
index_of_letter = alphabet.index(lett)
... | 4 | 4 |
chapter-4/transcribe_text.py | PacktPublishing/Applied-Machine-Learning-for-Healthcare-and-Life-Sciences-using-AWS | 1 | 44441 | <gh_stars>1-10
from __future__ import print_function
import time
import boto3
import json
import pandas as pd
transcribe = boto3.client('transcribe')
job_name = "med-transcription-job"
job_uri = "" #enter the S3 URI of the audio file between the double quotes
try:
transcribe.delete_medical_transcription_job(Medi... | 2.609375 | 3 |
examples_ltnw/multilabel_classification.py | gilbeckers/logictensornetworks | 0 | 44442 | # -*- coding: utf-8 -*-
import logging
logger = logging.getLogger()
logger.basicConfig = logging.basicConfig(level=logging.DEBUG)
import numpy as np
import matplotlib.pyplot as plt
import logictensornetworks_wrapper as ltnw
nr_samples=500
data=np.random.uniform([0,0],[1.,1.],(nr_samples,2)).astype(np.float32)
data_A... | 2.390625 | 2 |
server/storage.py | migueladanrm/Fascan | 1 | 44443 | <gh_stars>1-10
from google.cloud import storage
from uuid import uuid4
from os import environ
def upload_object(file, name=None) -> str:
client = storage.Client()
bucket = client.bucket(environ["GC_BUCKET"])
if name is None:
name = f"{uuid4()}.jpg"
blob = bucket.blob(name)
blob.upload_fr... | 2.875 | 3 |
api/api.py | kalinkinisaac/modular | 0 | 44444 | from api.subgroups_names import ClassicalSubgroups
from graph_constructor import get_graph
from plotter.graph_plotter import GraphPlotter
from plotter.geodesic_plotter import GeodesicPlotter
from plotter.marker_plotter import MarkerPlotter
from special_polygon import SpecialPolygon
from fimath import Matrix, Field
from... | 2.4375 | 2 |
thaniya_server_upload/src/thaniya_server_upload/slots/IUploadSlotContext.py | jkpubsrc/Thaniya | 1 | 44445 |
from thaniya_server_sudo import SudoScriptRunner
from thaniya_server.usermgr import BackupUserManager
from thaniya_server.sysusers import SystemAccountManager
class IUploadSlotContext:
@property
def backupUserManager(self) -> BackupUserManager:
raise NotImplementedError()
#
@property
def sudoScriptRunne... | 1.75 | 2 |
elliot/recommender/neural/NeuMF/tf_custom_sampler_2.py | gategill/elliot | 175 | 44446 | """
Module description:
"""
__version__ = '0.3.1'
__author__ = '<NAME>, <NAME>'
__email__ = '<EMAIL>, <EMAIL>'
import tensorflow as tf
import numpy as np
import random
class Sampler():
def __init__(self, indexed_ratings=None, m=None, num_users=None, num_items=None, transactions=None, batch_size=512, random_seed=... | 2.1875 | 2 |
emailServer/testClient.py | rindhane/automata | 0 | 44447 | #! /usr/bin/env python
import socket
def send_ping_data(HOST, PORT):
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
s.connect((HOST,PORT))
s.sendall(b'Hello, world')
data=s.recv(1024)
return data
if __name__== "__main__" :
print('Received',repr(send_ping_data('127... | 2.890625 | 3 |
Lib/test/test_decr.py | zingero/cpython | 0 | 44448 | <reponame>zingero/cpython
# Decrement test.
import unittest
class DecrementTest(unittest.TestCase):
def testBasic(self):
x = 2
x--
self.assertEqual(x, 1)
x --
self.assertEqual(x, 0)
def test_in_loop(self):
original_x = x = 2
decrementation_number = 10
... | 3.5625 | 4 |
rmp_nav/simulation/agent_utils.py | KH-Kyle/rmp_nav | 30 | 44449 | <filename>rmp_nav/simulation/agent_utils.py<gh_stars>10-100
import math
def _sign(x):
return -1 if x < 0 else 1
def clip_within_fov(point, fov):
angle = math.atan2(point[1], point[0])
if abs(angle) > fov * 0.5:
# Out of field of view
# Project the point to the fov line
# x0, y0 i... | 2.453125 | 2 |
fuel-package-updates.py | artem-panchenko/fuel-updates | 0 | 44450 | <reponame>artem-panchenko/fuel-updates
# Copyright 2015 Mirantis, 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
#
# ... | 1.742188 | 2 |
src/utils.py | one-acre-fund/MapTilesDownloader | 0 | 44451 | <gh_stars>0
#!/usr/bin/env python
from urllib.parse import urlparse
from urllib.parse import parse_qs
from urllib.parse import parse_qsl
import urllib.request
import cgi
import uuid
import random
import string
from cgi import parse_header, parse_multipart
import argparse
import uuid
import random
import time
import js... | 2.34375 | 2 |
Curso_Python/Secao2-Python-Basico-Logica-Programacao/37_desempacotamento_listas/37_desempacotamento_listas.py | pedrohd21/Cursos-Feitos | 0 | 44452 | <gh_stars>0
"""
Desempacotamento de listas em python
"""
lista = ['Luiz', 'João', 'Maria', 1, 2, 3, 4, 5]
n1, n2, *n3 = lista #todo: usando a * cria outra lista, e os valores que eu quiser mostrar, começa pelas ultimas
print(n3)
| 3.59375 | 4 |
bot/bot.py | CourTeous33/DiscordBetBot | 1 | 44453 | # bot.py
import os
import random
import discord
from dotenv import load_dotenv
import commands as cm
import qrys
load_dotenv()
TOKEN = os.getenv('DISCORD_TOKEN')
GUILD = os.getenv('DISCORD_GUILD')
client = discord.Client()
prefix = '$'
@client.event
async def on_ready():
for guild in client.guilds:
if g... | 2.546875 | 3 |
airflow/migrations/versions/86770d1215c0_add_kubernetes_scheduler_uniqueness.py | abhishek-ch/incubator-airflow | 4 | 44454 | # flake8: noqa
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distrib... | 1.6875 | 2 |
petpy/__main__.py | csmarfan/petpy | 0 | 44455 | <reponame>csmarfan/petpy
import sys
from .petpy import gardner
def main():
vp = float(sys.arv[1])
print(gardner(vp))
if __name__=='__main__':
main()
| 1.640625 | 2 |
PhaseI/DataPreparation/monitor_HRRR_forecast_rainfall.py | uva-hydroinformatics-lab/FloodWarningModelProject | 2 | 44456 | from pydap.client import open_url
from pydap.exceptions import ServerError
import subprocess
import boto.ec2
import datetime as dt
import numpy as np
import csv
import schedule
import time
"""
Global parameters:
-Study area location (LL and UR corners of TUFLOW model bounds)
-Initial and avera... | 2.609375 | 3 |
farmer/ncc/augmentation/segmentation_aug.py | aiorhiroki/farmer.tf2 | 10 | 44457 | <filename>farmer/ncc/augmentation/segmentation_aug.py
from .aug_utils import get_aug
from .augment_and_mix import dual_augment_and_mix
import albumentations
def segmentation_aug(
input_image,
label,
mean,
std,
augmentation_dict,
augmix,
):
transforms = get_aug(augme... | 2.4375 | 2 |
models/seg_generator/models/seg_model.py | valeoai/SemanticPalette | 17 | 44458 | import torch
import torch.nn.functional as F
from ..models.progressive import ProGANGenerator, ProGANDiscriminator
from ..modules.gan_loss import ImprovedWGANLoss
from ..modules.instance_refiner import InstanceRefiner
from tools.utils import to_cuda
from models import load_network, save_network, print_network
... | 2.078125 | 2 |
utils/arguments.py | LiangsLi/Pytorch_Project_Template | 3 | 44459 | <reponame>LiangsLi/Pytorch_Project_Template
# -*- coding: utf-8 -*-
# Created by <NAME> on 2019/10/8
# import configargparse as argparse
import os
import torch
import argparse
import yaml
class ArgsClass(object):
def __init__(self, args_dict):
for k, v in args_dict.items():
setattr(self, k, v)... | 2.375 | 2 |
hottbox/utils/validation/__init__.py | adamurban98/hottbox | 167 | 44460 | <gh_stars>100-1000
from .checks import is_toeplitz_matrix, is_super_symmetric, is_toeplitz_tensor
__all__ = [
"is_toeplitz_matrix",
"is_super_symmetric",
"is_toeplitz_tensor",
]
| 1.265625 | 1 |
config/config.py | SchoolPower/SchoolPower-Backend | 2 | 44461 | import os
import sys
TOPIC = 'studio.schoolpower.SchoolPower'
PS_API = 'https://powerschool.mapleleaf.cn'
CACHE_DB_LOCATION = os.environ.get("CACHE_DB_LOCATION", None)
DB_LOCATION = os.environ.get('DB_LOCATION', 'users.db')
PEM_FILE_PATH = os.environ.get("APNS_CERT_FILE", None)
SECRET = os.environ.get("SECRET", "test"... | 1.78125 | 2 |
train.py | allenye0119/PPO-pytorch | 1 | 44462 | <gh_stars>1-10
#!/usr/bin/env python
import os
import sys
from box import Box
import numpy as np
import torch
import gym
from model import Model
from trainer import Trainer
def print_config(config, d=0):
tabs = ' ' * d * 4
for k in config.keys():
if isinstance(config[k], Box):
print('{}... | 2.03125 | 2 |
custom/migrations/0003_auto_20181001_1734.py | rexhepberlajolli/Insurance | 0 | 44463 | # Generated by Django 2.1.1 on 2018-10-01 17:34
import django.contrib.postgres.fields
from django.db import migrations, models
import uuid
class Migration(migrations.Migration):
dependencies = [
('custom', '0002_riskfield_risk_type'),
]
operations = [
migrations.AlterModelOptions(
... | 2.015625 | 2 |
scraping/fpl_gameweek.py | Fournierp/FPL | 2 | 44464 | import os
import sys
import requests
import logging
import time
import json
import pandas as pd
import numpy as np
from concurrent.futures import ProcessPoolExecutor
from git import Git
class FPL_Gameweek:
""" Get the Gameweek state """
def __init__(self, logger, season_data):
"""
Args:
... | 2.765625 | 3 |
tests/unit/chroma_core/lib/storage_plugin/subscription_plugin.py | beevans/integrated-manager-for-lustre | 52 | 44465 | from chroma_core.lib.storage_plugin.api import attributes
from chroma_core.lib.storage_plugin.api.identifiers import GlobalId, ScopedId
from chroma_core.lib.storage_plugin.api.plugin import Plugin
from chroma_core.lib.storage_plugin.api import resources
from chroma_core.lib.storage_plugin.api import relations
version ... | 1.898438 | 2 |
FlappyBot.py | HTeker/Flappy-Bird-Q-Learning | 0 | 44466 | <filename>FlappyBot.py
import math
import json
class FlappyBot():
def __init__(self):
self.number_of_games = 0
self.score = 0
self.distance = 0
self.learning_rate = .7
self.gamma = 0.95
self.last_state = "0_0_0"
self.last_action = 0
self.memory = []
... | 3.765625 | 4 |
google_or_tools/knapsack_cp_sat.py | tias/hakank | 279 | 44467 | <gh_stars>100-1000
# Copyright 2021 <NAME> <EMAIL>
#
# 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 ... | 2.609375 | 3 |
slack/io/requests.py | autoferrit/slack-sansio | 0 | 44468 | import json
import time
import logging
import requests
import websocket
from . import abc
from .. import events, sansio, methods, exceptions
LOG = logging.getLogger(__name__)
class SlackAPI(abc.SlackAPI):
"""
`requests` implementation of :class:`slack.io.abc.SlackAPI`
Args:
session: HTTP sessi... | 2.734375 | 3 |
bdsim/blocks/__init__.py | petercorke/bdsim | 64 | 44469 | from .functions import *
from .sources import *
from .sinks import *
from .transfers import *
from .discrete import *
from .linalg import *
from .displays import *
from .connections import *
url = "https://petercorke.github.io/bdsim/" + __package__
| 1.140625 | 1 |
temp/msgManager.py | f0lg0/pyChat | 13 | 44470 | <reponame>f0lg0/pyChat
#Will add a fixed header and return a sendable string (we should add pickle support here at some point somehow), also encodes the message for you
def createMsg(data):
msg = data
msg = f'{len(msg):<10}' + msg
return msg.encode("utf-8")
#streams data from the 'target' socket wi... | 2.859375 | 3 |
L1TriggerConfig/L1ScalesProducers/python/L1CaloScalesConfig_cff.py | ckamtsikis/cmssw | 852 | 44471 | <reponame>ckamtsikis/cmssw<filename>L1TriggerConfig/L1ScalesProducers/python/L1CaloScalesConfig_cff.py
import FWCore.ParameterSet.Config as cms
from L1TriggerConfig.L1ScalesProducers.l1CaloScales_cfi import *
emrcdsrc = cms.ESSource("EmptyESSource",
recordName = cms.string('L1EmEtScaleRcd'),
iovIsRunNotTime = ... | 1.429688 | 1 |
enhancements/predict.py | Tim-orius/CSENDistance | 3 | 44472 | <filename>enhancements/predict.py
import numpy as np
from sklearn.preprocessing import StandardScaler
import scipy.io
import tensorflow as tf
tf.random.set_seed(10)
import os
import sys
sys.path.append('../')
from csen_regressor import model
import argparse
from sklearn.model_selection import train_test_split
# INITI... | 2.125 | 2 |
app/sms_bot/sms_test.py | d3F0g/ESD-G7T1 | 0 | 44473 | <reponame>d3F0g/ESD-G7T1
import os
from twilio.rest import Client
account_sid = 'AC<KEY>'
auth_token = '<PASSWORD>'
client = Client(account_sid, auth_token)
message = client.messages \
.create(
body='This is the ship that made the Kessel Run in fourteen parsecs?',
from_='+15017122661',
... | 2.25 | 2 |
auth/application/user_service.py | nicolaszein/auth | 0 | 44474 | <reponame>nicolaszein/auth
import uuid
from auth.application.exception import InvalidCredentials, UserNotActivated
from auth.domain.user import User
from auth.infrastructure.password import Password
from auth.infrastructure.token import Token
from auth.infrastructure.user_adapter import UserAdapter
class UserService... | 2.234375 | 2 |
coopihc/inference/BaseInferenceEngine.py | jgori-ouistiti/CoopIHC | 0 | 44475 | from collections import OrderedDict
# Base Inference Engine: does nothing but return the same state. Any new inference method can subclass InferenceEngine to have a buffer and add_observation method (required by the bundle)
class BaseInferenceEngine:
"""BaseInferenceEngine
The base Inference Engine from whic... | 2.40625 | 2 |
src/structurizr/mixin/childless_mixin.py | xolynrac/examen_final_4c | 47 | 44476 | <filename>src/structurizr/mixin/childless_mixin.py<gh_stars>10-100
# Copyright (c) 2020
#
# 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
#
#... | 2.34375 | 2 |
S2.Surface_Normal/unet/unet_model.py | leoshine/Spherical_Regression | 133 | 44477 | <reponame>leoshine/Spherical_Regression
"""
@Author : <NAME>
"""
# full assembly of the sub-parts to form the complete net
import numpy as np
from unet_parts import *
class UNet(nn.Module):
def __init__(self, n_channels, n_classes):
super(UNet, self).__init__()
self.inc = inconv(n_channels, 64)
... | 2.234375 | 2 |
build/markdown_utils.py | NDevTK/cel | 0 | 44478 | <gh_stars>0
#!/usr/bin/env python
# Copyright 2017 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.
from __future__ import print_function
import difflib
import logging
import os
import re
import textwrap
def ProcessIncl... | 2.640625 | 3 |
common/Request_Package.py | Four-sun/Requests_Load | 0 | 44479 | <gh_stars>0
# -*- coding: utf-8 -*-
"""
Created: on 2018-04-11
@author: Four
Project: common\Request_Package.py
Request重新封装
"""
import json
import time
from common.log import Logger
Logger_Message = Logger()
send_time=time.strftime("%Y-%m-%d-%H_%M_%S",time.localtime(time.time())) #获取当前时间
def send_requests(s, testd... | 2.515625 | 3 |
1546 Maximum Number of Non-Overlapping Subarrays With Sum Equals Target.py | MdAbedin/leetcode | 4 | 44480 | <gh_stars>1-10
class Solution:
def maxNonOverlapping(self, nums: List[int], target: int) -> int:
last = {0:-1}
s = 0
dp = [0]*len(nums)
for i in range(len(nums)):
s += nums[i]
if s-target in last:
dp[i] = max(dp[i-1] if i-1>=0 else 0, 1+ (dp[last[s-t... | 2.796875 | 3 |
copy.py | tzuryby/copyip | 0 | 44481 |
import sys
import os
import urllib2
from bs4 import BeautifulSoup as bsoup
print sys.argv
if len(sys.argv) < 3:
print "Usage example: python copy.py Netflix /path/to/target-repo-directory"
sys.exit(1)
orgurl = sys.argv[1]
targetdir = sys.argv[2]
orgurl = "https://www.github.com/%s?page=1" % orgurl
print "... | 3.25 | 3 |
bmstu_project/student/forms.py | TrungLuong1194/django-student-management | 1 | 44482 | from django import forms
from student.models import Major, UserProfile
from django.contrib.auth.models import User
class MajorForm(forms.ModelForm):
code = forms.CharField(max_length=20)
viName = forms.CharField(max_length=128)
enName = forms.CharField(max_length=128)
class Meta:
model = Major
fields ... | 2.453125 | 2 |
colorizer/__main__.py | danbradham/colorizer | 2 | 44483 | # -*- coding: utf-8 -*-
# Standard library imports
import sys
# Third party imports
from Qt import QtWidgets
# Local imports
from .ui import Dialog
if __name__ == '__main__':
app = QtWidgets.QApplication(sys.argv)
d = Dialog()
sys.exit(d.exec_())
| 1.8125 | 2 |
module1-introduction-to-sql/rpg_queries.py | JimKing100/DS-Unit-3-Sprint-2-SQL-and-Databases | 0 | 44484 | <reponame>JimKing100/DS-Unit-3-Sprint-2-SQL-and-Databases
# Imports
import sqlite3
# Queries
query1 = 'SELECT COUNT(character_id) \
FROM charactercreator_character;'
query2a = 'SELECT COUNT(character_ptr_id) \
FROM charactercreator_mage;'
query2b = 'SELECT COUNT(character_ptr_id) \
FROM... | 2.828125 | 3 |
tests/app/main/views/service_settings/test_inbound_sms_setting.py | karlchillmaid/notifications-admin | 0 | 44485 | from flask import url_for
from tests.conftest import normalize_spaces
def test_set_inbound_sms_sets_a_number_for_service(
logged_in_client,
mock_add_sms_sender,
multiple_available_inbound_numbers,
service_one,
fake_uuid,
mock_no_inbound_number_for_service,
mocker
):
mocker.patch('app.... | 2.34375 | 2 |
examples/set_bucket_policy.py | cheungpat/minio-py | 0 | 44486 | <gh_stars>0
# -*- coding: utf-8 -*-
# Minio Python Library for Amazon S3 Compatible Cloud Storage.
# Copyright (C) 2016 Minio, 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
#
# htt... | 2.5 | 2 |
3-Python-Advanced (May 2021)/00-Exams-Prep/03-Python-Advanced-Exam-14-Feb-2021/01-Problem-1.py | karolinanikolova/SoftUni-Software-Engineering | 0 | 44487 | <reponame>karolinanikolova/SoftUni-Software-Engineering
# Problem 1
# First, you will be given a sequence of integers representing firework effects. Afterwards you will be given another
# sequence of integers representing explosive power.
# You need to start from the first firework effect and try to mix it with the las... | 4.03125 | 4 |
cno/edit_distance.py | CherokeeLanguage/cherokee-audio-data | 2 | 44488 | <reponame>CherokeeLanguage/cherokee-audio-data<gh_stars>1-10
#!/usr/bin/env python3
if __name__ == "__main__":
import os
import sys
import csv
import re
dname = os.path.dirname(sys.argv[0])
if len(dname) > 0:
os.chdir(dname)
syllabaryList: tuple = (
"syllabaryb", 'nounadjplura... | 2.40625 | 2 |
afgraph/evolve/evolution_tree.py | TNonet/afgraph | 0 | 44489 | from ..function.node import *
from ..function.tree import *
import numpy as np
def generate_tree(name='test'):
p_branch = .2
p_infertile = .1
p_channel = 1 - p_branch - p_infertile
decay = .25
branch_nodes = [Max, Sum, Mean, Min, Product, Median]
infertile_nodes = [Constant, Input, Uniform, N... | 3.21875 | 3 |
blackpill/current/lib/grblcontrol.py | fedor2018/my_upython | 0 | 44490 | from grbl import *
from pyb import I2C, delay, millis
from pyb_i2c_lcd import I2cLcd
from lcd_v_minus import *
import time
"""
X
01234567890123456789
X=-xxx.xx F=xxxx* W
Y=-xxx.xx S=xxxx* FM
Z=-xxx.xx Idle. XYZP
message
---------------------
* override
F - feed
S - spindle
W - coordinate W M O
FM - flood mist
... | 2.234375 | 2 |
dragon_cache_manager/management/commands/load_test_cache.py | Lenders-Cooperative/django-dragon | 0 | 44491 | import random
from django.core.management.base import BaseCommand, CommandError
from django.conf import settings
from django.core.cache import caches
class Command(BaseCommand):
help = "Loads cache with test objects"
def add_arguments(self, parser):
parser.add_argument("-c", "--cache", nargs="+", typ... | 2.421875 | 2 |
digit-dataset/k-means.py | MasayukiHigashi/CAT | 19 | 44492 | <filename>digit-dataset/k-means.py
import numpy as np
from sklearn.cluster import KMeans
num_classes = 10
dirr = "./"
cat = np.load(dirr+"features_cat.npz")
rev = np.load(dirr+"features_rev.npz")
mstn = np.load(dirr+"features_mstn.npz")
cat_pred = KMeans(n_clusters=num_classes, n_jobs=-1).fit_predict(np.concatenate([... | 3 | 3 |
prob_046.py | tansly/euler | 1 | 44493 | <filename>prob_046.py
def checkPrime(x):
if x==1:
return False
elif x==2:
return True
elif x%2==0:
return False
else:
n=3
while n<x:
if x%n==0:
return False
else:
n+=2
return True
def checksq(n, i):
... | 3.609375 | 4 |
utils/data/common_voice.py | luweishuang/rnnt-speech-recognition | 0 | 44494 | import os
import tensorflow as tf
from .. import preprocessing
def tf_parse_line(line, data_dir):
line_split = tf.strings.split(line, '\t')
audio_fn = line_split[1]
transcription = line_split[2]
audio_filepath = tf.strings.join([data_dir, 'clips', audio_fn], '/')
wav_filepath = tf.strings.subst... | 2.671875 | 3 |
Solutions/6kyu/6kyu_ascii_cipher.py | citrok25/Codewars-1 | 46 | 44495 | <reponame>citrok25/Codewars-1
def ascii_cipher(message, key):
pfactor = max(
i for i in range(2, abs(key)+1)
if is_prime(i) and key%i==0
)*(-1 if key<0 else 1)
return ''.join(chr((ord(c)+pfactor)%128) for c in message)
def is_prime(n):
if n < 2... | 3.65625 | 4 |
src/rotorse/virtual_factory.py | Ben-Mertz/RotorSE | 0 | 44496 |
import numpy as np
import math
class virtual_factory(object):
def __init__(self, blade_specs , operation, gating_ct, non_gating_ct, options):
self.options = options
# Blade inputs
self.n_webs = blade_specs['n_webs']
... | 3.046875 | 3 |
core/funcs.py | MrSpaar/Hikari-PolyBot | 4 | 44497 | from hikari import Permissions
from lightbulb import Context, Check, errors
from datetime import datetime, timedelta
from unicodedata import normalize
from aiohttp import ClientSession
from typing import Union
from os import environ
async def api_call(link: str, headers: dict = None, post: bool = False, json: bool =... | 2.125 | 2 |
bitmovin_api_sdk/encoding/filters/watermark/customdata/__init__.py | jaythecaesarean/bitmovin-api-sdk-python | 11 | 44498 | from bitmovin_api_sdk.encoding.filters.watermark.customdata.customdata_api import CustomdataApi
| 1.132813 | 1 |
bindings/ast.py | idobatter/PythonJS | 1 | 44499 | # Brython AST to Python AST Bridge
# by <NAME> - copyright 2013
# License: "New BSD"
def brython_tokenize(src):
module = 'test'
return JS('__BRYTHON__.$tokenize(src, module)')
_decorators = []
def push_decorator(ctx):
_decorators.append( ctx )
def pop_decorators():
arr = list( _decorators )
_decorators.length = ... | 2.625 | 3 |