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 |
|---|---|---|---|---|---|---|
dataset/nlp/JsonFromFiles.py | ThuYShao/pytorch-worker | 49 | 12786351 | import json
import os
from torch.utils.data import Dataset
from tools.dataset_tool import dfs_search
class JsonFromFilesDataset(Dataset):
def __init__(self, config, mode, encoding="utf8", *args, **params):
self.config = config
self.mode = mode
self.file_list = []
self.data_path = ... | 2.5 | 2 |
VTiger_KPI_Dashboard/cases/models.py | roovyshapiro/VTiger_Sales_Dashboard | 2 | 12786352 | from django.db import models
from django.utils import timezone
import json, os
class Cases(models.Model):
'''
Example Case:
{
"age": "",
"asset_id": "",
"assigned_user_id": "19x91",
"billable_time": "",
"billing_service": "",
"case_no": "CC21063",
"c... | 2.25 | 2 |
core/erp/mixins.py | henrryyanez/test2 | 0 | 12786353 | <reponame>henrryyanez/test2<filename>core/erp/mixins.py
from datetime import datetime
from crum import get_current_request
from django.contrib import messages
from django.http import HttpResponseRedirect
from django.shortcuts import redirect
from django.urls import reverse_lazy
class IsSuperuserMixin(object):
de... | 2.125 | 2 |
coord.py | chapman-phys220-2017f/cw-02-sabelle-riley-and-nikki | 0 | 12786354 | <filename>coord.py
#!/usr/bin/env python
### INSTRUCTOR NOTE
# Be sure to specify "python3" above. CoCalc defaults to python2 still.
###
def coord_for(n, a, b):
h=(b-a)/n
list_int = []
for i in range(n+1):
list_int.append(a + i*h)
return list_int
### INSTRUCTOR NOTE
# Do not have executable co... | 4.375 | 4 |
material-exercises/python/part4-exercises.py | samuilivanov23/training-projects | 0 | 12786355 | <reponame>samuilivanov23/training-projects<filename>material-exercises/python/part4-exercises.py
import math
#2)
def adder(arg1, arg2):
return arg1 + arg2
print(adder(5, 7)) # -> 12
print(adder("5", "7")) # -> 57
print(adder([1, 2], [3, 4])) # -> [1, 2, 3 ,4]
#3)
def adder_(good= 3, bad = 4, ugly=5):
return g... | 4.09375 | 4 |
skiphash.py | ishiji-git/skiphash | 0 | 12786356 | <reponame>ishiji-git/skiphash<gh_stars>0
#!/usr/bin/env python
"""This is a hash function that is applied to the remainder of
a file or standard input after removing the desired number
of bytes from the beginning.
For example, if there is some kind of header data attached to
the binary data, you may want to remove... | 4.03125 | 4 |
swenin.py | roppert/swe-nin-tool | 0 | 12786357 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Creates a valid national identification number for
Sweden (personal identity number, called personnummer in swedish)
http://sv.wikipedia.org/wiki/Personnummer_i_Sverige
http://en.wikipedia.org/wiki/Personal_identity_number_%28Sweden%29
"""
from random import randint
fr... | 3.921875 | 4 |
theGame/gameSprites.py | TiagoFeu/extintorVirtual | 0 | 12786358 | <gh_stars>0
import sys
import pygame
def loadSprites():
fire1 = [pygame.image.load('C:\\Users\\Ti<NAME>eu\\Desktop\\extintorVirtual\\theGame\\assets\\general\\fire1_01.png'),
pygame.image.load('C:\\Users\\Tiago Feu\\Desktop\\extintorVirtual\\theGame\\assets\\general\\fire1_02.png'),
pygame.... | 2.140625 | 2 |
src/miner.py | kdotalpha/Python-Screeps | 0 | 12786359 | <reponame>kdotalpha/Python-Screeps<filename>src/miner.py
import globals
from defs import *
__pragma__('noalias', 'name')
__pragma__('noalias', 'undefined')
__pragma__('noalias', 'Infinity')
__pragma__('noalias', 'keys')
__pragma__('noalias', 'get')
__pragma__('noalias', 'set')
__pragma__('noalias', 'type')
__pragma__(... | 2.765625 | 3 |
lib/Obstacle.py | ld35-europa/europa | 0 | 12786360 | #!/usr/bin/env python2
import math
import pygame
from random import random
import pygame.sprite
from pygame import Rect
from pygame import Surface
import lib.GameWorld
from lib.Colors import Colors
from lib.CachedAsset import load_cached_asset
# Class reprenting an obstacle between the fluid pools
class Obstacle(p... | 2.890625 | 3 |
phanterpwa/tests/test_configer.py | PhanterJR/phanterpwa | 2 | 12786361 | <reponame>PhanterJR/phanterpwa<gh_stars>1-10
import os
import sys
import json
import unittest
import configparser
from phanterpwa.configer import ProjectConfig
from phanterpwa.tools import interpolate
CURRENT_DIR = os.path.normpath(os.path.join(os.path.dirname(__file__)))
ENV_PYTHON = os.path.normpath(sys.executable)
... | 2.15625 | 2 |
src/app/conf/static.py | denkasyanov/education-backend | 151 | 12786362 | <filename>src/app/conf/static.py
import os.path
from app.conf.boilerplate import BASE_DIR
from app.conf.environ import env
STATIC_URL = env('STATIC_URL', default='/static/')
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
| 1.90625 | 2 |
xlsxtemplater/utils.py | jgunstone/xlsxtemplater | 0 | 12786363 | import sys
import os
import re
import getpass
import datetime
import re
import pandas as pd
# mf packages
# TODO - remove this dedendency if opensource
try:
from mf_file_utilities import applauncher_wrapper as aw
except:
pass
def get_user():
return getpass.getuser()
def date():
return datetime.datet... | 2.03125 | 2 |
backend/APP/staff_calendar_get/staff_calendar_get.py | marshallgunnell/line-api-use-case-reservation-hairsalon | 8 | 12786364 | import logging
import json
import os
from datetime import datetime
from common import (common_const, utils)
from validation import hair_salon_param_check as validation
from hair_salon.hair_salon_staff_reservation import HairSalonStaffReservation
# 環境変数
HAIR_SALON_STAFF_RESERVATION_DB = os.environ.get("HAIR_SALON_STAFF... | 2.375 | 2 |
dtk/nn/utils.py | DinoMan/dino-tk | 1 | 12786365 | <reponame>DinoMan/dino-tk
from math import ceil
import torch
import torch.nn.functional as F
import torch.nn as nn
import random
import os
import collections
class Checkpoint():
def __init__(self, path, model_name, save_every=3, circular=-1, epoch=1):
self.path = path
if not os.path.exists(path) a... | 2.203125 | 2 |
digikey_scraper/digikeyscraper.py | nicholaschiang/dl-datasheets | 0 | 12786366 | <reponame>nicholaschiang/dl-datasheets<gh_stars>0
#! /usr/bin/env python
import requests
import sys, os
import re
import urllib
import urllib2
import time
import argparse
import csv
from pprint import pprint
import subprocess
import urlparse
import posixpath
import scraper_logging
import scraper_args
# To make index... | 2.65625 | 3 |
tests/environment/test_custom_environment_provider.py | TheCodingLand/pyctuator | 118 | 12786367 | <gh_stars>100-1000
from typing import Dict
from pyctuator.environment.custom_environment_provider import CustomEnvironmentProvider
from pyctuator.environment.environment_provider import PropertyValue
def test_custom_environment_provider() -> None:
def produce_env() -> Dict:
return {
"a": "s1"... | 2.546875 | 3 |
kmeans_part3.py | o3dwade/farooq | 0 | 12786368 | import csv
import sys
import random
import math
k = sys.argv[2]
C = 0
# C is length of file
pt = None
points = None
centroids = None
classes = ["Iris-virginica", "Iris-setosa", "Iris-versicolor"]
ISCount =0
IVCount =0
IECount =0
objFunc=0
actualISC =0
actualIVC =0
actualIEC =0
def main():
initialize()
#initial clust... | 2.671875 | 3 |
setup.py | yjg30737/pyqt-label-slider | 0 | 12786369 | <gh_stars>0
from setuptools import setup, find_packages
setup(
name='pyqt-label-slider',
version='0.0.1',
author='<NAME>',
author_email='<EMAIL>',
license='MIT',
packages=find_packages(),
description='PyQt QSlider with QLabel(QLabel is on the left side, QSlider is on the right side, horizon... | 1.414063 | 1 |
Vuld_SySe/representation_learning/models.py | bstee615/ReVeal | 63 | 12786370 | <reponame>bstee615/ReVeal
import numpy as np
import torch
from sklearn.metrics import accuracy_score as acc, precision_score as pr, recall_score as rc, f1_score as f1
from torch import nn
from torch.optim import Adam
from tsne import plot_embedding
class MetricLearningModel(nn.Module):
def __init__(self, input_d... | 2.53125 | 3 |
noxfile.py | RSOA-WEITI-2020/TaskScheduler | 0 | 12786371 | import nox
@nox.session(python=False)
def tests(session):
session.run('poetry', 'install')
session.run('poetry', 'run', 'pytest')
| 1.484375 | 1 |
maana-ue/logic-py/service/context.py | maana-io/h4-tutorials | 3 | 12786372 | <reponame>maana-io/h4-tutorials<gh_stars>1-10
from CKGClient import CKGClient
from clients import clients
service_clients = []
context_vars = {client: CKGClient(
clients[client]) for client in service_clients}
| 1.398438 | 1 |
salt_observer/backends.py | hs-hannover/salt-observer | 6 | 12786373 | from django.contrib.auth.backends import ModelBackend
from django.contrib.auth.models import User
from salt_observer.saltapis import SaltCherrypy, SaltTornado
class RestBackend(ModelBackend):
''' Authenticate against salt-api-permissions '''
def authenticate(self, username=None, password=None, request=None)... | 2.140625 | 2 |
Files/30-Biblioteca-random.py | michelelozada/Logica-de-Programacao_e_Algoritmos_em_Python | 0 | 12786374 | <reponame>michelelozada/Logica-de-Programacao_e_Algoritmos_em_Python
'''
* Biblioteca random
* Repositório: Lógica de Programação e Algoritmos em Python
* GitHub: @michelelozada
'''
# 1 - Dados os números abaixo, retorne uma lista com três números aleatórios da mesma:
import random
lista1 = [10, 20, 30, 40, 50,... | 4.28125 | 4 |
akshare/economic/macro_china_hk.py | J-Z-Z/akshare | 721 | 12786375 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
"""
Date: 2021/12/6 15:21
Desc: 中国-香港-宏观指标
https://data.eastmoney.com/cjsj/foreign_8_0.html
"""
import pandas as pd
import requests
from akshare.utils import demjson
def macro_china_hk_cpi() -> pd.DataFrame:
"""
东方财富-经济数据一览-中国香港-消费者物价指数
https://data.eastmoney.... | 2.53125 | 3 |
prepare-release.py | wszczepanski97/TAU-Design-Editor | 25 | 12786376 | <gh_stars>10-100
#!/usr/bin/python3
import collections
import json
import subprocess
def main():
packageJson = json.load(open('package.json', 'r'), object_pairs_hook=collections.OrderedDict)
currentVersion = packageJson['version']
verNums = currentVersion.split('.')
verNums[-1] = str(int(verNums[-1])+1)
pac... | 2.03125 | 2 |
api/sources/urls.py | CenterForOpenScience/SHARE | 87 | 12786377 | <gh_stars>10-100
from rest_framework.routers import SimpleRouter
from api.sources import views
router = SimpleRouter()
router.register(r'sources', views.SourceViewSet, basename='source')
urlpatterns = router.urls
| 1.375 | 1 |
test/test_data.py | iwan933/wavenet-lstm-timeseries | 0 | 12786378 | import unittest
import logging
from util.data import load_data, split_train_test_validation, make_dataset, preprocess
logger = logging.getLogger(__name__)
class DataTestCase(unittest.TestCase):
def setUp(self) -> None:
self.assets = load_data('../data')
self.symbol = next(iter(self.assets.keys... | 2.75 | 3 |
tests/test_merge.py | open-contracting/ocds-merge | 4 | 12786379 | import json
import os.path
import re
from copy import deepcopy
from glob import glob
import pytest
from ocdsmerge import CompiledRelease, Merger, VersionedRelease
from ocdsmerge.exceptions import (InconsistentTypeError, MissingDateKeyError, NonObjectReleaseError,
NonStringDateValueEr... | 2.234375 | 2 |
rpa/transfer_learning.py | plcrodrigues/RiemannianProcrustesAnalysis | 34 | 12786380 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 23 15:57:12 2018
@author: coelhorp
"""
import numpy as np
from sklearn.metrics import roc_auc_score
from rpa.helpers.transfer_learning.utils import transform_org2rct, transform_rct2str, transform_rct2rot
from rpa.helpers.transfer_learning.utils im... | 2.0625 | 2 |
workflow/scripts/prepare_input_plot_SNP_threshold.py | boasvdp/SNP-distance-analysis | 0 | 12786381 | <gh_stars>0
#!/usr/bin/env python3
import pandas as pd
import sys
path_tbl = str(sys.argv[1])
tbl = pd.read_csv(path_tbl, sep = '\t')
print("Method", "SNP_threshold", "Comparison", "Number_isolate_pairs", sep = '\t')
for snp_threshold in range(1,21):
for comparison in [ 'different_carrier', 'same_carrier_same_tim... | 2.734375 | 3 |
figuras/Pycharm_Papoulis_Probability_Report/example_7_15.py | bor9/estudiando_el_papoulis | 0 | 12786382 | import matplotlib.pyplot as plt
import numpy as np
import math
from scipy.stats import norm
from matplotlib import rc
__author__ = 'ernesto'
# if use latex or mathtext
rc('text', usetex=False)
rc('mathtext', fontset='cm')
# auxiliar function for plot ticks of equal length in x and y axis despite its scales.
def con... | 3.34375 | 3 |
setup.py | ryninho/session2s3 | 1 | 12786383 | <reponame>ryninho/session2s3
from setuptools import setup
setup(
name = 'session2s3',
packages = ['session2s3'],
version = '0.2a1',
description = 'Save your Python session to S3',
author = '<NAME>',
author_email = '<EMAIL>',
license='MIT',
url = 'https://github.com/ryninho/session2s3',
download_url = ... | 1.632813 | 2 |
r_packages_config.py | meissnert/StarCluster-Plugins | 1 | 12786384 | <gh_stars>1-10
from starcluster.clustersetup import ClusterSetup
from starcluster.logger import log
class R_Packages(ClusterSetup):
def run(self, nodes, master, user, user_shell, volumes):
# install R Packages
log.info("Setting up R Packages")
master.ssh.execute('module load R/3.1.0 && Rscript home/omicspipe... | 1.710938 | 2 |
built-in/TensorFlow/Official/cv/image_classification/ResNext50_for_TensorFlow/modelarts/start.py | Ascend/modelzoo | 12 | 12786385 | # coding=utf-8
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | 1.34375 | 1 |
myapp/migrations/0007_auto_20190620_1516.py | McFlyWYF/HealthManagerWeb | 1 | 12786386 | # Generated by Django 2.2 on 2019-06-20 07:16
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('myapp', '0006_auto_20190620_1446'),
]
operations = [
migrations.AlterField(
model_name='eatstatistics',
name='eatHot',... | 1.648438 | 2 |
src/encoded/commands/migrate_files_aws.py | 4dn-dcic/fourfron | 11 | 12786387 | """\
Update files with AWS metadata
"""
import json
import logging
import transaction
from pyramid.paster import get_app
from pyramid.threadlocal import manager
from pyramid.testing import DummyRequest
EPILOG = __doc__
logger = logging.getLogger(__name__)
def run(app, files):
root = app.root_factory(app)
c... | 2.171875 | 2 |
Algorithms/DynamicProgramming/minimum-sum-path-triangle.py | Sangeerththan/pythonDSA | 1 | 12786388 | def minSumPath(A):
memo = [None] * len(A)
n = len(A) - 1
for i in range(len(A[n])):
memo[i] = A[n][i]
for i in range(len(A) - 2, -1, -1):
for j in range(len(A[i])):
memo[j] = A[i][j] + min(memo[j],
memo[j + 1]);
return memo[0]
A = [[... | 3.515625 | 4 |
zhsz_api/extensions.py | azhen318x/FormatFa6 | 12 | 12786389 | <reponame>azhen318x/FormatFa6<gh_stars>10-100
from flask_cors import CORS
from flask_login import LoginManager
from flask_wtf import CSRFProtect
from flask_bcrypt import Bcrypt
from flask_openid import OpenID
csrfp=CSRFProtect()
cors=CORS()
lm=LoginManager()
bcrypt=Bcrypt()
oid=OpenID() | 1.664063 | 2 |
pycatia/in_interfaces/reference.py | evereux/catia_python | 90 | 12786390 | #! usr/bin/python3.6
"""
Module initially auto generated using V5Automation files from CATIA V5 R28 on 2020-06-11 12:40:47.360445
.. warning::
The notes denoted "CAA V5 Visual Basic Help" are to be used as reference only.
They are there as a guide as to how the visual basic / catscript function... | 2.203125 | 2 |
modern_treasury/objects/request/__init__.py | EquityZen/modern_treasury | 0 | 12786391 | from .account import AccountRequest
from .account_details import AccountDetailsRequest
from .address import AddressRequest
from .counterparty import CounterPartyRequest
from .expected_payment import ExpectedPaymentRequest
from .external_account import ExternalAccountRequest
from .internal_account import InternalAccount... | 0.949219 | 1 |
chainercv/functions/ps_roi_max_align_2d.py | beam2d/chainercv | 1,600 | 12786392 | # Modified work:
# -----------------------------------------------------------------------------
# Copyright (c) 2019 Preferred Infrastructure, Inc.
# Copyright (c) 2019 Preferred Networks, Inc.
# -----------------------------------------------------------------------------
# Original work:
# -------------------------... | 1.6875 | 2 |
christmas/__init__.py | vyahello/christmas-tree | 0 | 12786393 | __author__: str = "<NAME>"
__email__: str = "<EMAIL>"
__version__: str = "0.3.0"
| 1.179688 | 1 |
python/easy/1837_Sum_of_Digits_in_Base_K.py | JackWang0107/leetcode | 1 | 12786394 | <filename>python/easy/1837_Sum_of_Digits_in_Base_K.py
from typing import *
class Solution:
# 28 ms, faster than 84.42% of Python3 online submissions for Sum of Digits in Base K.
# 14.2 MB, less than 46.12% of Python3 online submissions for Sum of Digits in Base K.
def sumBase(self, n: int, k: int) -> int:
... | 3.5 | 4 |
incident_io_client/models/public_identity_response_body.py | expobrain/python-incidentio-client | 0 | 12786395 | <reponame>expobrain/python-incidentio-client
from typing import Any, Dict, List, Type, TypeVar, cast
import attr
T = TypeVar("T", bound="PublicIdentityResponseBody")
@attr.s(auto_attribs=True)
class PublicIdentityResponseBody:
"""
Example:
{'name': '<NAME>.', 'roles': ['Quia aut enim quisquam.', 'Ra... | 1.945313 | 2 |
src/psion/jose/jwa/jws.py | revensky/psion | 2 | 12786396 | import abc
import binascii
from psion.jose.exceptions import InvalidKey, InvalidSignature
from psion.jose.jwk import JsonWebKey
from psion.webtools import base64url_decode, base64url_encode
class JWSAlgorithm(abc.ABC):
"""
Implementation of the Section 3 of RFC 7518.
This class provides the expected met... | 2.921875 | 3 |
instauto/api/actions/friendships.py | marosgonda/instauto | 0 | 12786397 | <reponame>marosgonda/instauto<gh_stars>0
from requests import Session, Response
from typing import Union, Callable, Tuple, List
from instauto.api.actions.stubs import _request
from .structs.friendships import Create, Destroy, Remove, Show, \
GetFollowers, GetFollowing, PendingRequests, ApproveRequest
from ..structs... | 2.59375 | 3 |
Problems/IsHalloweendotcom/wut.py | FredTheDane/Kattis-Problems | 0 | 12786398 | import sys
for i, x in enumerate(sys.stdin):
val = str(x).strip()
if (val == "OCT 31" or val == "DEC 25"):
print("yup")
else:
print("nope")
| 3.453125 | 3 |
scripts/convert_csv_to_input.py | hdc-arizona/pothos | 1 | 12786399 | <gh_stars>1-10
#!/usr/bin/env python
import csv
import os
import sys
import io
import gzip
reader = csv.reader(io.TextIOWrapper(gzip.open(sys.argv[1], "r"), newline="", write_through=True))
columns = next(reader)
n = int(sys.argv[2])
for row in reader:
if len(row) != len(columns):
continue
pickup = ... | 2.921875 | 3 |
tests/extension/src/test_project/sub.py | OriolAbril/sphinx-codeautolink | 21 | 12786400 | <reponame>OriolAbril/sphinx-codeautolink
def subfoo():
"""Function in submodule."""
| 1.234375 | 1 |
test/test_environment.py | simon-schaefer/mantrap | 7 | 12786401 | import pytest
import torch
import mantrap.agents
import mantrap.constants
import mantrap.environment
import mantrap.utility.maths
import mantrap.utility.shaping
torch.manual_seed(0)
###########################################################################
# Tests - All Environment ################################... | 1.882813 | 2 |
Chapter 05/Chap05_Example5.55.py | bpbpublications/Programming-Techniques-using-Python | 0 | 12786402 | #Kabaddi Package --- defender module
from Football import forward
def name_defender():
'''Kabaddi defender names are'''
print("Defender Function")
print("Defender1: Mr. Y")
print("Defender2: Mr. Z")
print()
forward.name_forward()
| 2.578125 | 3 |
E2_7/fibonacci.py | AidaNajafi/AidaNajafi.github.io | 0 | 12786403 | n = int(input("Enter a number:"))
def fibonacci(n):
if n==1:
return 0
elif n==2:
return 1
else:
return fibonacci(n-1) + fibonacci(n-2)
print(fibonacci(n))
| 4.21875 | 4 |
sdk/python/pulumi_sumologic/hierarchy.py | pulumi/pulumi-sumologic | 1 | 12786404 | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from . import ... | 2.109375 | 2 |
notebooks/__code/display_counts_of_region_vs_stack_vs_theory.py | mabrahamdevops/python_notebooks | 0 | 12786405 | import pyqtgraph as pg
from pyqtgraph.dockarea import *
import numpy as np
import os
import numbers
try:
from PyQt4.QtGui import QFileDialog
from PyQt4 import QtCore, QtGui
from PyQt4.QtGui import QMainWindow
except ImportError:
from PyQt5.QtWidgets import QFileDialog
from PyQt5 import QtCore, QtGu... | 1.984375 | 2 |
examples/views.py | jeromelebleu/django-cruditor | 10 | 12786406 | <reponame>jeromelebleu/django-cruditor
from django.views.generic import TemplateView
from cruditor.mixins import CruditorMixin
from cruditor.views import (
Cruditor403View, Cruditor404View, CruditorChangePasswordView, CruditorLogoutView)
from .mixins import ExamplesMixin
class HomeView(ExamplesMixin, CruditorMi... | 1.992188 | 2 |
test/test_No5.py | programmingphys/TrainProgs | 0 | 12786407 | import numpy as np
import matplotlib.pyplot as plt
import math
import itertools_recipes as it
data=np.array([[1,1],[5,2],[3,3],[0,2],[9,4],[4,8]])
x=data[:,0]
y=data[:,1]
def choose():
q=[]
u=list(it.permutations([0,1,2,3,4,5],6))
m=np.zeros((6,2))
n=np.zeros((6,2))
for i in range(le... | 2.9375 | 3 |
tsai/data/tabular.py | williamsdoug/timeseriesAI | 0 | 12786408 | # AUTOGENERATED! DO NOT EDIT! File to edit: nbs/005_data.tabular.ipynb (unless otherwise specified).
__all__ = ['TabularDataset', 'TabularDataLoader']
# Cell
from ..imports import *
from fastai.tabular.all import *
# Cell
class TabularDataset():
"A `Numpy` dataset from a `TabularPandas` object"
def __init__(... | 2.453125 | 2 |
mi/73.py | 1005281342/learn | 1 | 12786409 | # 此处可 import 模块
"""
@param string line 为单行测试数据
@return string 处理后的结果
"""
def solution(line):
# 缩进请使用 4 个空格,遵循 PEP8 规范
# please write your code here
# return 'your_answer'
nums = line.strip().split(',')
while nums:
num = nums.pop()
if num in nums:
nums.remove(num)
num... | 3.703125 | 4 |
segmentation_tools.py | 1danielcoelho/SegmentationOptimizer | 1 | 12786410 | <reponame>1danielcoelho/SegmentationOptimizer<filename>segmentation_tools.py
import numpy as np
import matplotlib.pyplot as plt
from itertools import combinations
six_neighbor_deltas = np.array([(1, 0, 0), (-1, 0, 0), (0, 1, 0), (0, -1, 0), (0, 0, 1), (0, 0, -1)])
twenty_six_neighbor_deltas = np.array([(-1, -1, -1), (... | 2.46875 | 2 |
ckstyle/plugins/FEDUseSingleQuotation.py | wangjeaf/CSSCheckStyle | 21 | 12786411 | <reponame>wangjeaf/CSSCheckStyle<gh_stars>10-100
#/usr/bin/python
#encoding=utf-8
from .Base import *
class FEDUseSingleQuotation(RuleChecker):
'''{
"summary":"使用单引号",
"desc":"CSS的属性取值一律使用单引号<code>'</code>, 不允许使用双引号"
}'''
def __init__(self):
self.id = 'single-quotation'
... | 2.421875 | 2 |
utils.py | paragrapharamus/msdp | 0 | 12786412 | import os
import numpy as np
from matplotlib import pyplot as plt
from torch.utils.data import DataLoader
def minibatch_loader(minibatch, minibatch_size, drop_last=True):
return DataLoader(minibatch, batch_size=minibatch_size, drop_last=drop_last)
def get_next_available_dir(root, dir_name, absolute_path=True, cr... | 2.3125 | 2 |
not_a_playbook/3_flowchart_with_disc/1/1.py | jonasitzmann/ultimate-tactic-board | 2 | 12786413 | from manim_animations import create_movie
from scenes import UltimateScene
class 1(UltimateScene):
def construct(self):
f, s = self.prepare()
f.transition(s[1], run_time=2)
f.transition(s[2], run_time=2)
f.transition(s[3], run_time=2)
f.transition(s[4], run_time=2)
... | 2.859375 | 3 |
dags/utils/voting/vote_operations.py | makerdao-data/airflow-docker-image | 0 | 12786414 | <filename>dags/utils/voting/vote_operations.py
import json
from dags.connectors.sf import sf
from dags.utils.voting.tooling.current_proxy import _current_proxy
def _vote_operations(chief, polls, lastest_proxies_history, full_proxies_history, **setup):
vote_operations = list()
db_chief = sf.execute(f"""
... | 2.09375 | 2 |
pisa/stages/utils/add_indices.py | marialiubarska/pisa | 0 | 12786415 | '''
PISA module to prep incoming data into formats that are
compatible with the mc_uncertainty likelihood formulation
This module takes in events containers from the pipeline, and
introduces an additional array giving the indices where each
event falls into.
module structure imported from bootcamp example
'''
from _... | 2.28125 | 2 |
octs/message/views.py | kaiueo/octs | 5 | 12786416 | from flask import Blueprint, flash, redirect, render_template, request, url_for,sessions
from octs.user.models import Course, Message, User
from octs.database import db
from .forms import MessageForm
from flask_login import current_user
blueprint = Blueprint('message', __name__, url_prefix='/message',static_folder='..... | 2.28125 | 2 |
translator/preprocess/text_clear_up.py | microhhh/Artificial-Intelligence | 1 | 12786417 | <filename>translator/preprocess/text_clear_up.py
# coding: utf-8
import os
from translator.utils import *
ARTICLE_DIR = '../data/sina_news_utf8'
SENTENCE_FILE = '../data/sentence.txt'
def clear_sentences(content):
content = content.replace(' ', '')
content = content.replace('\t', '')
sentences = []
s... | 3.078125 | 3 |
students/k33401/Ponomarenko_Ignatii/Lr1/two/client.py | ShubhamKunal/ITMO_ICT_WebDevelopment_2020-2021 | 4 | 12786418 | <reponame>ShubhamKunal/ITMO_ICT_WebDevelopment_2020-2021<gh_stars>1-10
import socket
sock = socket.socket()
sock.connect(('localhost', 9090))
S = input()
sock.send(S.encode("utf-8"))
data = sock.recv(1024)
sock.close()
print(data.decode("utf-8")) | 2.84375 | 3 |
enrich2/gui/delete_dialog.py | FowlerLab/Enrich2 | 28 | 12786419 | import Tkinter as tk
import ttk
import tkSimpleDialog
def subtree_ids(treeview, x, level=0):
"""
Return a list of tuples containing the ids and levels for *x* and every element below it in the Treeview *treeview*.
The level of *x* is 0, children of *x* are 1, and so forth.
"""
id_list = list()
... | 3.296875 | 3 |
dxc/ai/read_data/read_excel.py | RameshwarGupta97/DXC-Industrialized-AI-Starter | 1 | 12786420 | <reponame>RameshwarGupta97/DXC-Industrialized-AI-Starter
import json
import pandas as pd
import urllib.parse #input data
from tkinter import Tk
from tkinter import filedialog
from enum import Enum
def get_file_path_excel():
root = Tk()
root.update()
def open_file():
file = filedialog.askopenfilenam... | 3.34375 | 3 |
vidispine/errors.py | newmediaresearch/vidispine-adapter | 0 | 12786421 |
class ConfigError(Exception):
pass
class APIError(Exception):
pass
class InvalidInput(Exception):
pass
class NotFound(APIError):
pass
| 1.484375 | 1 |
command_utilities/financialInfo.py | manymeeting/StockProfitCalculator | 1 | 12786422 | <reponame>manymeeting/StockProfitCalculator<filename>command_utilities/financialInfo.py<gh_stars>1-10
import urllib2
from bs4 import BeautifulSoup
from time import gmtime, strftime
BASE_URL = "https://finance.google.com/finance?q=NASDAQ%3A"
def buildURL(symbol):
return BASE_URL + symbol
def extractInfo(soup, key... | 3.046875 | 3 |
juniper/get_interfaces_interpreter.py | kovarus/practical-network-programmability | 0 | 12786423 | from pprint import pprint
from jnpr.junos import Device
from jnpr.junos.op.phyport import PhyPortTable
import code
with Device(host='192.168.127.12', user='pyez', password='<PASSWORD>!', gather_facts=False) as dev:
intf_status = PhyPortTable(dev)
intf_status.get()
code.interact(local=locals())
for int... | 2.1875 | 2 |
ZeroMQ/filecode/examples/Python/tornado_ioloop/taskwork.py | JailbreakFox/LightWeightRepository | 0 | 12786424 | #!/usr/bin/env python
"""
synopsis:
Task worker
Connects PULL socket to tcp://localhost:5557
Collects workloads from ventilator via that socket
Connects PUSH socket to tcp://localhost:5558
Sends results to sink via that socket
Author: <NAME> <lev(at)columbia(dot)edu>
Modified for async/iolo... | 2.625 | 3 |
mydemo/3.1.3.3_zip.py | ebayboy/pydata-book | 0 | 12786425 | <gh_stars>0
#zip 将列表、元祖或者其他序列元素配对, 组成一个元组构成的列表
seq1 = ['foo', 'bar', 'baz']
seq2 = ['one', 'tow', 'tree', 'four']
zipped = zip(seq1, seq2)
print(f"zipped:{zipped}")
lst_zipped = list(zipped)
print(f"lst_zipped:{lst_zipped}")
seq3 = [False, True]
zip3 = zip(seq1, seq2, seq3)
lst_zip3 = list(zip3)
print(f"lst_zip3:... | 3.34375 | 3 |
eda5/core/migrations/0001_initial.py | vasjapavlovic/eda5 | 0 | 12786426 | <gh_stars>0
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='ObdobjeLeto',
fields=[
('oznaka', m... | 1.773438 | 2 |
load_images.py | ex7763/osdi2020 | 0 | 12786427 | <filename>load_images.py
import string
import serial
import time
import os
from array import array
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("--port")
parser.add_argument("--kernel")
args = parser.parse_args()
print(args)
PORT = '/dev/ttyUSB0'
PORT = '/dev/pts/2'
PORT = args.port
BAUD_R... | 2.5625 | 3 |
scripts/eval/calMetrics.py | galberding/FleckDetect | 0 | 12786428 | import subprocess as sp
import os
import numpy as np
import argparse
from tqdm import tqdm
def cal_metrics(pred_dir, gt_dir, out_path):
'''Merge pred and gt dir and use the precompiled metric exe to calculate the
corresponding values. The results will be written to the out_path'''
preds = os.listdir(pred_d... | 2.515625 | 3 |
members/migrations/0037_auto_20190902_1517.py | PeoplesMomentum/mxv | 6 | 12786429 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.22 on 2019-09-02 14:17
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('members', '0036_remove_urlparameter_pass_on_name'),
]
operations = [
migra... | 1.851563 | 2 |
examples/OpenCV/hand_status/hand_status.py | ParisNeo/HandsAnalyzer | 0 | 12786430 | <reponame>ParisNeo/HandsAnalyzer
"""=== hello_hands =>
Author : <NAME>
Description :
A code to test HandsAnalyzer: Extract hands landmarks from a realtime video input
<================"""
from HandsAnalyzer import HandsAnalyzer, Hand
from HandsAnalyzer.helpers.geometry.orientation import orientation2Eu... | 2.953125 | 3 |
NEMO/NEMOplots/transition_matrices/diag_amountsurfbox_subplot_avgdist.py | pdnooteboom/PO-dinocysts | 0 | 12786431 | <reponame>pdnooteboom/PO-dinocysts
# -*- coding: utf-8 -*-
"""
Created on Wed Aug 1 15:22:53 2018
Plot the diagonal of the transition matrix and the amount of boxes any bottom box is mapped to.
Use 6 m/s here.
@author: nooteboom
"""
import numpy as np
import matplotlib.pylab as plt
import matplotlib
from mpl_tool... | 2.375 | 2 |
action/clip_based/i3d/i3d_utils.py | diwgan32/IKEA_ASM_Dataset | 0 | 12786432 | import torch
import numpy as np
def accuracy(output, target):
"""Computes the precision@k for the specified values of k"""
batch_size = target.size(0)
pred = torch.argmax(output, dim=1)
pred = pred.squeeze()
correct = pred.eq(target.expand_as(pred))
acc = correct.view(-1).float().sum(0) * 100 /... | 2.953125 | 3 |
site_settings/helper.py | migelbd/django-site-settings | 0 | 12786433 | <filename>site_settings/helper.py<gh_stars>0
import functools
import typing
from collections import defaultdict
from django.core.cache import cache
from site_settings.models import Setting
VALUES_TYPE_MAP = (
(int, 1),
(str, 2),
(bool, 3),
)
CACHE_SETTINGS_KEY = 'settings_%s'
def cached_setting(func):
... | 2 | 2 |
orbital/constants.py | getsentry/sentry-orbital | 6 | 12786434 | <reponame>getsentry/sentry-orbital
from __future__ import absolute_import
from django.conf import settings
ORBITAL_UDP_SERVER = getattr(settings, 'ORBITAL_UDP_SERVER', '127.0.0.1:5556')
| 1.585938 | 2 |
plsa.py | cheesezhe/pLSA | 4 | 12786435 | <reponame>cheesezhe/pLSA
# -*- coding: utf-8 -*-
import numpy as np
import time
import logging
def normalize(vec):
s = sum(vec)
for i in range(len(vec)):
vec[i] = vec[i] * 1.0 / s
def llhood(t_d, p_z, p_w_z, p_d_z):
V,D = t_d.shape
ret = 0.0
for w,d in zip(*t_d.nonzero()):
p_d_w = np.sum(p_z *... | 2 | 2 |
react/__init__.py | Stift007/react.py | 0 | 12786436 | <gh_stars>0
from .app import *
from .globals import *
| 1.195313 | 1 |
naivenmt/tests/gnmt_encoders_test.py | luozhouyang/tf-nmt-keras | 7 | 12786437 | <filename>naivenmt/tests/gnmt_encoders_test.py
# Copyright 2018 luozhouyang
#
# 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 requi... | 2.078125 | 2 |
linkedin-courses/exercises/dates.py | tienduy-nguyen/python-learning | 0 | 12786438 | <gh_stars>0
def main():
## DATE OBJECTS
# Get today's date from the simple today() method from the date class
# print out the date's individual components
note = 12
print("Echec") if note < 10 else print("Pass")
# retrieve today's weekday (0=Monday, 6=Sunday)
## DATETIME OBJECTS
# G... | 3.859375 | 4 |
reporter/sources/anemometer/client.py | Wikia/jira-reporter | 3 | 12786439 | import logging
import requests
from urllib.parse import urlencode
from requests.exceptions import RequestException
class AnemometerClient(object):
"""
Fetch and parse JSON from Anemometer instance
"""
# default set of fields to be returned
FIELDS = [
'checksum',
'snippet',
... | 3.171875 | 3 |
made_class.py | Gabriele91/Easy2D | 4 | 12786440 | import sys
name=raw_input("Name files:")
nameupper=name.upper()
#make h file
ofile = open("include/"+name+".h","w")
ofile.write("#ifndef "+nameupper+"_H\n")
ofile.write("#define "+nameupper+"_H\n\n")
ofile.write("#include <Config.h>\n\n")
ofile.write("namespace Easy2D\n{\n\n")
ofile.write("class "+name+"\n{\... | 2.75 | 3 |
src/tagger_write_data.py | bamdadsabbagh/tagger | 1 | 12786441 | <filename>src/tagger_write_data.py
# components
from env import *
from utils_array_to_string import UtilsArrayToString
# packages
import style
from mutagen.flac import FLAC
from mutagen.easyid3 import EasyID3
from mutagen.id3 import ID3, TXXX
def TaggerWriteData(files, discogs):
# label
label = discogs['json... | 2.53125 | 3 |
brands.py | sainnr/fairbikeprice | 0 | 12786442 | from brands import brands_az
from brands import dbpedia
from brands import roadbikereview
from brands import bikeindex
if __name__ == '__main__':
# b1 = brands_az.get_blog_brands()
# b2 = dbpedia.get_dbpedia_brands()
# roadbikereview.get_review_brands()
bikeindex.get_index_brands()
# print("%s %s"... | 2.265625 | 2 |
src/pyasl/asl/outlier.py | mirofedurco/PyAstronomy | 98 | 12786443 | <reponame>mirofedurco/PyAstronomy<gh_stars>10-100
from __future__ import print_function, division
from PyAstronomy.pyaC import pyaErrors as PE
from PyAstronomy import pyaC
import numpy as np
from PyAstronomy.pyaC import ImportCheck
import six.moves as smo
def generalizedESD(x, maxOLs, alpha=0.05, fullOutput=False, ub... | 2.40625 | 2 |
pipelines/h1c/idr3/v2/pspec/pspec_pipe.py | HERA-Team/hera_pipelines | 0 | 12786444 | <reponame>HERA-Team/hera_pipelines
#!/usr/bin/env python
"""
pspec_pipe.py
-----------------------------------------
Copyright (c) 2020 The HERA Collaboration
This script is used as the IDR2 power
spectrum pipeline.
See pspec_pipe.yaml for relevant parameter selections.
"""
import multiprocess
import numpy as np
impo... | 1.945313 | 2 |
Framing/join_csv.py | Gigi-G/Recognition-of-actions-on-objects-using-Microsoft-HoloLens-2 | 6 | 12786445 | import glob
csv:list = []
for folder in glob.glob("../data/VIDEO/*"):
for file in glob.glob(folder + "/*.csv"):
csv.append(file)
columns:bool = True
with open("framing_action.csv", "w") as f:
for fcsv in csv:
with open(fcsv, "r") as fc:
if columns:
f.writelines(fc.... | 2.890625 | 3 |
Self-Attentive-tensorflow/train.py | mikimaus78/ml_monorepo | 51 | 12786446 | import tensorflow as tf
import tflearn
import numpy as np
import re
from model import SelfAttentive
from sklearn.utils import shuffle
from reader import load_csv, VocabDict
'''
parse
'''
tf.app.flags.DEFINE_integer('num_epochs', 5, 'number of epochs to train')
tf.app.flags.DEFINE_integer('batch_size', 20, 'batch size... | 2.265625 | 2 |
logbook_aiopipe/__init__.py | kchmck/logbook_aiopipe | 2 | 12786447 | <filename>logbook_aiopipe/__init__.py
"""
This package provides a handler and subscriber for multiprocess
[`logbook`](http://logbook.readthedocs.io) logging that runs on the
[`asyncio`](https://docs.python.org/3/library/asyncio.html) event loop. It uses
[`aiopipe`](https://github.com/kchmck/aiopipe) to transfer log mes... | 2.796875 | 3 |
test/programytest/dialog/test_question.py | NeolithEra/program-y | 0 | 12786448 | <filename>test/programytest/dialog/test_question.py<gh_stars>0
import unittest
from programy.dialog.sentence import Sentence
from programy.dialog.question import Question
from programytest.client import TestClient
class QuestionTests(unittest.TestCase):
def setUp(self):
client = TestClient()
se... | 3.125 | 3 |
pyreach/metrics.py | google-research/pyreach | 13 | 12786449 | <filename>pyreach/metrics.py
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | 2.34375 | 2 |
patcher.py | tand826/wsi_to_patches | 2 | 12786450 | from itertools import product
import numpy as np
import argparse
from joblib import Parallel, delayed
from pathlib import Path
import openslide
from openslide.deepzoom import DeepZoomGenerator
class Patcher:
def __init__(self):
self._get_args()
self._make_output_dir()
self._read_img()
... | 2.375 | 2 |