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 |
|---|---|---|---|---|---|---|
utils/parser.py | scalar42/scholar-alerts-assistant | 0 | 13000 | <filename>utils/parser.py<gh_stars>0
from html.parser import HTMLParser
class Paper():
def __init__(self):
self.title = ""
self.source_link = ""
self.authr_and_pub = ""
# self.publication = ""
self.abstract = ""
self.star_link = ""
def add_title(self, title):
... | 3.125 | 3 |
ApendixI-Games/StacklessPSP-2.5.2_R1/pspsnd.py | MelroLeandro/Matematica-Discreta-para-Hackers-ipnyb | 0 | 13001 | """Wrapper for pygame, which exports the PSP Python API on non-PSP systems."""
__author__ = "<NAME>, <<EMAIL>>"
import pygame
pygame.init()
_vol_music = 255
_vol_sound = 255
def setMusicVolume(vol):
global _vol_music
if vol >= 0 and vol <= 255:
_vol_music = vol
pygame.mixer.music.set_vol... | 2.859375 | 3 |
utility_parseCMUMovie.py | bipulkumar22/pyTextClassification | 11 | 13002 | <filename>utility_parseCMUMovie.py
import os
import csv
import ast
# used to generate folder-seperated corpus from CMUMovie dataset
# just type python utility_parseCMUMovie.py in a terminal and the data will be downloaded and split to subfolders in the moviePlots/ path
os.system("wget http://www.cs.cmu.edu/~ark/pers... | 2.9375 | 3 |
model.py | luqifeng/CVND---Image-Captioning-Project | 0 | 13003 | import torch
import torch.nn as nn
import torchvision.models as models
import numpy as np
class EncoderCNN(nn.Module):
def __init__(self, embed_size):
super(EncoderCNN, self).__init__()
resnet = models.resnet50(pretrained=True)
for param in resnet.parameters():
param.requires_gr... | 2.734375 | 3 |
App/items/models/items.py | fmgar/BlackMarker-API | 0 | 13004 | """Items model. """
# Django
from django.db import models
# Utilities
from App.utils.models import BlackMarketModel
# Models
from .category import Category
from .unit import Unit
from .owner import Owner
class Item(BlackMarketModel):
"""Items model.
Is a model to items we goin to sell """
name = mode... | 2.671875 | 3 |
run_all.py | yuriisthebest/Advent-of-Code | 0 | 13005 | <filename>run_all.py
import json
import time
from multiprocessing import Process
from utils.paths import PATHS
from years.AoC2021.tasks import TASKS2021
# Constants
PARALLEL_COMPUTATION = True
TASKS = {
2021: TASKS2021
}
def asses_task(task: type, answers: dict, year: int) -> None:
"""
Run a task 4 times... | 2.828125 | 3 |
python/edl/tests/unittests/master_client_test.py | WEARE0/edl | 90 | 13006 | <gh_stars>10-100
# Copyright (c) 2020 PaddlePaddle 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 ... | 2.046875 | 2 |
src/commercetools/services/types.py | BramKaashoek/commercetools-python-sdk | 0 | 13007 | <reponame>BramKaashoek/commercetools-python-sdk
import typing
from commercetools import schemas, types
from commercetools.services import abstract
from commercetools.typing import OptionalListStr
__all__ = ["TypeService"]
class TypeDeleteSchema(abstract.AbstractDeleteSchema):
pass
class TypeQuerySchema(abstra... | 2 | 2 |
augraphy/augmentations/noisetexturize.py | RyonSayer/augraphy | 36 | 13008 | import random
import cv2
import numpy as np
from augraphy.base.augmentation import Augmentation
class NoiseTexturize(Augmentation):
"""Creates a random noise based texture pattern to emulate paper textures.
Consequently applies noise patterns to the original image from big to small.
:param sigma_range:... | 3.59375 | 4 |
plugins/modules/bigip_sslo_config_ssl.py | kevingstewart/f5_sslo_ansible | 7 | 13009 | <gh_stars>1-10
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright: (c) 2021, kevin-dot-g-dot-stewart-at-gmail-dot-com
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Version: 1.0.1
#### Updates:
#### 1.0.1 - added 9.0 support
# - changed max version
# ... | 1.390625 | 1 |
nemo/pipelines.py | simonsobs/nemo | 2 | 13010 | <gh_stars>1-10
"""
This module defines pipelines - sets of tasks in nemo that we sometimes want to do on different inputs
(e.g., real data or simulated data).
"""
import os
import sys
import glob
import shutil
import time
import astropy.io.fits as pyfits
import astropy.table as atpy
from astLib import astWCS
import ... | 2.171875 | 2 |
pypkg-gen.py | GameMaker2k/Neo-Hockey-Test | 1 | 13011 | <gh_stars>1-10
#!/usr/bin/env python
'''
This program is free software; you can redistribute it and/or modify
it under the terms of the Revised BSD License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILIT... | 1.992188 | 2 |
10/testtime.py | M0nica/python-foundations | 0 | 13012 | <filename>10/testtime.py
import time
print (time.strftime("%B %e, %Y"))
# Guides:
# how to formate date:
# http://strftime.net/
# how to use time:
# http://www.cyberciti.biz/faq/howto-get-current-date-time-in-python/
| 2.96875 | 3 |
2020/02/Teil 2 - V01.py | HeWeMel/adventofcode | 1 | 13013 | import re
with open('input.txt', 'r') as f:
pw_ok=0
for line in f:
(rule,s,space_and_pw) = line.partition(':')
(lowhigh,s,c) = rule.partition(' ')
(low,s,high) = lowhigh.partition('-')
pw=space_and_pw[1:-1]
c1=pw[int(low)-1]
c2=pw[int(high)-1]
if (c1==c ... | 3.1875 | 3 |
slides_manager/openslide_engine.py | crs4/ome_seadragon | 31 | 13014 | # Copyright (c) 2019, CRS4
#
# 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, publish, distribu... | 1.804688 | 2 |
pyppy/config.py | maehster/pyppy | 5 | 13015 | <gh_stars>1-10
"""Global config management
This module provides functions for initializing, accessing and destroying
a global config object. You can initialize a global config from any object.
However, in the context of pyppy, only the instance attributes of the
object are used and work with the decorators ``fill_args... | 3.453125 | 3 |
LeetCode/3_sum.py | milkrong/Basic-Python-DS-Algs | 0 | 13016 | def three_sum(nums):
"""
Given an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0?
Find all unique triplets in the array which gives the sum of zero.
:param nums: list[int]
:return: list[list[int]]
"""
if len(nums) < 3:
return []
nums.sort()
... | 3.90625 | 4 |
src/tests/dao_test/guild_roles_dao_test.py | Veloxization/likahbot | 0 | 13017 | <gh_stars>0
import unittest
import os
from dao.guild_roles_dao import GuildRolesDAO
from dao.guild_role_categories_dao import GuildRoleCategoriesDAO
class TestGuildRolesDAO(unittest.TestCase):
def setUp(self):
self.db_addr = "database/test_db.db"
os.popen(f"sqlite3 {self.db_addr} < database/schema.... | 2.46875 | 2 |
qcic.py | milkllc/qcic | 0 | 13018 | <filename>qcic.py<gh_stars>0
import picamera
import datetime
import os
delcount = 2
def check_fs():
global delcount
st = os.statvfs('/')
pct = 100 - st.f_bavail * 100.0 / st.f_blocks
print pct, "percent full"
if pct > 90:
# less than 10% left, delete a few minutes
files = os.... | 2.453125 | 2 |
exercises/allergies/allergies.py | akashsara/python | 0 | 13019 | class Allergies(object):
def __init__(self, score):
pass
def allergic_to(self, item):
pass
@property
def lst(self):
pass
| 2.15625 | 2 |
forge/mock_handle.py | ujjwalsh/pyforge | 7 | 13020 | <filename>forge/mock_handle.py
from .handle import ForgeHandle
class MockHandle(ForgeHandle):
def __init__(self, forge, mock, behave_as_instance=True):
super(MockHandle, self).__init__(forge)
self.mock = mock
self.behaves_as_instance = behave_as_instance
self._attributes = {}
... | 2.609375 | 3 |
RecoBTag/PerformanceDB/python/measure/Pool_mistag110118.py | ckamtsikis/cmssw | 852 | 13021 | <gh_stars>100-1000
import FWCore.ParameterSet.Config as cms
from CondCore.DBCommon.CondDBCommon_cfi import *
PoolDBESSourceMistag110118 = cms.ESSource("PoolDBESSource",
CondDBCommon,
toGet = cms.VPSet(
#
# working points
#
cms.PSet(
recor... | 1.351563 | 1 |
src/ScheduleEvaluation.py | franTarkenton/replication_health_check | 0 | 13022 | <reponame>franTarkenton/replication_health_check
'''
Created on Nov 22, 2018
@author: kjnether
methods that evaluate the given schedule
'''
import logging
import FMEUtil.FMEServerApiData
import re
class EvaluateSchedule(object):
def __init__(self, schedulesData):
self.logger = logging.... | 2.640625 | 3 |
podcastista/ListenNowTab.py | andrsd/podcastista | 0 | 13023 | from PyQt5 import QtWidgets, QtCore
from podcastista.ShowEpisodeWidget import ShowEpisodeWidget
from podcastista.FlowLayout import FlowLayout
class FillThread(QtCore.QThread):
""" Worker thread for loading up episodes """
def __init__(self, spotify, shows):
super().__init__()
self._spotify = ... | 2.359375 | 2 |
ggpy/cruft/prolog_pyparser.py | hobson/ggpy | 1 | 13024 | import pyparsing as pp
#relationship will refer to 'track' in all of your examples
relationship = pp.Word(pp.alphas).setResultsName('relationship')
number = pp.Word(pp.nums + '.')
variable = pp.Word(pp.alphas)
# an argument to a relationship can be either a number or a variable
argument = number | variable
# argument... | 3.390625 | 3 |
Imaging/Core/Testing/Python/ReslicePermutations.py | inviCRO/VTK | 0 | 13025 | #!/usr/bin/env python
import vtk
from vtk.util.misc import vtkGetDataRoot
VTK_DATA_ROOT = vtkGetDataRoot()
# this script tests vtkImageReslice with various axes permutations,
# in order to cover a nasty set of "if" statements that check
# the intersections of the raster lines with the input bounding box.
# Image pipel... | 2.265625 | 2 |
neuronlp2/nn/utils.py | ntunlp/ptrnet-depparser | 9 | 13026 | import collections
from itertools import repeat
import torch
import torch.nn as nn
import torch.nn.utils.rnn as rnn_utils
def _ntuple(n):
def parse(x):
if isinstance(x, collections.Iterable):
return x
return tuple(repeat(x, n))
return parse
_single = _ntuple(1)
_pair = _ntuple(2)
... | 2.828125 | 3 |
Data_Analyst/Step_2_Intermediate_Python_and_Pandas/2_Data_Analysis_with_Pandas_Intermediate/3_Introduction_to_Pandas/7_Selecting_a_row/script.py | ustutz/dataquest | 8 | 13027 | import pandas as pandas_Pandas_Module
class Script:
@staticmethod
def main():
food_info = pandas_Pandas_Module.read_csv("../food_info.csv")
print(str(food_info.dtypes))
Script.main() | 2.234375 | 2 |
examples/fire.py | pombreda/py-lepton | 7 | 13028 | <filename>examples/fire.py
#############################################################################
#
# Copyright (c) 2008 by <NAME> and contributors
# All Rights Reserved.
#
# This software is subject to the provisions of the MIT License
# A copy of the license should accompany this distribution.
# THE SOFTWARE I... | 2.5625 | 3 |
landspout/cli.py | gmr/landspout | 0 | 13029 | # coding=utf-8
"""
Command Line Interface
======================
"""
import argparse
import logging
import os
from os import path
import sys
from landspout import core, __version__
LOGGER = logging.getLogger('landspout')
LOGGING_FORMAT = '[%(asctime)-15s] %(levelname)-8s %(name)-15s: %(message)s'
def exit_applicat... | 2.59375 | 3 |
examples/test_cross.py | rballester/ttpy | 0 | 13030 | <gh_stars>0
import sys
sys.path.append('../')
import numpy as np
import tt
d = 30
n = 2 ** d
b = 1E3
h = b / (n + 1)
#x = np.arange(n)
#x = np.reshape(x, [2] * d, order = 'F')
#x = tt.tensor(x, 1e-12)
x = tt.xfun(2, d)
e = tt.ones(2, d)
x = x + e
x = x * h
sf = lambda x : np.sin(x) / x #Should be rank 2
y = tt.mul... | 2.234375 | 2 |
phone2board.py | brandjamie/phone2board | 0 | 13031 | import tornado.httpserver
import tornado.ioloop
import tornado.options
import tornado.web
import tornado.auth
import tornado.escape
import os.path
import logging
import sys
import urllib
import json
from uuid import uuid4
from tornado.options import define, options
define("port", default=8000, help="run on the given... | 2.359375 | 2 |
scripts/plotRUC.py | akrherz/radcomp | 3 | 13032 | <filename>scripts/plotRUC.py
import matplotlib.pyplot as plt
import netCDF4
import numpy
nc = netCDF4.Dataset("data/ructemps.nc")
data = nc.variables["tmpc"][17, :, :]
nc.close()
(fig, ax) = plt.subplots(1, 1)
ax.imshow(numpy.flipud(data))
fig.savefig("test.png")
| 2.53125 | 3 |
tools/draw_cal_lr_ablation.py | twangnh/Calibration_mrcnn | 87 | 13033 |
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import math
from matplotlib.ticker import FormatStrFormatter
from matplotlib import scale as mscale
from matplotlib import transforms as mtransforms
# z = [0,0.1,0.3,0.9,1,2,5]
z = [7.8, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 200, 300, 400, 500, 6... | 2.34375 | 2 |
discord bot.py | salihdursun1/dc-bot | 0 | 13034 | import discord
from discord.ext.commands import Bot
TOKEN = "<discordtoken>"
client = discord.Client()
bot = Bot(command_prefix="!")
@bot.event
async def on_ready():
print("Bot Hazır " + str(bot.user))
@bot.event
async def on_message(message):
if message.author == client.user:
ret... | 2.9375 | 3 |
Lesson08/problem/problem_optional_pandas.py | AlexMazonowicz/PythonFundamentals | 2 | 13035 | import pandas as pd
# Global variable to set the base path to our dataset folder
base_url = '../dataset/'
def update_mailing_list_pandas(filename):
"""
Your docstring documentation starts here.
For more information on how to proper document your function, please refer to the official PEP... | 3.203125 | 3 |
example_problems/tutorial/euler_dir/services/is_eulerian_server.py | romeorizzi/TALight | 4 | 13036 | <filename>example_problems/tutorial/euler_dir/services/is_eulerian_server.py
#!/usr/bin/env python3
# "This service will check your statement that a directed graph you provide us admits an eulerian walk (of the specified type)""
from os import EX_TEMPFAIL
from sys import stderr, exit
import collections
from multila... | 3.234375 | 3 |
get_vocab.py | Amir-Mehrpanah/hgraph2graph | 182 | 13037 | <gh_stars>100-1000
import sys
import argparse
from hgraph import *
from rdkit import Chem
from multiprocessing import Pool
def process(data):
vocab = set()
for line in data:
s = line.strip("\r\n ")
hmol = MolGraph(s)
for node,attr in hmol.mol_tree.nodes(data=True):
smiles =... | 2.734375 | 3 |
web_app/cornwall/views.py | blackradley/heathmynd | 0 | 13038 | # -*- coding: utf-8 -*-
""" test """
from __future__ import unicode_literals
from django.template.loader import get_template
from django.contrib import messages
# Create your views here.
from django.http import HttpResponse
def index(request):
""" index """
template = get_template('cornwall/index.html')
m... | 2.15625 | 2 |
vshare/user_/urls.py | jeyrce/vshare | 4 | 13039 | # coding = utf-8
# env = python3.5.2
# author = lujianxin
# time = 201x-xx-xx
# purpose= - - -
from django.urls import re_path
from . import views
urlpatterns = [
# 此模块下的路径映射
re_path(r'usercenter$', views.UserCenter.as_view()),
re_path(r'details/(\d+)$', views.UserDetails.as_view()),
re_path(r'... | 2.03125 | 2 |
Day_3/task2.py | DjaffDjaff/AdventOfCode | 2 | 13040 | <filename>Day_3/task2.py
import math
oxygen_rating = 0
co2_rating = 0
length = 0
n_bits = 12
common = [0] * n_bits
anti = [0] * n_bits
numbers = []
def new_bitmap(old_list):
new_list = [0] * n_bits
for num in old_list:
for j, bit in enumerate(num):
new_list[j] += bit
... | 3.59375 | 4 |
polyjuice/filters_and_selectors/perplex_filter.py | shwang/polyjuice | 38 | 13041 | <filename>polyjuice/filters_and_selectors/perplex_filter.py<gh_stars>10-100
import math
import numpy as np
from munch import Munch
from transformers import GPT2LMHeadModel, GPT2TokenizerFast
import torch
from copy import deepcopy
#########################################################################
### compute pe... | 1.953125 | 2 |
Python/example_controllers/visual_perception/flow.py | ricklentz/tdw | 0 | 13042 | from tdw.controller import Controller
from tdw.tdw_utils import TDWUtils
from tdw.add_ons.image_capture import ImageCapture
from tdw.backend.paths import EXAMPLE_CONTROLLER_OUTPUT_PATH
"""
Get the _flow pass.
"""
c = Controller()
object_id_0 = c.get_unique_id()
object_id_1 = c.get_unique_id()
object_id_2 = c.get_uniq... | 2.3125 | 2 |
main.py | pepetox/gae-angular-materialize | 1 | 13043 | <reponame>pepetox/gae-angular-materialize
# Copyright 2013 Google, Inc
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless re... | 2.296875 | 2 |
config.py | laundmo/counter-generator | 0 | 13044 | <reponame>laundmo/counter-generator
from sys import platform
try:
from yaml import CSafeLoader as Loader # use the C loader when possible
except ImportError:
from yaml import SafeLoader as Loader
import yaml
with open("config.yml") as f:
config = yaml.load(f, Loader=Loader) # load the config yaml
if pl... | 2.625 | 3 |
configs/sem_fpn/onaho_fpn.py | xiong-jie-y/mmsegmentation | 1 | 13045 | <reponame>xiong-jie-y/mmsegmentation
_base_ = [
'../_base_/models/fpn_r50.py', '../_base_/datasets/onaho.py',
'../_base_/default_runtime.py', '../_base_/schedules/schedule_160k.py'
]
model = dict(decode_head=dict(num_classes=2))
| 1.289063 | 1 |
config.py | dhkim2810/MaskedDatasetCondensation | 0 | 13046 | def get_default_convnet_setting():
net_width, net_depth, net_act, net_norm, net_pooling = 128, 3, 'relu', 'instancenorm', 'avgpooling'
return net_width, net_depth, net_act, net_norm, net_pooling
def get_loops(ipc):
# Get the two hyper-parameters of outer-loop and inner-loop.
# The following values are ... | 2.390625 | 2 |
jgem/dataset/__init__.py | kensugino/JUGEMu | 0 | 13047 | """
Expression Dataset for analysis of matrix (RNASeq/microarray) data with annotations
"""
import pandas as PD
import numpy as N
from matplotlib import pylab as P
from collections import OrderedDict
from ast import literal_eval
# from ..plot.matrix import matshow_clustered
class ExpressionSet(object):
def... | 2.484375 | 2 |
tests/test_sql.py | YPlan/django-perf-rec | 148 | 13048 | <reponame>YPlan/django-perf-rec<gh_stars>100-1000
from __future__ import annotations
from django_perf_rec.sql import sql_fingerprint
def test_empty():
assert sql_fingerprint("") == ""
assert sql_fingerprint("\n\n \n") == ""
def test_select():
assert sql_fingerprint("SELECT `f1`, `f2` FROM `b`") == "... | 2.203125 | 2 |
src/user_auth_api/serializers.py | Adstefnum/mockexams | 0 | 13049 | <filename>src/user_auth_api/serializers.py
from rest_framework import serializers
from user_auth_api.models import User
# User Serializer
class UserSerializer(serializers.ModelSerializer):
class Meta:
model = User
fields = [
'user_name',
'email',
'current_jamb_score',
... | 2.5 | 2 |
cenv_script/cenv_script.py | technic/cenv_script | 0 | 13050 | <gh_stars>0
"""Main module."""
import json
import os
import re
import shutil
import subprocess
import sys
from pathlib import Path
from typing import List, Optional
import yaml
ENV_FILE = "environment.yml"
class CondaEnvException(Exception):
pass
def find_environment_file():
p = Path(os.getcwd()).resolve... | 2.5625 | 3 |
cv_utils/cv_util_node.py | OAkyildiz/cibr_img_processing | 0 | 13051 | import sys
import rospy
import types
#from std_msgs.msg import String
from sensor_msgs.msg import Image
from cibr_img_processing.msg import Ints
from cv_bridge import CvBridge, CvBridgeError
#make int msgs
#TODO: get the img size from camera_indo topics
class CVUtilNode: # abstarct this, it can easily work with other ... | 2.640625 | 3 |
pokepay/request/get_shop.py | pokepay/pokepay-partner-python-sdk | 0 | 13052 | <filename>pokepay/request/get_shop.py
# DO NOT EDIT: File is generated by code generator.
from pokepay_partner_python_sdk.pokepay.request.request import PokepayRequest
from pokepay_partner_python_sdk.pokepay.response.shop_with_accounts import ShopWithAccounts
class GetShop(PokepayRequest):
def __init__(self, sho... | 1.929688 | 2 |
clearml/backend_interface/setupuploadmixin.py | arielleoren/clearml | 2,097 | 13053 | from abc import abstractproperty
from ..backend_config.bucket_config import S3BucketConfig
from ..storage.helper import StorageHelper
class SetupUploadMixin(object):
log = abstractproperty()
storage_uri = abstractproperty()
def setup_upload(
self, bucket_name, host=None, access_key=None, sec... | 2.5625 | 3 |
tests/test_parser.py | szymon6927/parcels-parser | 0 | 13054 | import os
import unittest
import pandas as pd
from application.ParcelsParser import ParcelsParser
class TestPracelsParser(unittest.TestCase):
def setUp(self):
self.parser = ParcelsParser("./test_cadastral_parcels.tsv", "cadastral_parcel_identifier")
def test_if_file_exist(self):
file_path = ... | 3.0625 | 3 |
dataStructures/complete.py | KarlParkinson/practice | 0 | 13055 | import binTree
import queue
def complete(tree):
q = queue.Queue()
nonFull = False
q.enqueue(tree)
while (not q.isEmpty()):
t = q.dequeue()
if (t.getLeftChild()):
if (nonFull):
return False
q.enqueue(t.getLeftChild())
if (t.getLeftChild() ... | 3.671875 | 4 |
sd_maskrcnn/sd_maskrcnn/gop/src/eval_bnd.py | marctuscher/cv_pipeline | 1 | 13056 | # -*- encoding: utf-8
"""
Copyright (c) 2014, <NAME>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
noti... | 1.773438 | 2 |
ctr_prediction/datasets/Amazon/AmazonElectronics_x1/convert_amazonelectronics_x1.py | jimzhu/OpenCTR-benchmarks | 59 | 13057 | import pickle
import pandas as pd
# cat aa ab ac > dataset.pkl from https://github.com/zhougr1993/DeepInterestNetwork
with open('dataset.pkl', 'rb') as f:
train_set = pickle.load(f, encoding='bytes')
test_set = pickle.load(f, encoding='bytes')
cate_list = pickle.load(f, encoding='bytes')
user_count, i... | 2.609375 | 3 |
email_extras/admin.py | maqmigh/django-email-extras | 33 | 13058 |
from email_extras.settings import USE_GNUPG
if USE_GNUPG:
from django.contrib import admin
from email_extras.models import Key, Address
from email_extras.forms import KeyForm
class KeyAdmin(admin.ModelAdmin):
form = KeyForm
list_display = ('__str__', 'email_addresses')
... | 1.96875 | 2 |
Tableau-Supported/Python/insert_data_with_expressions.py | TableauKyle/hyper-api-samples | 73 | 13059 | <reponame>TableauKyle/hyper-api-samples<filename>Tableau-Supported/Python/insert_data_with_expressions.py
# -----------------------------------------------------------------------------
#
# This file is the copyrighted property of Tableau Software and is protected
# by registered patents and other applicable U.S. and i... | 2.125 | 2 |
dumplogs/bin.py | xinhuagu/dumplogs | 1 | 13060 | import boto3
import argparse
import os,sys
def main(argv=None):
argv = (argv or sys.argv)[1:]
parser = argparse.ArgumentParser(description='dump all aws log streams into files')
parser.add_argument("--profile",
dest="aws_profile",
type=str,
... | 2.5625 | 3 |
ch5/gaussian_mixture.py | susantamoh84/HandsOn-Unsupervised-Learning-with-Python | 25 | 13061 | import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.datasets import make_blobs
from sklearn.mixture import GaussianMixture
from sklearn.cluster import KMeans
from matplotlib.patches import Ellipse
# For reproducibility
np.random.seed(1000)
nb_samples = 300
nb_centers = 2
if __na... | 2.8125 | 3 |
shipyard2/shipyard2/rules/images/merge_image.py | clchiou/garage | 3 | 13062 | <reponame>clchiou/garage
__all__ = [
'DEFAULT_FILTERS',
'DEFAULT_XAR_FILTERS',
'merge_image',
]
import contextlib
import logging
import tempfile
from pathlib import Path
from g1 import scripts
from g1.containers import models
from g1.containers import scripts as ctr_scripts
from . import utils
LOG = log... | 1.9375 | 2 |
python3/best_time_stock1.py | joshiaj7/CodingChallenges | 1 | 13063 | <filename>python3/best_time_stock1.py<gh_stars>1-10
"""
Space : O(1)
Time : O(n)
"""
class Solution:
def maxProfit(self, prices: List[int]) -> int:
start, dp = 10**10, 0
for i in prices:
print(start)
start = min(start, i)
dp = max(dp, i-start)
... | 3.25 | 3 |
environments/assets/gym_collectball/__init__.py | GPaolo/SERENE | 3 | 13064 | <filename>environments/assets/gym_collectball/__init__.py
# Created by <NAME>
# Date: 27/08/2020
from gym.envs.registration import register
register(
id='CollectBall-v0',
entry_point='gym_collectball.envs:CollectBall'
) | 1.390625 | 1 |
foreverbull/foreverbull.py | quantfamily/foreverbull-python | 0 | 13065 | import logging
import threading
from concurrent.futures import ThreadPoolExecutor
from multiprocessing import Queue
from foreverbull.worker.worker import WorkerHandler
from foreverbull_core.models.finance import EndOfDay
from foreverbull_core.models.socket import Request
from foreverbull_core.models.worker import Inst... | 2.25 | 2 |
scopus/tests/test_AffiliationSearch.py | crew102/scopus | 0 | 13066 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for `AffiliationSearch` module."""
from collections import namedtuple
from nose.tools import assert_equal, assert_true
import scopus
s = scopus.AffiliationSearch('af-id(60021784)', refresh=True)
def test_affiliations():
received = s.affiliations
asser... | 2.5625 | 3 |
MechOS/simple_messages/int.py | PierceATronics/MechOS | 0 | 13067 | <gh_stars>0
'''
'''
import struct
class Int:
'''
'''
def __init__(self):
'''
'''
#construct the message format
self.message_constructor = 'i'
#number of bytes for this message
self.size = 4
def _pack(self, message):
'''
'''
encode... | 2.90625 | 3 |
Curso Python/PythonExercicios/ex017.py | marcos-saba/Cursos | 0 | 13068 | <filename>Curso Python/PythonExercicios/ex017.py
#from math import hypot
import math
print('='*5, 'Cálculo triângulo retângulo', '='*5)
cat_op = float(input('Digite o comprimento do cateto oposto: '))
cat_adj = float(input('Digite o comprimento do cateto adjacente: '))
hip = math.hypot(cat_op, cat_adj)
print(f'O compri... | 4.03125 | 4 |
exercicios/ex074.py | CinatitBR/exercicios-phyton | 0 | 13069 | <gh_stars>0
from random import randint
numeros = (randint(0, 10), randint(0, 10), randint(0, 10), randint(0, 10), randint(0, 10))
print(f'Os cinco números são: ', end='')
for n in numeros: # Exibe números sorteados
print(n, end=' ')
print(f'\nO MAIOR número é {max(numeros)}')
print(f'O MENOR número é {min(numeros)... | 3.65625 | 4 |
libs3/maxwellccs.py | tmpbci/LJ | 7 | 13070 | <gh_stars>1-10
#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
Maxwell Macros
v0.7.0
by <NAME>
from /team/laser
Launchpad set a "current path"
"""
from OSC3 import OSCServer, OSCClient, OSCMessage
import time
import numpy as np
import rtmidi
from rtmidi.midiutil import open_midiinput
from threading import Threa... | 2.125 | 2 |
functions_alignComp.py | lauvegar/VLBI_spectral_properties_Bfield | 1 | 13071 | <gh_stars>1-10
import numpy as np
import matplotlib.pyplot as plt
from pylab import *
#import pyspeckit as ps
from scipy import io
from scipy import stats
from scipy.optimize import leastsq
#from lmfit import minimize, Parameters, Parameter, report_fit
#from lmfit.models import GaussianModel
import scipy.optimize as op... | 2.6875 | 3 |
osbuild/dist.py | dnarvaez/osbuild | 0 | 13072 | # Copyright 2013 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, soft... | 1.960938 | 2 |
neural_net/game_status.py | Ipgnosis/tic_tac_toe | 0 | 13073 | # node to capture and communicate game status
# written by Russell on 5/18
class Game_state():
node_weight = 1
# node_bias = 1 # not going to use this for now, but may need it later
list_of_moves = []
def __init__(self, node_list):
self.node_list = node_list
def num_moves(self):
... | 3.46875 | 3 |
alphatrading/system/db_methods/method_sqlite3.py | LoannData/Q26_AlphaTrading | 0 | 13074 | <gh_stars>0
"""
"""
import sqlite3
import numpy as np
import math
class SQL:
def __init__(self):
self.path = None
self.connexion = None
self.cursor = None
self.verbose = False
def to_SQL_type(self, type_, mode = "format"):
"""
Function... | 3.609375 | 4 |
pysport/horseracing/lattice_calibration.py | notbanker/pysport | 0 | 13075 | <reponame>notbanker/pysport
from .lattice import skew_normal_density, center_density,\
state_prices_from_offsets, densities_and_coefs_from_offsets, winner_of_many,\
expected_payoff, densities_from_offsets, implicit_state_prices, densitiesPlot
import pandas as pd # todo: get rid of this dependency
import numpy ... | 2.515625 | 3 |
var/spack/repos/builtin/packages/autoconf/package.py | LiamBindle/spack | 2,360 | 13076 | <reponame>LiamBindle/spack
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import re
class Autoconf(AutotoolsPackage, GNUMirrorPackage):
"""Autoconf -- system confi... | 1.328125 | 1 |
src/wallet/web/schemas/categories.py | clayman-micro/wallet | 2 | 13077 | <gh_stars>1-10
from aiohttp_micro.web.handlers.openapi import PayloadSchema, ResponseSchema
from marshmallow import fields, post_load, Schema
from wallet.core.entities.categories import CategoryFilters
from wallet.web.schemas.abc import CollectionFiltersSchema
class CategorySchema(Schema):
key = fields.Int(requi... | 2.1875 | 2 |
scons_gbd_docs/Gbd/Docs/SConscript.py | ASoftTech/Scons.Gbd.Docs | 0 | 13078 | <filename>scons_gbd_docs/Gbd/Docs/SConscript.py
SConscript('Mkdocs/Common/SConscript.py')
SConscript('Pandoc/Common/SConscript.py')
SConscript('Doxygen/Common/SConscript.py')
| 1.226563 | 1 |
seg/segmentor/tools/module_runner.py | Frank-Abagnal/HRFormer | 254 | 13079 | <gh_stars>100-1000
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# Author: <NAME>(<EMAIL>)
# Some methods used by main methods.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import math
import os
from collections import OrderedDict
import torch
import to... | 2.015625 | 2 |
scripts/si_figs.py | gbirzu/density-dependent_dispersal_growth | 0 | 13080 | <filename>scripts/si_figs.py
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import pickle
import scipy.stats as stats
data_path = '../data/het_average.dat'
output_dir = '../figures/'
# Configure matplotlib environment
helvetica_scale_factor = 0.92 # rescale Helvetica to other fonts of sam... | 2.59375 | 3 |
language.py | sanine-a/dream-atlas | 0 | 13081 | <gh_stars>0
from random import random, choice, seed, shuffle, randint
from math import ceil
import copy
target = [ 2, 2, 3, 1, 4, 5 ]
consonants_base = [ 'p', 't', 'k', 'm', 'n' ]
vowels = [ [ 'a', 'i', 'u' ],
[ 'a', 'i', 'u', 'e', 'o' ],
[ 'a', 'A', 'i', 'I', 'u', 'U', 'e', 'E', 'o', 'O' ] ]
c... | 2.5625 | 3 |
week/templatetags/sidebar_data.py | uno-isqa-8950/fitgirl-inc | 6 | 13082 | from django import template
from week.models import SidebarContentPage,SidebarImagePage
register = template.Library()
@register.inclusion_tag('week/announcement.html')
def sidebar():
sidebar_data = SidebarContentPage.objects.get()
return {'sidebar_data':sidebar_data}
@register.inclusion_tag('week/advertise... | 1.71875 | 2 |
tests/functional/Hydro/AcousticWave/CSPH_mod_package.py | jmikeowen/Spheral | 22 | 13083 | #-------------------------------------------------------------------------------
# A mock physics package to mess around with the CRKSPH corrections.
#-------------------------------------------------------------------------------
from Spheral1d import *
class CRKSPH_mod_package(Physics):
def __init__(self):
... | 2.25 | 2 |
fbm-scraper.py | cbdelavenne/fb-messenger-media-scraper | 8 | 13084 | import os
import requests
import time
import uuid
import configparser
import datetime
import fbchat
import re
from fbchat import Client, ImageAttachment
from fbchat import FBchatException
from pathlib import Path
politeness_index = 0.5 # ;)
epoch = datetime.datetime(1970, 1, 1)
# Hack to get the login to work, see:... | 2.75 | 3 |
guru/users/models.py | Jeromeschmidt/Guru | 0 | 13085 | from django.contrib.auth.models import AbstractUser
from django.db.models import (BooleanField, CASCADE, CharField, FloatField,
IntegerField, ManyToManyField, Model,
OneToOneField, PositiveSmallIntegerField)
from django.contrib.postgres.fields import ArrayFiel... | 2.34375 | 2 |
movie.py | jmclinn/mapdraw | 0 | 13086 | import os,time
## File Variable (USER INPUT)
## ==========================
## if multiple files are being accessed to create movie...
## ...specify the beginning and ending of the file names...
## ...and the date list text file in the variables below
## Please use True or False to set whether multiple files will be a... | 3.140625 | 3 |
gaetk2/tools/auth0tools.py | mdornseif/appengine-toolkit2 | 1 | 13087 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""gaetk2.tools.auth0.py Tools for working with auth0
Created by <NAME> on 2017-12-05.
Copyright 2017 HUDROA. MIT Licensed.
"""
from __future__ import unicode_literals
import logging
from google.appengine.api import memcache
from auth0.v3.authentication import GetToke... | 2.0625 | 2 |
Q56MergeIntervals.py | ChenliangLi205/LeetCode | 0 | 13088 | # Definition for an interval.
# class Interval:
# def __init__(self, s=0, e=0):
# self.start = s
# self.end = e
class Solution:
def merge(self, intervals):
"""
:type intervals: List[Interval]
:rtype: List[Interval]
"""
if len(intervals) <= 1:
... | 3.640625 | 4 |
.github/scripts/check-status.py | antmicro/f4pga-arch-defs | 0 | 13089 | #!/usr/bin/env python3
from sys import argv
from pathlib import Path
from re import compile as re_compile
PACKAGE_RE = re_compile("symbiflow-arch-defs-([a-zA-Z0-9_-]+)-([a-z0-9])")
with (Path(__file__).parent.parent.parent / 'packages.list').open('r') as rptr:
for artifact in rptr.read().splitlines():
m ... | 2.09375 | 2 |
DocOCR/urls.py | trangnm58/DocOCR | 0 | 13090 | from django.conf.urls import url, include
urlpatterns = [
url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')),
url(r'^api/viet_ocr/', include('viet_ocr.api.urls', namespace="viet_ocr-api")),
url(r'^api/post_process/', include('post_process.api.urls', namespace="post_process-api"... | 1.617188 | 2 |
utils/neuron/models/metrics/multi_task_metrics.py | tsingqguo/ABA | 12 | 13091 | import torch
import torch.nn as nn
import neuron.ops as ops
from neuron.config import registry
@registry.register_module
class ReID_Metric(nn.Module):
def __init__(self, metric_cls, metric_rank):
super(ReID_Metric, self).__init__()
self.metric_cls = metric_cls
self.metric_rank = metr... | 2.28125 | 2 |
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synthval/myIntSynthProvider.py | medismailben/llvm-project | 2,338 | 13092 | <gh_stars>1000+
class myIntSynthProvider(object):
def __init__(self, valobj, dict):
self.valobj = valobj
self.val = self.valobj.GetChildMemberWithName("theValue")
def num_children(self):
return 0
def get_child_at_index(self, index):
return None
def get_child_index(sel... | 3 | 3 |
incremental-update.py | tarasowski/apache-spark | 1 | 13093 | <reponame>tarasowski/apache-spark
from pyspark.sql import SparkSession
from pyspark.sql.types import DateType
from pyspark.sql.functions import col
from pyspark.sql import types as t
import sys
from pyspark.sql.window import Window
from pyspark.sql.functions import spark_partition_id
from pyspark.sql import Row
def s... | 2.984375 | 3 |
asset/admin.py | shoaibsaikat/Django-Office-Management-BackEnd | 0 | 13094 | from django.contrib import admin
from .models import Asset
# Register your models here.
admin.site.register(Asset) | 1.273438 | 1 |
instagram_api/response/send_confirm_email.py | Yuego/instagram_api | 13 | 13095 | <gh_stars>10-100
from .mapper import ApiResponse, ApiResponseInterface
from .mapper.types import Timestamp, AnyType
__all__ = ['SendConfirmEmailResponse']
class SendConfirmEmailResponseInterface(ApiResponseInterface):
title: AnyType
is_email_legit: AnyType
body: AnyType
class SendConfirmEmailResponse(A... | 1.75 | 2 |
webpages/views.py | 18praneeth/udayagiri-scl-maxo | 8 | 13096 | <filename>webpages/views.py
from django.shortcuts import render, redirect
from django.contrib import messages
from .models import Contact
from django.contrib.auth.decorators import login_required
def home(request):
if request.user.is_authenticated:
return render(request, 'webpages/home.html')
else:
... | 2.0625 | 2 |
src/pywbemReq/tupletree.py | sinbawang/smisarray | 2 | 13097 | <gh_stars>1-10
#
# (C) Copyright 2003,2004 Hewlett-Packard Development Company, L.P.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your opt... | 2.6875 | 3 |
src/Word.py | AlexandreLadriere/ColorfulWords | 0 | 13098 | #!/usr/bin/env python3*
import unicodedata
class Word:
"""
Object representation for a word
Parameters
----------
text : str
word text
formatedText : str
word text without accent, punctuation, etc (UTF-8)
color : List of integers
pixel color values in rgb for th... | 3.890625 | 4 |
LeetCode/Python3/DynamicProgramming/123. Best Time to Buy and Sell Stock III.py | WatsonWangZh/CodingPractice | 11 | 13099 | <gh_stars>10-100
# Say you have an array for which the ith element is the price of a given stock on day i.
# Design an algorithm to find the maximum profit. You may complete at most two transactions.
# Note: You may not engage in multiple transactions at the same time
# (i.e., you must sell the stock before you buy ag... | 3.90625 | 4 |