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 |
|---|---|---|---|---|---|---|
python/sprint_13/Subsequence.py | Talgatovich/algorithms-templates | 0 | 12780251 | <filename>python/sprint_13/Subsequence.py
def sequense(line_1, line_2):
start = -1
for word in line_1:
start = line_2.find(word, start + 1)
if start == -1:
return False
return True
def read_input():
s = input()
t = input()
return s, t
def main():
... | 3.78125 | 4 |
data/transcoder_evaluation_gfg/python/MINIMUM_PERIMETER_N_BLOCKS.py | mxl1n/CodeGen | 241 | 12780252 | <filename>data/transcoder_evaluation_gfg/python/MINIMUM_PERIMETER_N_BLOCKS.py
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
import math
def f_gold ( n ) :
l = math.sqrt ... | 3.34375 | 3 |
src/charma/countries/__init__.py | mononobi/charma-server | 1 | 12780253 | # -*- coding: utf-8 -*-
"""
countries package.
"""
from pyrin.packaging.base import Package
class CountriesPackage(Package):
"""
countries package class.
"""
NAME = __name__
COMPONENT_NAME = 'countries.component'
| 1.367188 | 1 |
setup.py | geonda/RIXS.phonons | 2 | 12780254 | import setuptools
requirements = []
with open('requirements.txt', 'r') as fh:
for line in fh:
requirements.append(line.strip())
with open("README.md", "r") as fh:
long_description = fh.read()
print(setuptools.find_packages(),)
setuptools.setup(
name="phlab",
version="0.0.0.dev6",
authors=... | 1.710938 | 2 |
tests/unit/tspapi/metric_test.py | jdgwartney/pulse-api-python | 0 | 12780255 | <gh_stars>0
#!/usr/bin/env python
#
# Copyright 2016 BMC Software, 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 required... | 1.976563 | 2 |
find_beautifulsoup.py | jasperan/imdb-celebrities | 0 | 12780256 | <filename>find_beautifulsoup.py
from bs4 import BeautifulSoup
from sys import exit, argv
import requests
def parse_people(url):
response = requests.get(url)
soup = BeautifulSoup(response.content, 'html.parser')
obj = soup.find(id='meterRank')
if obj.string == 'SEE RANK':
obj = 'Below Rank 5000'
else:
obj = o... | 3.3125 | 3 |
bluesky/tests/test_transformer.py | AbbyGi/bluesky | 43 | 12780257 | <gh_stars>10-100
import pytest
from bluesky.utils import register_transform
@pytest.fixture
def transform_cell():
IPython = pytest.importorskip('IPython')
ip = IPython.core.interactiveshell.InteractiveShell()
register_transform('RE', prefix='<', ip=ip)
if IPython.__version__ >= '7':
return ip.... | 2.21875 | 2 |
projects/migrations/0005_auto_20191104_1335.py | EddyAnalytics/eddy-backend | 1 | 12780258 | <filename>projects/migrations/0005_auto_20191104_1335.py
# Generated by Django 2.2.6 on 2019-11-04 13:35
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('projects', '0004_auto_20191016_1732'),
]
operations = [
... | 1.234375 | 1 |
trains/migrations/0010_auto_20201125_1131.py | Seshathri-saravanan/quest | 0 | 12780259 | # Generated by Django 3.1.3 on 2020-11-25 06:01
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('trains', '0009_auto_20201125_0840'),
]
operations = [
migrations.DeleteModel(
name='Station',
),
migrations.DeleteModel(... | 1.523438 | 2 |
env/vagrant/vagrant.py | iterativ/django-project-template | 0 | 12780260 | # -*- coding: utf-8 -*-
#
# ITerativ GmbH
# http://www.iterativ.ch/
#
# Copyright (c) 2012 ITerativ GmbH. All rights reserved.
#
# Created on Jul 20, 2012
# @author: <NAME> <<EMAIL>>
from fabric.api import env
from deployit.fabrichelper.servicebase import UwsgiService, NginxService, CeleryService
from deployit.fabrich... | 1.796875 | 2 |
flexget/components/managed_lists/lists/pending_list/db.py | mfonville/Flexget | 2 | 12780261 | import logging
from datetime import datetime
from sqlalchemy import Boolean, Column, DateTime, Integer, Unicode, func
from sqlalchemy.orm import relationship
from sqlalchemy.sql.elements import and_
from sqlalchemy.sql.schema import ForeignKey
from flexget import db_schema
from flexget.db_schema import versioned_base... | 1.992188 | 2 |
functional/high_order_func/map_reduce.py | zhaoyu69/python3-learning | 1 | 12780262 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# map
# def f(x):
# return x * x
#
# r = map(f, [1, 2, 3, 4, 5, 6, 7, 8, 9])
# print(list(r))
#
# L = []
# for n in [1, 2, 3, 4, 5, 6, 7, 8, 9]:
# L.append(f(n))
# print(L)
#
# print(list(map(str,[1,2,3,4,5,6,7,8,9])))
# reduce
# from functools import reduce
# ... | 3.75 | 4 |
tools/crawler/get-icon.py | JoyPang123/Textmage | 13 | 12780263 | import sys
import os
import logging
import argparse
from bs4 import BeautifulSoup
import requests
# Output data to stdout instead of stderr
log = logging.getLogger()
log.setLevel(logging.INFO)
handler = logging.StreamHandler(sys.stdout)
handler.setLevel(logging.INFO)
log.addHandler(handler)
# Parse the argument for... | 2.875 | 3 |
build_windows/nvim_bridge.py | grigorievich/Viy | 14 | 12780264 | """Bridge for connecting a UI instance to nvim."""
import sys
from threading import Semaphore, Thread
from traceback import format_exc
class UIBridge(object):
"""UIBridge class. Connects a Nvim instance to a UI class."""
def connect(self, nvim, ui):
"""Connect nvim and the ui.
This will star... | 2.953125 | 3 |
worlds_worst_serverless/worlds_worst_mapper/mapper.py | nigelmathes/worlds-worst-serverless | 0 | 12780265 | <reponame>nigelmathes/worlds-worst-serverless
try:
import unzip_requirements
except ImportError:
pass
import json
from typing import Dict, Any
from fuzzywuzzy import process
try:
from guidelines import ACTIONS_MAP
except ImportError:
from .guidelines import ACTIONS_MAP
LambdaDict = Dict[str, Any]
... | 2.390625 | 2 |
src/command_line.py | jpope8/container-escape-dataset | 0 | 12780266 | """
Utility to execute command line processes.
"""
import subprocess
import os
import sys
import re
def execute( command ):
"""
Convenience function for executing commands as though
from the command line. The command is executed and the
results are returned as str list. For example,
command = ... | 3.921875 | 4 |
Dynamic_Programming/514.Paint Fence/Solution.py | Zhenye-Na/LxxxCode | 12 | 12780267 | class Solution:
"""
@param n: non-negative integer, n posts
@param k: non-negative integer, k colors
@return: an integer, the total number of ways
"""
def numWays(self, n, k):
# write your code here
if n == 1:
return k
if n == 2:
return k * k
... | 3.625 | 4 |
infoblox_netmri/api/remote/models/auth_user_remote.py | NastyaArslanova/infoblox-netmri | 0 | 12780268 | <reponame>NastyaArslanova/infoblox-netmri
from ..remote import RemoteModel
class AuthUserRemote(RemoteModel):
"""
The defined NetMRI users.
| ``id:`` The internal NetMRI identifier for this user.
| ``attribute type:`` number
| ``user_name:`` The user's login name.
| ``attribute type:`` ... | 2.25 | 2 |
src/admin_panel/__init__.py | sahilsehgal1995/lenme-api | 0 | 12780269 | <reponame>sahilsehgal1995/lenme-api
from src.user.schemas import *
from src.products.schemas import * | 1.03125 | 1 |
Products/PloneGetPaid/Extensions/plugin.py | collective/Products.PloneGetPaid | 2 | 12780270 | <filename>Products/PloneGetPaid/Extensions/plugin.py
def install_ups( self ):
from getpaid.ups import plugin
plugin.UPSPlugin( self ).install()
return "installed ups"
def install_warehouse( self ):
from getpaid.warehouse import plugin
plugin.WarehousePlugin( self ).install()
return "warehouse... | 1.789063 | 2 |
test/py/test4.py | mischareitsma/json2dataclass | 0 | 12780271 | from dataclasses import dataclass
from typing import Union
@dataclass
class root:
"""root dataclass"""
layerOne: object
@dataclass
class root_layerOne:
"""root_layerOne dataclass"""
layerTwo: object
@dataclass
class root_layerOne_layerTwo:
"""root_layerOne_layerTwo dataclass"""
layerThr... | 2.671875 | 3 |
update_contest.py | pratikgk45/Auto-Test-Case-Checker | 1 | 12780272 | import sqlite3
import sys
import requests
from lxml import html
from lxml import etree
from bs4 import BeautifulSoup
def get_contest_info(contest_id):
contest_info = {}
url = "https://codeforces.com/contest/"+contest_id
response = requests.get(url)
if response.status_code != 200:
sys.exit(0)
html_content = html... | 3.109375 | 3 |
dao/permissao_dao.py | lucianoanjos02/Choco-Stock-System-CSS | 0 | 12780273 | <gh_stars>0
from database import db_session
from models.permissao import Permissao
class PermissaoDAO:
'''
CLASSE PermissaoDAO - IMPLEMENTA O ACESSO AO BANCO RELACIONADO A CLASSE
Permisssao DO MÓDULO models.py QUE MAPEIA A TABELA TPermissao
@autor: <NAME> -
@data: 07/08/2020 -
... | 3.015625 | 3 |
src/utils_tensorflow.py | takumiw/nishika-cable-classification-1st-place | 0 | 12780274 | import os
import matplotlib.pyplot as plt
from tensorflow import keras
from tensorflow.keras.models import Model
def plot_model(model: Model, path: str) -> None:
if not os.path.isfile(path):
keras.utils.plot_model(model, to_file=path, show_shapes=True)
def plot_learning_history(fit, metric: str = "accu... | 3.046875 | 3 |
tests/features/test_bootloader_subcmd_creator.py | keaparrot/secbootctl | 0 | 12780275 | <reponame>keaparrot/secbootctl
import unittest
from tests import unittest_helper
class TestBootloaderSubcmdCreatorController(unittest_helper.SubCmdCreatorTestCase):
FEATURE_NAME: str = 'bootloader'
SUBCOMMAND_DATA: list = [
{'name': 'bootloader:install', 'help_message': 'install bootloader (systemd-b... | 2.25 | 2 |
tests/inventory/pipelines/test_data/fake_groups.py | pombredanne/forseti-security | 1 | 12780276 | # Copyright 2017 The Forseti Security Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the 'License');
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ap... | 1.234375 | 1 |
rs/Database/mackinac/test/test_workspace.py | stevenirby/RetSynth | 3 | 12780277 | import pytest
import mackinac
@pytest.fixture(scope='module')
def test_model(b_theta_genome_id, b_theta_id):
# Reconstruct a model so there is a folder in the workspace.
stats = mackinac.create_patric_model(b_theta_genome_id, model_id=b_theta_id)
yield stats
mackinac.delete_patric_model(b_theta_id)
... | 2.03125 | 2 |
pragfastapi/web_server_security.py | skillplot/pragfastapi | 0 | 12780278 | <filename>pragfastapi/web_server_security.py
## Copyright (c) 2020 mangalbhaskar.
"""FastAPI Security
https://fastapi.tiangolo.com/tutorial/security/first-steps/
https://fastapi.tiangolo.com/advanced/behind-a-proxy
https://fastapi.tiangolo.com/tutorial/security/get-current-user/
https://en.wikipedia.org/wiki/Security... | 3.15625 | 3 |
scripts/frustumPP_results.py | anshulpaigwar/Frustum-Pointpillars | 12 | 12780279 | <reponame>anshulpaigwar/Frustum-Pointpillars
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import pathlib
import sys
path_model = "/home/anshul/es3cap/codes/pointpillars/second.pytorch/"
sys.path.append(path_model)
#print sys.path
from pathlib import Path
import glob
import os
#print os.getcwd()
import time
import nu... | 1.96875 | 2 |
mobile/urls.py | felixyin/qdqtrj_website | 0 | 12780280 | #!/usr/bin/env python
# encoding: utf-8
"""
@version: ??
@author: liangliangyy
@license: MIT Licence
@contact: <EMAIL>
@site: https://www.lylinux.net/
@software: PyCharm
@file: urls.py
@time: 2016/11/2 下午7:15
"""
from django.urls import path
from django.views.decorators.cache import cache_page
from website.utils im... | 1.992188 | 2 |
worlds/migrations/0010_alter_job_job_definition.py | cognitive-space/warpzone | 1 | 12780281 | # Generated by Django 3.2.6 on 2021-08-04 18:09
import django.core.serializers.json
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('worlds', '0009_job_job_definition'),
]
operations = [
migrations.AlterField(
model_name='job... | 1.65625 | 2 |
solutions/delete_node.py | zmatteson/leetcode | 0 | 12780282 | """
Write a function to delete a node (except the tail) in a singly linked list, given only access to that node.
Supposed the linked list is 1 -> 2 -> 3 -> 4 and you are given the third node with value 3, the linked list should become 1 -> 2 -> 4 after calling your function.
Supposing that we are given the position, w... | 3.953125 | 4 |
ecosante/recommandations/forms/search.py | betagouv/ecosante | 0 | 12780283 | <filename>ecosante/recommandations/forms/search.py
from wtforms.fields.core import SelectMultipleField
from ecosante.utils.form import BaseForm, MultiCheckboxField
from wtforms.widgets.html5 import SearchInput
from wtforms.fields import StringField, SelectField
from markupsafe import Markup
from ..models import RECOMMA... | 2.375 | 2 |
src/run/Train_from_scratch.py | BruceBinBoxing/Deep_Learning_Weather_Forecasting | 53 | 12780284 | # -*- coding: utf-8 -*-
import click
import logging
from pathlib import Path
from dotenv import find_dotenv, load_dotenv
import netCDF4 as nc
import pickle as pk
import pandas as pd
import datetime
import os
import numpy as np
import sys
src_dir = os.path.join(os.getcwd(), 'src/data')
sys.path.append(src_dir)
from hel... | 2.203125 | 2 |
Triage model/running_the_models/prediction_script.py | shirangol/Covid19-Survey | 0 | 12780285 | import pickle
import numpy as np
import pandas as pd
import shap
import matplotlib.pyplot as pl
shap.initjs()
json_path = "response.json"
model_path = "xgboost_primary_model.pkl"
AGE_GROUP_CUTOFFS = [0, 17, 30, 40, 50, 60, 70, 120]
AGE_GROUPS_TRANSFORMER = {1: 10, 2: 25, 3: 35, 4: 45, 5: 55, 6: 65, 7: 75}
AGE_COL =... | 2.90625 | 3 |
carstate.py | ReFil/Ocelot | 21 | 12780286 | from cereal import car
from common.numpy_fast import mean, int_rnd
from opendbc.can.can_define import CANDefine
from selfdrive.car.interfaces import CarStateBase
from opendbc.can.parser import CANParser
from selfdrive.config import Conversions as CV
from selfdrive.car.ocelot.values import CAR, DBC, STEER_THRESHOLD, BUT... | 2.265625 | 2 |
src/arrays/max-chunks-to-make-sorted.py | vighnesh153/ds-algo | 0 | 12780287 | <reponame>vighnesh153/ds-algo
def solve(arr):
prefix_max = []
max_till_now = -float('inf')
for elem in arr:
max_till_now = max(max_till_now, elem)
prefix_max.append(max_till_now)
chunks = 0
minimum = arr[-1]
for i in range(len(arr) - 1, -1, -1):
if i > 0:
min... | 3.140625 | 3 |
ocsmesh/ops/combine_geom.py | yosoyjay/OCSMesh | 0 | 12780288 | <reponame>yosoyjay/OCSMesh<gh_stars>0
import gc
import logging
from multiprocessing import Pool, Lock, cpu_count
import os
import pathlib
import tempfile
import warnings
from typing import Union, Sequence, Tuple, List
import geopandas as gpd
import numpy as np
from pyproj import CRS, Transformer
from shapely import op... | 1.757813 | 2 |
app/main.py | aoirint/RoomSystemBotClient | 0 | 12780289 | <reponame>aoirint/RoomSystemBotClient<filename>app/main.py<gh_stars>0
import os
import time
import subprocess
import firebase_admin
from firebase_admin import credentials
from firebase_admin import db
FIREBASE_SECRET_PATH = os.environ['FIREBASE_SECRET_PATH']
FIREBASE_DATABASE_URL = os.environ['FIREBASE_DATABASE_URL']... | 2.078125 | 2 |
Mastermind/Mastermind.py | jamtot/PyProjects | 0 | 12780290 | import random
class Board(object):
def __init__(self, rows, columns, pegs):
self.rows = rows
self.columns = columns
self.pegs = pegs
self.code = self.makeCode()
def makeCode(self):
# randomly generate a peg for each row
code = []
for i in xrange(self.row... | 3.875 | 4 |
Guanabara/ex11 - modulos_pacotes/uteis/numeros/__init__.py | Edu1769/python | 0 | 12780291 | <gh_stars>0
def fatorial(n):
f = 1
for cont in range(1,n+1):
f= f*cont
return f
| 3.125 | 3 |
meerkat/parser.py | crdietrich/meerkat | 2 | 12780292 | """Data parsing tools"""
import json
import pandas as pd
## Data specific headers ##
# Global Positioning System Fix Data
# http://aprs.gids.nl/nmea/#gga
GGA_columns = ["nmea_type", "UTC_time", "latitude", "NS", "longitude", "EW", "quality", "n_satellites",
"horizontal_dilution", "altitude", "M", "... | 2.75 | 3 |
Interface/__init__.py | thuurzz/ping-python-google | 0 | 12780293 | <gh_stars>0
# Pensar em inteface
# Projetar interface | 1.179688 | 1 |
clustercode/tests/cluster/main.py | MatKie/clustercode | 0 | 12780294 | import sys
import os
print(os.getcwd())
sys.path.append("../")
from clustercode.ClusterEnsemble import ClusterEnsemble
from clustercode.clustering import cluster_analysis
# tpr = "/home/trl11/Virtual_Share/gromacs_test/npt.tpr"
# traj = "/home/trl11/Virtual_Share/gromacs_test/npt.xtc"
traj = "clustercode/tests/clust... | 2.203125 | 2 |
darknet/tools/submit_tools/read_results.py | vicwer/rebar_detect | 15 | 12780295 | import os
import re
import cv2
import numpy as np
def gen_img_label_list(csv_list):
csv_f = open(csv_list, 'r')
lines = csv_f.readlines()
cnt_img = ''
cnt_label = ''
for i in lines:
img = i.strip().split(' ')[0]
score = float(i.strip().split(' ')[1])
b = [int(float(j)) for j... | 2.609375 | 3 |
exercises/fit_gaussian_estimators.py | shlomi-perles/IML.HUJI | 0 | 12780296 | from IMLearn.learners import UnivariateGaussian, MultivariateGaussian
import numpy as np
import plotly.graph_objects as go
import plotly.io as pio
from matplotlib import pyplot as plt
pio.templates.default = "simple_white"
SAMPLES = 1000
QUESTION_ONE_MEAN = 10
QUESTION_ONE_VAR = 1
QUESTION_ONE_SAMPLES_SKIP = 10
QUEST... | 3.390625 | 3 |
python/venv/lib/python2.7/site-packages/keystoneauth1/tests/unit/keystoneauth_fixtures.py | sjsucohort6/openstack | 0 | 12780297 | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | 1.6875 | 2 |
API/main.py | Ankuraxz/Tagonizer-2 | 3 | 12780298 | <gh_stars>1-10
from fastapi import FastAPI, Query, status, Request
from typing import List
import re
import itertools
from azure.cognitiveservices.vision.computervision import ComputerVisionClient
from msrest.authentication import CognitiveServicesCredentials
from azure.ai.textanalytics import TextAnalyticsClient
from ... | 2.25 | 2 |
src/stackoverflow/58862981/main.py | mrdulin/python-codelab | 0 | 12780299 | <filename>src/stackoverflow/58862981/main.py
class AADatabase:
@classmethod
def is_primary(cls):
return False
@classmethod
def run(cls):
return cls.is_primary()
| 1.726563 | 2 |
Breast Cancer Prediction by Logistic Regression/cancer_prediction.py | parakh-gupta/Machine-Learning- | 0 | 12780300 | # Importing the libraries
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
# Importing our cancer dataset
dataset = pd.read_csv('breast_cancer_dataset.csv')
X = dataset.iloc[:, 1:9].values
Y = dataset.iloc[:, 9].values
# Encoding categorical data values
from sklearn.preprocessing impo... | 3.484375 | 3 |
sichu/cabinet/backends.py | ax003d/sichu_web | 55 | 12780301 | <filename>sichu/cabinet/backends.py
import models
class WeiboBackend(object):
supports_object_permissions = False
supports_anonymous_user = True
supports_inactive_user = True
def authenticate(self, wid=None):
try:
wu = models.WeiboUser.objects.get(uid=wid)
return wu.us... | 2.234375 | 2 |
examples/replicated_setups/prune/prep_data_prune.py | Jacobe2169/EvalNE | 92 | 12780302 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: <NAME>
# Contact: <EMAIL>
# Date: 18/12/2018
# This code preprocessed the Facebook wall post and the Webspam datasets in order to produce edgelists
# which can be then used to replicate the paper experiments using EvalNE.
from __future__ import division
import ... | 2.6875 | 3 |
celery/utils/coroutine.py | amplify-education/celery | 0 | 12780303 | from __future__ import absolute_import
from functools import wraps
from Queue import Queue
from celery.utils import cached_property
def coroutine(fun):
"""Decorator that turns a generator into a coroutine that is
started automatically, and that can send values back to the caller.
**Example coroutine th... | 3.515625 | 4 |
src/nexpy/api/frills/models/pdfdecay.py | nexpy/nexpy | 36 | 12780304 | import numpy as np
from lmfit.model import Model
class PDFdecayModel(Model):
r"""A model to describe the product of a decaying exponential and a Gaussian
with three parameters: ``amplitude``, ``xi``, and ``sigma``
.. math::
f(x; A, \xi, \sigma) = A e^{[-{|x|}/\xi]} e^{[{-{x^2}/{{2\sigma}^2}}]}
... | 3.078125 | 3 |
ddsp/spectral_ops_test.py | vvolhejn/ddsp | 0 | 12780305 | <reponame>vvolhejn/ddsp
# Copyright 2022 The DDSP Authors.
#
# 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... | 1.90625 | 2 |
day 9/multiple_linear_regression.py | JackRab/10-days-of-statistics | 0 | 12780306 | <reponame>JackRab/10-days-of-statistics<filename>day 9/multiple_linear_regression.py
"""
Link:
https://www.hackerrank.com/challenges/s10-multiple-linear-regression/problem
Objective
In this challenge, we practice using multiple linear regression.
"""
import numpy as np
def find_beta(X, Y):
"""
Find the co... | 4.03125 | 4 |
app/sendmail/__init__.py | csud-reservation/flask-backend | 1 | 12780307 | from flask import Blueprint
sendmail = Blueprint('sendmail', __name__, template_folder='templates/sendmail')
from . import views
| 1.351563 | 1 |
aa1_data_util/1_process_zhihu.py | sunshinenum/text_classification | 7,723 | 12780308 | # -*- coding: utf-8 -*-
import sys
#reload(sys)
#sys.setdefaultencoding('utf8')
#1.将问题ID和TOPIC对应关系保持到字典里:process question_topic_train_set.txt
#from:question_id,topics(topic_id1,topic_id2,topic_id3,topic_id4,topic_id5)
# to:(question_id,topic_id1)
# (question_id,topic_id2)
#read question_topic_train_set.txt
import ... | 2.703125 | 3 |
model/model.py | multimodallearning/hand-gesture-posture-position | 8 | 12780309 | <gh_stars>1-10
import torch
import torch.nn as nn
import torch.nn.functional as F
from model.backbones.bps_densenet import BPSDensenet
from model.backbones.cnn3d import VoxNet
from model.backbones.dgcnn import DGCNN_cls
from model.backbones.pointnet import PointNetCls
from model.backbones.pointnet2 import PointNet2
c... | 1.914063 | 2 |
Level/level_one.py | indiVar0508/Banania | 0 | 12780310 | import pygame
import numpy as np
from collections import OrderedDict
from Utility.shape import Rectangle
from Utility import ui
from Level.generic_level import GenericLevel
class Level(GenericLevel):
def __init__(self, player, **kwargs):
super().__init__(**kwargs)
self.player = player... | 2.859375 | 3 |
tests/test_packaging.py | jayvdb/ubiquerg | 0 | 12780311 | <reponame>jayvdb/ubiquerg<filename>tests/test_packaging.py<gh_stars>0
""" Validate what's available directly on the top-level import. """
import pytest
from inspect import isclass, isfunction
__author__ = "<NAME>"
__email__ = "<EMAIL>"
@pytest.mark.parametrize(
["obj_name", "typecheck"],
[("build_cli_extra"... | 2.21875 | 2 |
src/petronia/core/platform/api/font/__init__.py | groboclown/petronia | 19 | 12780312 |
"""
State definitions for supported fonts, font families, and other descriptions.
"""
from .defs import (
FontDefinition,
)
| 0.972656 | 1 |
831. Masking Personal Information.py | ttang235/leetcode | 0 | 12780313 | <filename>831. Masking Personal Information.py
# https://leetcode.com/contest/weekly-contest-83/problems/masking-personal-information/
class Solution(object):
def maskPII(self, S):
"""
:type S: str
:rtype: str
"""
if '@' in S:
arr = S.split('@')
return... | 3.296875 | 3 |
wxcloudrun/common/pdfutils.py | vandyzhou/wxcloudrun-django | 0 | 12780314 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
# @Time : 2022/1/29 10:35 上午
# @Author: zhoumengjie
# @File : pdfutils.py
import base64
import logging
import math
import os
import time
import pdfplumber
from pyecharts.components import Table
from pyecharts.options import ComponentTitleOpts
from selenium import webdrive... | 2.34375 | 2 |
benchmarks.py | jonahbaron/SELinuxBenchmarks | 0 | 12780315 | <reponame>jonahbaron/SELinuxBenchmarks<gh_stars>0
#!/usr/bin/python
from __future__ import division
import datetime
import os
def copytime(filesrc,filedst):
t1 = datetime.datetime.now()
os.system("cp " + filesrc + " copyfile.txt")
t2 = datetime.datetime.now()
t3 = t2 - t1
# print "Evaluating " + filesrc
# print ... | 2.296875 | 2 |
enaml/qt/qt_time_selector.py | mmckerns/enaml | 11 | 12780316 | #------------------------------------------------------------------------------
# Copyright (c) 2012, Enthought, Inc.
# All rights reserved.
#------------------------------------------------------------------------------
from .qt.QtGui import QTimeEdit
from .qt_bounded_time import QtBoundedTime
class QtTimeSelector... | 2.125 | 2 |
maddpg.py | 170928/-Review-Multi-Agent-Actor-Critic-for-Mixed-Cooperative-Competitive-Environment | 7 | 12780317 | <reponame>170928/-Review-Multi-Agent-Actor-Critic-for-Mixed-Cooperative-Competitive-Environment<gh_stars>1-10
import numpy as np
import tensorflow as tf
import random
import tensorflow.layers as layer
from collections import deque
import random
import datetime
import time
from multiagent.environment import MultiAgentEn... | 2.203125 | 2 |
cerebra/check_coverage.py | rvanheusden/cerebra | 1 | 12780318 | <gh_stars>1-10
""" this tool compares VCF records to gVCF for a given cell, to determine coverage
to a given loci. keep in mind the loci should be SMALL, ie. individual SNPs /
small indels. it is not intended for whole exon or whole transcript queries """
import pandas as pd
import numpy as np
from . import VCF
imp... | 2.546875 | 3 |
seaice/tools/xlsify/regional_daily.py | andypbarrett/nsidc-seaice | 2 | 12780319 | """Reformats daily seaice data into regional xls file
This is for internal use by scientists.
"""
import calendar as cal
import os
import click
import pandas as pd
from . import util
import seaice.nasateam as nt
import seaice.logging as seaicelogging
import seaice.timeseries as sit
log = seaicelogging.init('seaice... | 2.734375 | 3 |
9. Testing with pytest-mock and pytest-flask/source_code/tests/test_example.py | Edmartt/articles | 31 | 12780320 | import pytest
import example.app
@pytest.fixture
def app(mocker):
mocker.patch("flask_sqlalchemy.SQLAlchemy.init_app", return_value=True)
mocker.patch("flask_sqlalchemy.SQLAlchemy.create_all", return_value=True)
mocker.patch("example.database.get_all", return_value={})
return example.app.app
def te... | 2.390625 | 2 |
models/mesh_classifier.py | fishfishson/MeshCNN | 0 | 12780321 | <filename>models/mesh_classifier.py
import torch
from . import networks
import torch.nn as nn
from os.path import join
from util.util import seg_accuracy, print_network
from models.resunet import DAResNet3d
class ClassifierModel:
""" Class for training Model weights
:args opt: structure containing configurat... | 2.484375 | 2 |
tordatahub/core.py | jasonz93/python-tordatahub | 0 | 12780322 | <gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Ap... | 1.835938 | 2 |
figS3_eCLe.py | j-friedrich/neuralOFC | 4 | 12780323 | <gh_stars>1-10
""" Script to produce Fig. S3 """
from ofc import System, parmap
import matplotlib.pyplot as plt
import numpy as np
from scipy.ndimage import median_filter
# colors from Okabe & Ito's colorblind friendly palette
colors = ["#0072B2", "#009E73", "#D55E00", "#E69F00"]
plt.rc('axes', prop_cycle=plt.cycler(... | 2.03125 | 2 |
sentry_scrapy/utils.py | m-vdb/sentry-scrapy | 7 | 12780324 | <gh_stars>1-10
"""Utils module."""
def response_to_dict(response):
"""
Convert a `scrapy.http.Response` to a dictionnary.
"""
return {
'status': response.status,
'url': response.url,
'headers': response.headers.to_unicode_dict(),
'body': response.text,
}
| 2.671875 | 3 |
tests/TestParetoFront.py | ianran/rdml_graph | 4 | 12780325 | <gh_stars>1-10
# TestParetoFront.py
# Written <NAME> February 2021
#
# The test Pareto Front.
import rdml_graph as gr
import numpy as np
import matplotlib.pyplot as plt
import time
if __name__ == '__main__':
front = gr.ParetoFront(3, alloc_size=10)
rewards = np.array([[3,4,5], [2, 3,4], [5,2,1], [3,4,6], ... | 2.65625 | 3 |
main.py | btanner/differential_value_iteration | 0 | 12780326 | """Sample program that runs a sweep and records results."""
from pathlib import Path
from typing import Sequence
import numpy as np
from absl import app
from absl import flags
from differential_value_iteration import utils
from differential_value_iteration.algorithms import algorithms
from differential_value_iteration... | 2.84375 | 3 |
dz.py | miliskok/bot1 | 0 | 12780327 | from telebot import types
def my_input(bot, chat_id, txt, ResponseHandler):
message = bot.send_message(chat_id, text=txt)
bot.register_next_step_handler(message, ResponseHandler)
# -----------------------------------------------------------------------
def my_inputInt(bot, chat_id, txt, ResponseHandler):
... | 2.328125 | 2 |
torchbenchmark/models/fastNLP/reproduction/Star_transformer/util.py | Chillee/benchmark | 2,693 | 12780328 | import fastNLP as FN
import argparse
import os
import random
import numpy
import torch
def get_argparser():
parser = argparse.ArgumentParser()
parser.add_argument('--lr', type=float, required=True)
parser.add_argument('--w_decay', type=float, required=True)
parser.add_argument('--lr_decay', type=float... | 2.421875 | 2 |
core/models/behaviours/nameable.py | bergran/pokemon_project_example | 0 | 12780329 | # -*- coding: utf-8 -*-
from django.db import models
class Nameable(models.Model):
name = models.CharField(max_length=40)
class Meta:
abstract = True
| 2.046875 | 2 |
cortex2/__init__.py | lowenhere/emotiv-cortex2-python-client | 10 | 12780330 | from .emotiv_cortex2_client import EmotivCortex2Client
__all__ = [
'EmotivCortex2Client'
]
# Version 1.0.0
| 1.117188 | 1 |
Bot.py | danHoberman1999/nim_ai | 0 | 12780331 |
from Board import Board
class Bot(Board):
def __init__(self, state):
self.name = "Dr. Nimbot"
self.pile_states = None
self.state = state
self.even = []
self.odd = []
'''
Keeps track of states off current nim board.
'''
def nim_develop_state(self):
... | 3.171875 | 3 |
randomPassword.py | Jarvis-Yu/RandomPasswordGenerator | 0 | 12780332 | import sys
from random import randint
class SymbolSet:
def __init__(self, string: str, weight: int) -> None:
self.__str = string
self.__weight = weight
def getWeight(self) -> int:
return self.__weight
def getChar(self) -> str:
index = randint(0, len(self.__str) - 1)
... | 3.3125 | 3 |
Vault7/Lost-in-Translation/windows/Resources/Ops/PyScripts/windows/sqliteWorkaround.py | dendisuhubdy/grokmachine | 46 | 12780333 | <gh_stars>10-100
import dsz
import sqlite3
import sys
if (__name__ == '__main__'):
save_flags = dsz.control.Method()
dsz.control.echo.Off()
if (dsz.script.Env['script_parent_echo_disabled'].lower() != 'false'):
dsz.control.quiet.On()
if (len(sys.argv) != 3):
dsz.ui.Echo(('Inva... | 2.546875 | 3 |
wu_current_json.py | johnny22/Weather_app | 0 | 12780334 | import requests
import pickle
import json
def make_call(location):
apikey = '<KEY>'
URL = 'https://api.weather.com/v2/pws/observations/current?apiKey={0}&stationId={1}&numericPrecision=decimal&format=json&units=e'.format(apikey, location)
headers = {
"User-Agent": "Mozilla/5.0 (Macintosh; ... | 3.328125 | 3 |
photos/views.py | octaviodive/social_network_project | 0 | 12780335 | <filename>photos/views.py
from django.shortcuts import render, redirect
from .models import Category, Photo
from django.contrib.auth.decorators import login_required
@login_required(login_url='login')
def gallery(request):
user = request.user
category = request.GET.get('category')
if category == None:
... | 2.203125 | 2 |
tools/check_extract_queue.py | itpir/geo-hpc | 3 | 12780336 | """
check if any items that are ready for processing exist in extract queue
ready for processing = status set to 0
extract queue = mongodb db/collection: asdf->extracts
"""
# ----------------------------------------------------------------------------
import sys
import os
branch = sys.argv[1]
utils_dir = os.path... | 2.578125 | 3 |
lib/jsonModule.py | mrotke/pyStock | 0 | 12780337 | <filename>lib/jsonModule.py<gh_stars>0
#!/usr/bin/python3
'''
Created on 3 sty 2020
@author: spasz
'''
import json
import os
def jsonRead(filename):
data = []
if os.path.isfile(filename):
with open(filename, 'r') as f:
data = json.load(f)
else:
print('(JsonModule) File not exis... | 3.078125 | 3 |
code/utils/vad_util.py | zacharyclam/speaker_recognition | 37 | 12780338 | #!/usr/env/python python3
# -*- coding: utf-8 -*-
# @File : vad_util.py
# @Time : 2018/8/29 13:37
# @Software : PyCharm
import numpy as np
from math import log
import librosa
def mse(data):
return ((data ** 2).mean()) ** 0.5
def dBFS(data):
mse_data = mse(data)
if mse_data == 0.0:
retur... | 2.5625 | 3 |
src/translate.py | SeungoneKim/Transformer_implementation | 0 | 12780339 | import os
import sys
import argparse
import logging
import tqdm
import numpy as np
import matplotlib.pyplot as plt
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from data.tokenizer import Tokenizer
from util.utils import load_bestmodel
def translate(args, ... | 2.296875 | 2 |
demo/visdrone_demo.py | kding1225/TDTS-visdrone | 10 | 12780340 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import argparse
import cv2, os
from fcos_core.config import cfg
from predictor import VisDroneDemo
import time
def main():
parser = argparse.ArgumentParser(description="PyTorch Object Detection Webcam Demo")
parser.add_argument(
... | 2.296875 | 2 |
rpython/translator/goal/targetgcbench.py | kantai/passe-pypy-taint-tracking | 2 | 12780341 | import os, sys
from rpython.translator.goal import gcbench
# _____ Define and setup target ___
def target(*args):
gcbench.ENABLE_THREADS = False # not RPython
return gcbench.entry_point, None
"""
Why is this a stand-alone target?
The above target specifies None as the argument types list.
This is a case ... | 2.25 | 2 |
migrations/versions/1c581a07c81f_.py | AbhishekPednekar84/personal-portfolio | 2 | 12780342 | <gh_stars>1-10
"""empty message
Revision ID: 1c581a07c81f
Revises:
Create Date: 2019-11-25 14:58:22.016437
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = "1<PASSWORD>"
down_revision = None
branch_labels = None
depends_... | 1.257813 | 1 |
motorcycles.py | yiyidhuang/PythonCrashCrouse2nd | 0 | 12780343 | <filename>motorcycles.py
motorcycles = ['honda', 'yamaha', 'suzuki']
print(motorcycles)
motorcycles[0] = 'ducati'
print(motorcycles)
motorcycles.append('duati')
print(motorcycles)
motorcycles = []
motorcycles.append('honda')
motorcycles.append('yamaha')
motorcycles.append('suzuki')
print(motorcycles)
# Insert
pri... | 3.453125 | 3 |
sequeval/profiler.py | D2KLab/sequeval | 10 | 12780344 | <filename>sequeval/profiler.py
class Profiler:
def __init__(self, sequences):
users = []
items = []
ratings = []
for sequence in sequences:
for rating in sequence:
users.append(rating[1])
items.append(rating[0])
ratings.ap... | 3.328125 | 3 |
gym/envs/box2d/find_unconstructed_roads.py | Riya5915/gym | 46 | 12780345 | import os
import shutil
from pdb import set_trace
from gym.envs.box2d.car_racing import CarRacing
import numpy as np
import pandas as pd
def find_roads():
path = './touching_tracks_tests'
# Check if dir exists TODO
if os.path.isdir(path):
# Remove files TODO
shutil.rmtree(path)
# Cre... | 2.6875 | 3 |
python/isbn-verifier/isbn_verifier.py | ajayat/exercism.io | 1 | 12780346 | <reponame>ajayat/exercism.io
import re
def is_valid(isbn: str) -> bool:
if match := re.match(r"^(\d{9}[0-9X])$", isbn.replace('-', '')):
isbn = list(match.group(1))
if isbn[-1] == 'X':
isbn[-1] = 10
if sum(int(n)*(10-i) for i, n in enumerate(isbn)) % 11 == 0:
return... | 3.453125 | 3 |
order/migrations/0008_order_stripe_payment_id.py | abdellatifLabr/MyStore | 0 | 12780347 | <reponame>abdellatifLabr/MyStore<filename>order/migrations/0008_order_stripe_payment_id.py
# Generated by Django 3.1 on 2020-08-21 13:32
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('order', '0007_auto_20200818_1555'),
]
operations = [
... | 1.320313 | 1 |
tui/textwin.py | Chiel92/tfate | 3 | 12780348 | "Module containing TextWin class."""
from .window import Window, EndOfWin
from logging import info
class TextWin(Window):
"""Window containing the text"""
def __init__(self, ui):
Window.__init__(self, ui)
self.offset = 0
def draw_empty_interval(self):
try:
self.draw_... | 2.890625 | 3 |
envs/act_game.py | rradules/opponent_modelling_monfg | 1 | 12780349 | <reponame>rradules/opponent_modelling_monfg
"""
(Im)balancing Act Game environment.
"""
import gym
import numpy as np
class ActGame(gym.Env):
"""
A two-agent vectorized multi-objective environment.
Possible actions for each agent are (L)eft, (M)iddle and (R)ight.
"""
NUM_AGENTS = 2
NUM_OBJEC... | 2.71875 | 3 |
src/lib/test_environment/abstract_spawn_test_environment.py | tkilias/integration-test-docker-environment | 0 | 12780350 | import luigi
from ...abstract_method_exception import AbstractMethodException
from ...lib.test_environment.populate_data import PopulateEngineSmallTestDataToDatabase
from ...lib.test_environment.upload_exa_jdbc import UploadExaJDBC
from ...lib.test_environment.upload_virtual_schema_jdbc_adapter import UploadVirtualSch... | 2 | 2 |