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 |
|---|---|---|---|---|---|---|
algorithms/python/leetcode/tests/test_NonnegativeIntegerswithoutConsecutiveOnes.py | ytjia/coding-pratice | 0 | 25400 | <reponame>ytjia/coding-pratice<filename>algorithms/python/leetcode/tests/test_NonnegativeIntegerswithoutConsecutiveOnes.py
# -*- coding: utf-8 -*-
# Authors: <NAME> <<EMAIL>>
import unittest
from .. import NonnegativeIntegerswithoutConsecutiveOnes
class TestNonnegativeIntegerswithoutConsecutiveOnes(unittest.TestCas... | 3.46875 | 3 |
tierpsy/debugging/check_roi_flow.py | mgh17/tierpsy-tracker | 9 | 25401 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 17 17:59:36 2018
@author: avelinojaver
"""
import numpy as np
import cv2
from functools import partial
import json
from pathlib import Path
import pandas as pd
from tierpsy.analysis.ske_create.helperIterROI import generateMoviesROI
mask_file = ... | 2.203125 | 2 |
models/SFD_net.py | LeileiCao/SFD_Pytorch | 1 | 25402 | <reponame>LeileiCao/SFD_Pytorch
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from layers import *
import torchvision.transforms as transforms
import torchvision.models as models
import torch.backends.cudnn as cudnn
import torch.nn.init as init
import os
class L... | 2.515625 | 3 |
PP4E/Examples/PP4E/Integrate/Embed/prioredition-2x/Inventory/WithDbase/inventory.py | BeacherHou/Python-_Markdown- | 0 | 25403 | <filename>PP4E/Examples/PP4E/Integrate/Embed/prioredition-2x/Inventory/WithDbase/inventory.py
############################################################################
# implement inventory/buyer databases as persistent shelve/pickle files;
# since the validations are already coded to use a function call interface... | 2.671875 | 3 |
services/worker/main.py | mrgrassho/geo-diff-2 | 0 | 25404 | <reponame>mrgrassho/geo-diff-2
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from geodiff_worker import GeoDiffWorker
from os import environ
from os.path import join, dirname
from dotenv import load_dotenv
dotenv_path = join(dirname(__file__), '.env')
load_dotenv(dotenv_path)
def main():
"""Main entry point to ... | 2.3125 | 2 |
tasks/tv_raffle_handler.py | fakegit/bili2.0 | 0 | 25405 | <reponame>fakegit/bili2.0<gh_stars>0
import asyncio
import random
import bili_statistics
from reqs.tv_raffle_handler import TvRaffleHandlerReq
from tasks.utils import UtilsTask
import utils
from .task_func_decorator import normal
from .base_class import ForcedTask
class TvRaffleJoinTask(ForcedTask):
TASK_NAME = ... | 1.96875 | 2 |
openstack/regression/utils/wait.py | viduship/ceph-qe-scripts | 6 | 25406 | import time
class Wait(object):
def __init__(self):
pass
def wait_for_state_change(self, expected_status, from_status):
for i in range(0, 20):
if expected_status != from_status:
break
time.sleep(1)
| 3 | 3 |
cdci_data_analysis/analysis/parameters.py | andreatramacere/cdci_data_analysis | 0 | 25407 | """
Overview
--------
general info about this module
Classes and Inheritance Structure
----------------------------------------------
.. inheritance-diagram::
Summary
---------
.. autosummary::
list of the module you want
Module API
----------
"""
from __future__ import absolute_import, division, print... | 2.734375 | 3 |
utils/utils.py | lindsey98/dml_cross_entropy | 0 | 25408 | <reponame>lindsey98/dml_cross_entropy
from collections import OrderedDict
import torch
import torch.nn as nn
import torch.nn.functional as F
def state_dict_to_cpu(state_dict: OrderedDict):
"""Moves a state_dict to cpu and removes the module. added by DataParallel.
Parameters
----------
state_dict : O... | 2.578125 | 3 |
examples/tinytag/fuzzbp.py | MJ-SEO/py_fuzz | 0 | 25409 | <reponame>MJ-SEO/py_fuzz
from pythonfuzz.main import PythonFuzz
from tinytag import TinyTag
import tempfile
import random
def suffix():
randnum = random.randint(0, 3)
if(randnum == 0):
return ".mp4"
elif(randnum == 1):
return ".mp3"
elif(randnum == 2):
return ".WMA"
elif(randnum == 3):
return ".riff"
@P... | 2.671875 | 3 |
r2d2.py | alicemirror/R2-D2-ArcadeLive | 1 | 25410 | #!/usr/bin/python
# R2D2 Python source code to control the Sphero R2D2 droic
# Author: <NAME>
# Version: 1.0
# Date: Sept, 2019
# License: LGPL 3.0
#
# Based on the reverse engineering work
# "Scripting Sphero's Star Wars Droids"
# by ~bbraun.
#
# Thanks to <NAME> who inspired the live chroma key
# methodological appro... | 2.28125 | 2 |
week9_ML_svm_poly_norm/day2_svm_poly/theory/visualize_boundary.py | Clapiniella/data_science_nov_2020 | 1 | 25411 | <gh_stars>1-10
import numpy as np
import matplotlib.pyplot as plt
from plot_data import plot_data
def visualize_boundary(X, y, clf):
"""
Plots a linear decision boundary learned by the SVM.
Parameters
----------
X : ndarray, shape (n_samples, n_features)
Samples, where n_samples is the n... | 3.328125 | 3 |
src/integ_test_resources/common/platforms.py | kaichengyan/amplify-ci-support | 9 | 25412 | from enum import Enum
class Platform(Enum):
IOS = "ios"
ANDROID = "android"
| 2.453125 | 2 |
pattern7-tree-breadth-first-search/7. Level Order Successor (easy).py | dopiwoo/Grokking-the-Coding-Interview | 0 | 25413 | <filename>pattern7-tree-breadth-first-search/7. Level Order Successor (easy).py<gh_stars>0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Feb 26 17:29:12 2021
@author: dopiwoo
Given a binary tree and a node, find the level order successor of the given node in the tree. The level order successor
is ... | 3.921875 | 4 |
UnitTesting/Columbus/views.py | FalseG0d/AdvancedDjango | 9 | 25414 | <gh_stars>1-10
from django.shortcuts import render
from .models import Name
from .forms import NameForm
# Create your views here.
def i_was_here(request):
form=NameForm()
if request.method=="POST":
form=NameForm(request.POST)
if form.is_valid():
form.save()
names=Name.objects.... | 2.171875 | 2 |
bruges/attribute/energy.py | sbachkheti/bruges | 0 | 25415 | # -*- coding: utf-8 -*-
import numpy as np
from scipy.signal import fftconvolve
def energy(traces, duration, dt=1):
"""
Compute an mean-squared energy measurement for each point of a
seismic section.
:param traces: The data array to use for calculating MS energy.
Must be 1D or 2D n... | 3.1875 | 3 |
examples/test_heat.py | nschloe/maelstrom | 26 | 25416 | <reponame>nschloe/maelstrom<gh_stars>10-100
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
from __future__ import print_function
from dolfin import plot, dx, Constant, Measure, Function, project, XDMFFile
import matplotlib.pyplot as plt
import numpy
import problems
import maelstrom
import parabolic
def _paramete... | 2.65625 | 3 |
news_collector/news_collector/spiders/laarena.py | mfalcon/chequeabot | 11 | 25417 | <filename>news_collector/news_collector/spiders/laarena.py
import datetime
import newspaper
import scrapy
import locale
import datetime
locale.setlocale(locale.LC_ALL, "es_AR.utf8")
BASE_URL = 'http://www.laarena.com.ar/'
class LaArenaSpider(scrapy.Spider):
name = "laarena"
def start_requests(self):
... | 2.90625 | 3 |
Server/server.py | hackerghost93/Encrypted_FTP | 0 | 25418 | <gh_stars>0
from multiprocessing import Process
from Crypto.Cipher import AES
import os
import sys
import threading
import socket
import platform
printing_lock = threading.Lock()
obj = AES.new('This is a key123', AES.MODE_CBC, 'This is an IV456')
counterTcp = 0
counterUdp = 0
def udp_handler(client_socket, address,... | 2.859375 | 3 |
placement/settings.py | vipulgupta2048/getmejob | 1 | 25419 | BOT_NAME = "placement"
SPIDER_MODULES = ["placement.spiders"]
NEWSPIDER_MODULE = "placement.spiders"
ROBOTSTXT_OBEY = True
CONCURRENT_REQUESTS = 16
DUPEFILTER_DEBUG = True
EXTENSIONS = {"spidermon.contrib.scrapy.extensions.Spidermon": 500}
SPIDERMON_ENABLED = True
ITEM_PIPELINES = {"spidermon.contrib.scrapy.pipeli... | 1.304688 | 1 |
api/src/mail.py | jsangmeister/openslides.com-1 | 0 | 25420 | import smtplib
from flask_babel import gettext as _
from flask_mail import Mail
from .app import app
from .errors import ViewError
mail = Mail(app)
def try_send_mail(msg):
try:
mail.send(msg)
except smtplib.SMTPServerDisconnected:
raise ViewError(_("Der Server ist nicht korrekt konfigurier... | 2.578125 | 3 |
src/python/starpattern.py | DHANUSHXENO/a-patterns | 0 | 25421 | def star_pattern(n):
for i in range(n):
for j in range(i+1):
print("*",end=" ")
print()
star_pattern(5)
'''
star_pattern(5)
*
* *
* * *
* * * *
* * * * *
'''
| 3.53125 | 4 |
setup.py | sdimitro/savedump-workflows | 1 | 25422 | #!/usr/bin/env python3
from setuptools import setup
setup(
name='savedump',
version="0.1.0",
packages=[
"savedump",
],
entry_points={
'console_scripts': ['savedump=savedump.savedump:main'],
},
author='Delphix Platform Team',
author_email='<EMAIL>',
description='A... | 1.039063 | 1 |
ex081.py | LucasBalbinoSS/Exercicios-Python-Mundo3 | 0 | 25423 | <reponame>LucasBalbinoSS/Exercicios-Python-Mundo3<gh_stars>0
listaNum = list()
contadorde5 = 0
while True:
num = int(input('Digite um número: '))
if num == 5:
contadorde5 += 1
listaNum.append(num)
continuar = str(input('Quer continuar? [ S / N ] ')).strip().upper()
print()
if continua... | 3.71875 | 4 |
SHLDataset/data_fusion3.py | jenhuluck/deep-learning-in-ADL | 3 | 25424 | <filename>SHLDataset/data_fusion3.py
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 21 21:38:36 2020
@author: <NAME>
"""
#using deep learning on data fusion of motion and video data
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from scipy import stats
import tensorflow as tf
from sklearn imp... | 2.46875 | 2 |
api-test-code/credentials.py | srijansingh53/hatErase | 1 | 25425 | <reponame>srijansingh53/hatErase<filename>api-test-code/credentials.py
consumer_key = 'F1BCRW0AXUlr0wjLE8L6Znm8a'
consumer_secret = '<KEY>'
access_token = '<KEY>'
access_secret = '<KEY>' | 0.988281 | 1 |
data_operate_util.py | zs856/Second-hand-housing-guide-price-Shenzhen. | 2 | 25426 | import re
import pandas as pd
from constant import shenzhen_data_csv_path
def shape_data(header, body):
"""
该方法用于从pdf获取数据的时候塑造dataframe形式的数据
:param header:
:param body:
:return:
"""
pd.set_option('display.max_rows', None)
df = pd.DataFrame(body)
df.columns = header
return df
... | 3.140625 | 3 |
magi/agents/sac_ae/__init__.py | ethanluoyc/magi | 86 | 25427 | <gh_stars>10-100
"""SAC-AE agent."""
from magi.agents.sac_ae.agent import SACAEAgent
from magi.agents.sac_ae.agent import SACAEConfig
from magi.agents.sac_ae.networks import make_default_networks
| 1.015625 | 1 |
test/lib-clay/externals/abi/newtypes/run.py | jb55/clay | 185 | 25428 | import sys
sys.path.append('..')
import external_test
external_test.runExternalTest()
| 1.085938 | 1 |
luna/gateware/debug/ila.py | macdaliot/luna | 1 | 25429 | #
# This file is part of LUNA.
#
# Copyright (c) 2020 <NAME> <<EMAIL>>
# SPDX-License-Identifier: BSD-3-Clause
""" Integrated logic analysis helpers. """
import io
import os
import sys
import math
import unittest
import tempfile
import subprocess
from abc import ABCMeta, abstractmethod
from nmigen ... | 2.0625 | 2 |
SPD/lib/lib_IZZI_MD.py | yamamon75/PmagPy | 2 | 25430 | <reponame>yamamon75/PmagPy<gh_stars>1-10
#!/usr/bin/env python
from __future__ import division
from builtins import range
from past.utils import old_div
from numpy import *
def rect_area(three_points):
xA,yA=three_points[0][0],three_points[0][1]
xB,yB=three_points[1][0],three_points[1][1]
xC,yC=three_point... | 2.484375 | 2 |
trainings/workshop1/step12/network_outage.py | jochenparm/moler | 57 | 25431 | import os.path
import time
from moler.config import load_config
from moler.device.device import DeviceFactory
from moler.util.moler_test import MolerTest
def outage_callback(device_name, ping_times):
MolerTest.info("Network outage on {}".format(device_name))
ping_times["lost_connection_time"] = time.time()
... | 2.421875 | 2 |
app/mashaller/__init__.py | yntonfon/dashboard | 0 | 25432 | from .user import user_marshaller
| 1.109375 | 1 |
base/abstract/contextual_data.py | kefir/snakee | 0 | 25433 | <gh_stars>0
from abc import ABC
from typing import Union, Optional, Iterable, Any
try: # Assume we're a sub-module in a package.
from utils import arguments as arg
from base.interfaces.context_interface import ContextInterface
from base.interfaces.contextual_interface import ContextualInterface
from b... | 2.265625 | 2 |
snypy/snippets/rest/filters.py | sterapps/snypy-backend | 2 | 25434 | import django_filters
from snippets.models import File, Snippet, Label, SnippetLabel
class FileFilter(django_filters.FilterSet):
class Meta:
model = File
fields = [
'snippet',
'language',
]
class SnippetFilter(django_filters.FilterSet):
favorite = django_fi... | 2.3125 | 2 |
Packs/CommonWidgets/Scripts/MyToDoTasksWidget/MyToDoTasksWidget_test.py | satyakidroid/content | 0 | 25435 | import json
import demistomock as demisto
from MyToDoTasksWidget import get_open_to_do_tasks_of_current_user
def test_open_to_do_tasks_of_current_user(mocker):
'''
Given:
- Mock response of 'internalHttpRequest' to '/v2/statistics/widgets/query' that includes an open task and
a close task
... | 2.09375 | 2 |
runners/mlcube_singularity/mlcube_singularity/__init__.py | johnugeorge/mlcube | 83 | 25436 | <reponame>johnugeorge/mlcube
def get_runner_class():
from mlcube_singularity.singularity_run import SingularityRun
return SingularityRun
| 1.257813 | 1 |
Contest/LeetCode/BiweeklyContest27/2.py | WatsonWangZh/CodingPractice | 11 | 25437 | # 1461. Check If a String Contains All Binary Codes of Size K
# User Accepted:2806
# User Tried:4007
# Total Accepted:2876
# Total Submissions:9725
# Difficulty:Medium
# Given a binary string s and an integer k.
# Return True if any binary code of length k is a substring of s. Otherwise, return False.
# Example 1:
# ... | 4.125 | 4 |
src/globus_cli/services/transfer/client.py | sirosen/temp-cli-test | 47 | 25438 | <filename>src/globus_cli/services/transfer/client.py
import logging
import textwrap
import uuid
from typing import Any, Dict, Tuple, Union
import click
from globus_sdk import GlobusHTTPResponse, TransferClient
from .data import display_name_or_cname
from .recursive_ls import RecursiveLsResponse
log = logging.getLogg... | 2.34375 | 2 |
examples/issue_789/app.py | davidnateberg/Flask-AppBuilder | 1 | 25439 | <gh_stars>1-10
import sys
from flask_appbuilder import SQLA, AppBuilder, ModelView, Model
from flask_appbuilder.models.sqla.interface import SQLAInterface
from sqlalchemy import Column, Integer, String, ForeignKey, Table
from sqlalchemy.orm import relationship
from flask import Flask
from flask_appbuilder.actions impor... | 2.625 | 3 |
code/zeroinsertion_aging/plot-outofframe.py | andim/paper-tcellimprint | 2 | 25440 | <filename>code/zeroinsertion_aging/plot-outofframe.py<gh_stars>1-10
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
import palettable
import pandas as pd
import sys
sys.path.append('..')
from lib import *
plt.style.use('../custom.mplstyle')
agebinsize = 20.0
agebins = np.arange(0.0, 90.0, agebi... | 2.40625 | 2 |
examples/ivis_job/docker_build.py | smartarch/qoscloud | 2 | 25441 | <filename>examples/ivis_job/docker_build.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
This script builds the docker images of image client and recognizer server and pushes them to dockerhub.
"""
from subprocess import call
print("Building the default docker image")
call("docker build -t d3srepo/qoscloud-defau... | 2.046875 | 2 |
pyrene/main.py | krisztianfekete/pyrene | 0 | 25442 | <reponame>krisztianfekete/pyrene<gh_stars>0
# Py3 compatibility
from __future__ import print_function
from __future__ import unicode_literals
import tempfile
import os
import sys
import shutil
from .network import Network
from .util import Directory
from .shell import PyreneCmd
def main():
dot_pyrene = os.path.e... | 2.03125 | 2 |
Safe Marks/HelperLibrary/Student.py | mriduldhall/Safe-Marks | 0 | 25443 | from Interface.StudentCommandLineInterface import CLI
from HelperLibrary.StorageFunctions import StorageFunctions
from HelperLibrary.MarkSheet import MarkSheet
from datetime import datetime
class StudentController:
def __init__(self, student, table_name):
self.student = student
self.table_name = ... | 2.6875 | 3 |
zhaopin/zhaopin/middlewares.py | Bruceey/PythonSpider | 3 | 25444 | <reponame>Bruceey/PythonSpider
# Define here the models for your spider middleware
#
# See documentation in:
# https://docs.scrapy.org/en/latest/topics/spider-middleware.html
from scrapy import signals
# useful for handling different item types with a single interface
from itemadapter import is_item, ItemAdapter
from... | 2.640625 | 3 |
example/test_problem/ELBDM/DiscHeating/plot_script/FieldList.py | CliffLinTw/gamer | 0 | 25445 | <filename>example/test_problem/ELBDM/DiscHeating/plot_script/FieldList.py
import yt
ds = yt.load("/work1/clifflin/gamer-fork/bin/Plummer/Data_000000")
for i in sorted(ds.field_list):
print(i)
| 2.09375 | 2 |
snippets/Sage/batchdel.py | JLLeitschuh/TIPL | 1 | 25446 | import sys,os
from numpy import *
from subprocess import *
from glob import glob
doResume=1
showisq=1
showlen=0
rdelete=1
fixmasks=1
vmsFix=lambda wholeFile: '\\;'.join(wholeFile.split(';'))
megsize=lambda fileName: os.path.getsize(fileName)/1e6
if len(sys.argv)<2:
for rt,drs,files in os.walk(os.getcwd(),topdown=Fals... | 2.1875 | 2 |
winactivities/activities.py | forensicmatt/ActivitiesCacheParser | 3 | 25447 | <filename>winactivities/activities.py
import ujson
import binascii
from collections import OrderedDict
from winactivities.helpers import DbHandler, datetime_decode_1970_str
ACTIVITIES_SCHEMA = {
"tables": [
"Activity",
"Activity_PackageId",
"ActivityAssetCache",
"ActivityOperation",... | 2.359375 | 2 |
custom_components/tuneblade/tuneblade.py | spycle/tune_blade | 0 | 25448 | """TuneBlade API Client."""
import logging
import asyncio
import socket
from typing import Optional
import aiohttp
import async_timeout
TIMEOUT = 10
_LOGGER: logging.Logger = logging.getLogger(__package__)
HEADERS = {"Content-type": "application/json; charset=UTF-8"}
class TuneBladeApiClient:
def __init__(
... | 2.625 | 3 |
train.py | RuiShu/fast-style-transfer | 16 | 25449 | from config import args
from utils import delete_existing, get_img, get_img_files
import tensorbayes as tb
import tensorflow as tf
import numpy as np
import os
def push_to_buffer(buf, data_files):
files = np.random.choice(data_files, len(buf), replace=False)
for i, f in enumerate(files):
buf[i] = get_i... | 2.234375 | 2 |
Semana 07/frequencia.py | heltonricardo/grupo-estudos-maratonas-programacao | 0 | 25450 | n = int(input())
v = []
for i in range(n): v.append(int(input()))
s = sorted(set(v))
for i in s: print(f'{i} aparece {v.count(i)} vez (es)')
| 3.4375 | 3 |
TextGen/src/TextGen-2.py | fatemetkl/TextClassification-NLP-Forml_and_Informal | 0 | 25451 | import random
import os
from decimal import *
os.getcwd()
os.chdir('..')
os.chdir('..')
parent=os.getcwd()
#seed = 15
path1="Model/label2.2gram.lm"
filename1=os.path.join(parent,path1)
with open(filename1,'r',encoding='utf-8') as f:
text=f.read().split('\n')
dict_val={}
words=[]
new_text=[]
for i in range (0,l... | 3 | 3 |
pyFAI/average.py | fpwg/pyFAI | 1 | 25452 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Project: Azimuthal integration
# https://github.com/silx-kit/pyFAI
#
# Copyright (C) 2003-2018 European Synchrotron Radiation Facility, Grenoble,
# France
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of... | 1.507813 | 2 |
constants.py | texdarkstar/py3bot | 1 | 25453 | <filename>constants.py
from telnetlib import IAC, WILL, TTYPE, SB, SE
IS = chr(0).encode()
| 1.664063 | 2 |
schedule/views.py | AndrewSaltz/Lab_Schedule | 0 | 25454 | from django.shortcuts import render
import datetime
from datetime import date
import calendar
from schedule.models import Event, period_choices, cart_choice
from django.views.generic import UpdateView, TemplateView, ListView
from schedule.forms import ReservationForm
from django.http import HttpResponseRedirect, HttpRe... | 1.929688 | 2 |
scripts/sg-toolbox/SG-Glyph-CopyLayer.py | tphinney/science-gothic | 104 | 25455 | <gh_stars>100-1000
#FLM: Glyph: Copy Layer (TypeRig)
# ----------------------------------------
# (C) <NAME>, 2019 (http://www.kateliev.com)
# (C) Karandash Type Foundry (http://www.karandash.eu)
#-----------------------------------------
# www.typerig.com
# No warranties. By using this you agree
# that you use it at ... | 1.726563 | 2 |
gen.nginx.py | Frozen12/OnlineIDE | 2 | 25456 | import os
print("""
##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# https://www.nginx.com/resources/wiki/start/
# https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/
# https://wiki... | 2.34375 | 2 |
pycmbs/tests/test_license.py | pygeo/pycmbs | 9 | 25457 | # -*- coding: utf-8 -*-
"""
This file is part of pyCMBS.
(c) 2012- <NAME>
For COPYING and LICENSE details, please refer to the LICENSE file
"""
import os
import glob
import unittest
class TestCodingStandards(unittest.TestCase):
"""
test coding standards: check for license
"""
def test_PythonFiles_Have... | 2.671875 | 3 |
torch_geometric/utils/homophily.py | LingxiaoShawn/pytorch_geometric | 1 | 25458 | <reponame>LingxiaoShawn/pytorch_geometric<gh_stars>1-10
from typing import Union
import torch
from torch import Tensor
from torch_scatter import scatter_mean
from torch_sparse import SparseTensor
from torch_geometric.typing import Adj, OptTensor
def homophily(edge_index: Adj, y: Tensor, batch: OptTensor = None,
... | 2.53125 | 3 |
tt/maxvol/__init__.py | rballester/ttpy | 0 | 25459 | from _maxvol import *
| 1.210938 | 1 |
paxLibUL/convolution/__init__.py | PAX-ULaval/pax-libraries | 0 | 25460 | <gh_stars>0
# pylint: disable=wildcard-import
from .architectures import *
from .callbacks import *
from .datasets import *
from .visualisation import *
from .weights_init import *
| 1.09375 | 1 |
mstrio/api/migration.py | czyzq/mstrio-py | 1 | 25461 | from typing import Optional
import requests
from mstrio.connection import Connection
from mstrio.utils.error_handlers import ErrorHandler
@ErrorHandler(err_msg='Error while creating the package holder')
def create_package_holder(connection: Connection, project_id: Optional[str] = None,
err... | 2.484375 | 2 |
lomap/examples/ijrr2014_rec_hor/environment.py | xli4217/tltl_reward | 0 | 25462 | #! /usr/bin/env python
# Copyright (C) 2012-2015, <NAME> (<EMAIL>)
#
# This program 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; either version 2 of the License, or
# (at your option) any later version.
#... | 2.40625 | 2 |
scripts/dialent/task3/test.py | victorbocharov/factRuEval-2016 | 52 | 25463 | # This module deals with test data representation for the third task
#########################################################################################
import os
from dialent.common.util import normalize
from dialent.common.util import safeOpen
from dialent.objects.fact import Fact
#########################... | 2.359375 | 2 |
resources/namespace-check/index.py | aws-samples/eks-configrules-with-cdk | 1 | 25464 | <gh_stars>1-10
import authutils as auth
import os
import kubernetes
from kubernetes.client.rest import ApiException
import boto3
from botocore.exceptions import ClientError
from datetime import datetime, timedelta
from botocore import session
from awscli.customizations.eks.get_token import STSClientFactory, TokenGener... | 1.9375 | 2 |
test/test_todos.py | rajasgs/flask-rest-math-simple | 0 | 25465 | <reponame>rajasgs/flask-rest-math-simple<filename>test/test_todos.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# the above line is to avoid 'SyntaxError: Non-UTF-8 code starting with' error
'''
Created on
Course work:
@author: raja
Source:
https://realpython.com/testing-third-party-apis-with-mocks/
'''
# St... | 2.46875 | 2 |
maskrcnn_benchmark/modeling/roi_heads/box_head/loss.py | RyanXLi/OneshotDet | 16 | 25466 | <reponame>RyanXLi/OneshotDet<gh_stars>10-100
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import torch
from torch.nn import functional as F
from maskrcnn_benchmark.layers import smooth_l1_loss, SigmoidFocalLoss
from maskrcnn_benchmark.modeling.box_coder import BoxCoder
from maskrcnn_benchmar... | 1.75 | 2 |
morse_code.py | shwetabhsharan/leetcode | 0 | 25467 | """
Morse Code Implementation to tell unique pattern
Example:
Input: words = ["gin", "zen", "gig", "msg"]
Output: 2
Explanation:
The transformation of each word is:
"gin" -> "--...-."
"zen" -> "--...-."
"gig" -> "--...--."
"msg" -> "--...--."
There are 2 different transformations, "--...-." and "--...--.".
Notes
Th... | 4.125 | 4 |
nn.py | sumitsk/cspace_belief | 3 | 25468 | <reponame>sumitsk/cspace_belief
#!/usr/bin/env python -W ignore::DeprecationWarning
import numpy as np
import os
import knn
import warnings
warnings.filterwarnings("ignore")
from sklearn.neighbors import NearestNeighbors, LSHForest
if __name__ == '__main__':
files = (['env_shelf01', 'env_table1', 'env_table3',... | 2 | 2 |
day03/path-02/code.py | zeddarn/advent-of-code-2021 | 0 | 25469 | import os
filename = os.path.dirname(__file__) + "\\input"
arrayList = []
with open(filename) as file:
for line in file:
arrayList.append(line.rstrip())
width = len(arrayList[0].rstrip())
print(f'len {width}')
gamma_nums = arrayList
for r in range(width):
start = 0
x = []
for line in gamma_num... | 3.15625 | 3 |
keymaster/__main__.py | shiroyuki/spymaster | 0 | 25470 | import os, sys
sys.path.insert(0, os.path.join(os.getcwd(), '..', 'Imagination'))
sys.path.insert(0, os.path.join(os.getcwd(), '..', 'xmode'))
from keymaster.starter import activate
activate() | 1.875 | 2 |
Server/Python/src/dbs/dao/MySQL/DataTier/List.py | vkuznet/DBS | 8 | 25471 | #!/usr/bin/env python
"""
This module provides DataTier.List data access object.
"""
from dbs.dao.Oracle.DataTier.List import List as OraDataTierList
class List(OraDataTierList):
pass
| 1.703125 | 2 |
backoffice/utils/constant.py | MedPy-C/backend | 0 | 25472 | <gh_stars>0
from enum import Enum
class RoleLevel(Enum):
OWNER = 0
ADMIN = 1
USER = 3
class Status(Enum):
ACTIVE = 1
INACTIVE = 0
class AccessLevel(Enum):
ADMIN = 0
USER = 1
class URL():
ACTIVATION = '/backoffice/invitation/activate/'
| 2.53125 | 3 |
pages/migrations/0018_auto_20171102_1809.py | Vicarium/amy_site | 0 | 25473 | <gh_stars>0
# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2017-11-02 18:09
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import wagtail.wagtailcore.fields
class Migration(migrations.Migration):
dependencies = [
('wagtailimages... | 1.6875 | 2 |
baselineCorrection.py | sinaravi/Baseline-Correction | 1 | 25474 | <gh_stars>1-10
import peakutils
from peakutils.plot import plot as pplot
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
from scipy import sparse
import math
from scipy.sparse.linalg import spsolve
PATH = "PDha_1.csv" # csv or txt format
df = pd.read_csv( PATH, sep="\t", skiprows=[0, ... | 2.875 | 3 |
tests/core/test_base_component.py | strickvl/zenml | 1,275 | 25475 | <reponame>strickvl/zenml
# Copyright (c) ZenML GmbH 2021. 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
#
# U... | 2.21875 | 2 |
courses/migrations/0009_alter_skills_program_duration_and_more.py | sisekelohub/sisekelo | 1 | 25476 | <reponame>sisekelohub/sisekelo
# Generated by Django 4.0 on 2022-01-02 21:51
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('courses', '0008_alter_learnership_duration'),
]
operations = [
migrations.AlterField(
model_name='s... | 1.5625 | 2 |
model/utils.py | Gofinge/HF | 7 | 25477 | <reponame>Gofinge/HF
import numpy as np
from keras import backend as K
from sklearn.preprocessing import MinMaxScaler
import tensorflow as tf
import csv
from sklearn.neighbors import KDTree
import matplotlib.pyplot as plt
from model.config import *
from tensorflow.python.ops import *
import seaborn as sns
import pandas... | 2.78125 | 3 |
phasor/optics/space.py | mccullerlp/OpenLoop | 5 | 25478 | <reponame>mccullerlp/OpenLoop<gh_stars>1-10
# -*- coding: utf-8 -*-
"""
"""
from __future__ import division, print_function, unicode_literals
#from phasor.utilities.print import print
import declarative as decl
from . import bases
from . import ports
from . import standard_attrs
class Space(
bases.OpticalCo... | 2.09375 | 2 |
tests/ci/release.py | BanditDangzw/ClickHouse | 0 | 25479 | <gh_stars>0
#!/usr/bin/env python
from contextlib import contextmanager
from typing import List, Optional
import argparse
import logging
from git_helper import commit
from version_helper import (
FILE_WITH_VERSION_PATH,
ClickHouseVersion,
VersionType,
git,
get_abs_path,
get_version_from_repo,... | 2.28125 | 2 |
src/controller.py | shaoeric/torch-atom | 28 | 25480 | <filename>src/controller.py<gh_stars>10-100
import torch
import torch.nn as nn
from torch import optim
from src.losses import LossWrapper
from typing import List
__all__ = ["Controller"]
class Controller(object):
def __init__(self,
loss_wrapper: LossWrapper,
model: nn.Module,
optimizer... | 2.875 | 3 |
REDServer/gunicorn.conf.py | illusioneering/RED | 1 | 25481 | bind = "0.0.0.0:80"
| 1.203125 | 1 |
helper/cLog.py | aub-cp-training/Discord-Bot | 0 | 25482 | <filename>helper/cLog.py
from helper.cTime import MyDate
# ------------------ [ elog() ] ------------------ #
# Logs the error message into the "error_log.log" file
# States what file, call and exception created the error log
def elog(ex, stk):
fs = open("./logs/error_log.log", "a")
frame = str(stk[0][... | 2.953125 | 3 |
src/pandas_profiling_study/report/structure/variables/__init__.py | lucasiscoviciMoon/pandas-profiling-study | 0 | 25483 | <gh_stars>0
from ....report.structure.variables.render_boolean import render_boolean
from ....report.structure.variables.render_categorical import (
render_categorical,
)
from ....report.structure.variables.render_common import render_common
from ....report.structure.variables.render_complex import render_complex
f... | 1.226563 | 1 |
venv/lib/python3.9/site-packages/py2app/bootstrap/virtualenv_site_packages.py | dequeb/asmbattle | 1 | 25484 | <reponame>dequeb/asmbattle
def _site_packages(prefix, real_prefix, global_site_packages):
import os
import site
import sys
paths = []
paths.append(
os.path.join(prefix, "lib", "python" + sys.version[:3], "site-packages")
)
if os.path.join(".framework", "") in os.path.join(prefix, "... | 1.984375 | 2 |
pytorch/fnetar.py | q1park/tempformer-xl | 2 | 25485 | <reponame>q1park/tempformer-xl<filename>pytorch/fnetar.py<gh_stars>1-10
import torch
import torch.nn as nn
from modules.xlmask import XlMask
from modules.xlmemory import XlMemory
from modules.xlposition import XlPosition
from xllayer import XlLayer
from fnetarlayer import FnetarLayer
class Fnetar(nn.Module):
def ... | 2.359375 | 2 |
nomad/images/migrations/0003_auto_20181218_2248.py | jss8882/nomad | 0 | 25486 | <reponame>jss8882/nomad<gh_stars>0
# Generated by Django 2.0.9 on 2018-12-18 13:48
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('images', '0002_auto_20181218_2029'),
]
operations = [
migrations.RenameField(
model_name='like',
... | 1.554688 | 2 |
src/main.py | mmData/Hack4Good | 0 | 25487 | <filename>src/main.py
"""
Created on Wed Nov 07 2018
@author: Analytics Club at ETH <EMAIL>
Example structure of the main file
"""
from src.data_extraction import load_data, save_data, merging, xml2df
from src.preprocessing import text_process, anonymization, clean_up, detect_language
def extract_data(program, mode... | 2.609375 | 3 |
dcodex_lectionary/migrations/0031_auto_20201119_2140.py | rbturnbull/dcodex_lectionary | 0 | 25488 | # Generated by Django 3.0.11 on 2020-11-19 10:40
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('dcodex_lectionary', '0030_auto_20201119_2131'),
]
operations = [
migrations.RenameField(
model_name='movableday',
old_name=... | 1.75 | 2 |
misc/context_processors.py | ilblackdragon/django-misc | 6 | 25489 | from django.conf import settings
def useful_constants(request):
"""
This workaround useful if you want use {% if var == None %}, because
{% if not var %} First {% else %} Second {% endif %} will show the result:
var = None => First
var = False => First
var = True => True
"""
retur... | 2.21875 | 2 |
ocdskingfisher/sources/digiwhist_germany.py | odscjames/lhs-alpha | 0 | 25490 | <reponame>odscjames/lhs-alpha
from ocdskingfisher.sources.digiwhist_base import DigiwhistBaseSource
class DigiwhistGermanyRepublicSource(DigiwhistBaseSource):
publisher_name = '<NAME>'
url = 'https://opentender.eu/download'
source_id = 'digiwhist_germany'
def get_data_url(self):
return 'https... | 1.8125 | 2 |
catfacts/facts03.py | mikerauer/pyb-class | 0 | 25491 | <reponame>mikerauer/pyb-class
#!/usr/bin/python3
#import always go at the top of your code
import requests
def main():
'''run time code'''
#create r, which is out requests object
r = requests.get('http://cat-fact.herokuapp.com/facts')
#catfact is our iterable -- that just means it will take on the v... | 3.6875 | 4 |
train_isic18.py | brieberg/keras-deeplab-v3-plus | 0 | 25492 | import numpy as np
import os
from utils import *
from keras.preprocessing.image import ImageDataGenerator
from keras.preprocessing import image
from model import Deeplabv3
import keras
from tensorflow.python.keras.layers import *
from tensorflow.python.keras.layers.convolutional import Deconvolution2D
from numpy impor... | 2.25 | 2 |
3rd_party/nek5000/short_tests/lib/nekBinRun.py | RonRahaman/nekRS | 1 | 25493 | <filename>3rd_party/nek5000/short_tests/lib/nekBinRun.py
import os
import sys
from warnings import warn
from subprocess import call, check_call, PIPE, STDOUT, Popen, CalledProcessError
from pathlib import Path
def run_meshgen(command, stdin, cwd, verbose=False):
base_command = Path(command).name
logfile = Pa... | 2.09375 | 2 |
main/cargo-bootstrap/template.py | RoastVeg/cports | 0 | 25494 | <reponame>RoastVeg/cports
pkgname = "cargo-bootstrap"
pkgver = "1.60.0"
pkgrel = 0
# satisfy runtime dependencies
hostmakedepends = ["curl"]
depends = ["!cargo"]
pkgdesc = "Bootstrap binaries of Rust package manager"
maintainer = "q66 <<EMAIL>>"
license = "MIT OR Apache-2.0"
url = "https://rust-lang.org"
source = f"htt... | 1.476563 | 1 |
reagent/core/fb_checker.py | alexnikulkov/ReAgent | 1 | 25495 | <reponame>alexnikulkov/ReAgent
#!/usr/bin/env python3
import importlib.util
def is_fb_environment():
if importlib.util.find_spec("fblearner") is not None:
return True
return False
IS_FB_ENVIRONMENT = is_fb_environment()
| 2 | 2 |
src/looper.py | darklab8/darklab_darkbot | 1 | 25496 | <reponame>darklab8/darklab_darkbot
"module for background tasks in the loop"
import datetime
import discord
from discord.ext import commands, tasks
from threading import Thread
import asyncio
import time
from src.views import View
from src.data_model import DataModel
import src.settings as settings
from src.storage i... | 2.34375 | 2 |
Python/FromUniversity/sqlite3/select.py | programmer-666/Codes | 0 | 25497 | <filename>Python/FromUniversity/sqlite3/select.py
import sqlite3 as slt
""" fetchone - tek tek alır. fetchmany - belirtilen sayı kadar alır. """
db = slt.connect("user.db")
print(db.cursor().execute("SELECT * FROM USERPASSWORDS").fetchall())
#print(db.cursor().execute("SELECT * FROM USERNAMES").fetchmany(2))
#print(db.... | 3.0625 | 3 |
RestPy/ixnetwork_restpy/testplatform/sessions/ixnetwork/vport/protocols/pimsm/router/interface/joinprune/joinprune.py | ralfjon/IxNetwork | 0 | 25498 |
# Copyright 1997 - 2018 by IXIA Keysight
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, p... | 1.578125 | 2 |
tools/terminal.py | adelsonllima/djangoplus | 21 | 25499 | # -*- coding: utf-8 -*-
import os
import sys
import time
import random
from subprocess import Popen, PIPE
from django.utils import termcolors
TYPING_SPEED = 50
def simulate_command_type(commands, shell=False):
for command in commands.split('&& '):
if not command.startswith('source'):
simulate... | 2.265625 | 2 |