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 |
|---|---|---|---|---|---|---|
app/upload/excelparser.py | S3Infosoft/s3-payment-autoaudit | 0 | 12788451 | import re
from datetime import date
import pyexcel
def convert_to_date(datetime: str):
"""Convert the date-time string(dd/mm/yyyy) to date time object"""
if type(datetime) == str:
date_, *_ = datetime.split()
dd, mm, yyyy = [int(val) for val in date_.split("/")]
return date(year=yyyy, ... | 3.484375 | 3 |
twitter_bot.py | etopuz/twitter-bot-with-selenium | 1 | 12788452 | import time
import pickle
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
import os.path
def load_cookies(driver):
for cookie in pickle.load(open("TwitterCookies.pkl", "rb")):
driver.add_cookie(cookie)
def save_cookies(driver):
pickle.dump(driver.ge... | 2.859375 | 3 |
core/hooks/ImageReconstructHook.py | szokejokepu/natural-rws | 0 | 12788453 | from core.argo.core.argoLogging import get_logger
tf_logging = get_logger()
import numpy as np
from core.argo.core.hooks.AbstractImagesReconstructHook import AbstractImagesReconstructHook
from core.argo.core.utils.ImagesSaver import ImagesSaver
class ImagesReconstructHook(AbstractImagesReconstructHook):
def d... | 2.25 | 2 |
vcue/basics.py | losDaniel/vcue-repo | 0 | 12788454 | import sys
sys.path.append('../')
import bz2, os
import random, string
import importlib
import _pickle as pickle
from datetime import datetime, timedelta
# ~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<
# OS & list MANAGEMENT FUNCTIONS <~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<... | 2.921875 | 3 |
jiraexport/issuestream.py | nicwaller/jira-text | 0 | 12788455 | """Fetch JIRA issues from database
Defines a schema using SQLalchemy
"""
from __future__ import absolute_import
from __future__ import print_function
import logging
import sqlalchemy
from sqlalchemy.orm import sessionmaker
from . import jiraschema
def get_issues(user, password, host="localhost", database="jira"):
... | 2.859375 | 3 |
examples/kernels/sphere/sphere_kernels.py | NoemieJaquier/GaBOflow | 5 | 12788456 | import numpy as np
import gpflow
import matplotlib.pyplot as plt
import matplotlib.pylab as pl
from mpl_toolkits.mplot3d import axes3d, Axes3D
from BoManifolds.Riemannian_utils.sphere_utils import logmap
from BoManifolds.kernel_utils.kernels_sphere_tf import SphereGaussianKernel, SphereLaplaceKernel
from BoManifolds.p... | 2.390625 | 2 |
lintuasema-backend/app/api/classes/location/views.py | Lintuasemasovellus/lintuasemasovellus | 0 | 12788457 | from flask import render_template, request, redirect, url_for, jsonify, json
from flask_login import login_required
from app.api.classes.location.models import Location
from app.api.classes.observatory.models import Observatory
from app.api.classes.type.models import Type
from app.api.classes.observatory.services imp... | 2.484375 | 2 |
cqu_jxgl/cli.py | zombie110year/cqu_jxgl | 0 | 12788458 | import re
from datetime import datetime
from getpass import getpass
from sys import argv
from . import __version__
from .data.time import 沙坪坝校区作息时间, 虎溪校区作息时间
from .app import App
class CommandParser:
def __init__(self):
self.username = input("用户名: ").strip()
self.password = getpass("密码: ").strip(... | 3.21875 | 3 |
src/crawler.py | qiuhy/dl | 0 | 12788459 | <filename>src/crawler.py
# -*- coding: utf-8 -*-
"""
Created on 2017-05-05
@author: hy_qiu
"""
import json
import logging
import os
import urllib.parse
import urllib.request
from src.util.wraps import retry
TIMEOUT = 15
def file_copy2path(fn, pn):
if not os.path.exists(fn) or not os.path.isfi... | 2.71875 | 3 |
results/urls.py | Wellheor1/l2 | 10 | 12788460 | from django.urls import path
from django.views.generic import TemplateView
from . import views
urlpatterns = [
path('search/directions', views.results_search_directions),
path('enter', views.enter),
path('get', views.result_get),
path('pdf', views.result_print),
path('preview', TemplateView.as_vie... | 1.789063 | 2 |
VoidFinder/vast/voidfinder/volume_cut.py | DESI-UR/VAST | 5 | 12788461 | <reponame>DESI-UR/VAST
#imports
import numpy as np
import os
import sys
import mmap
import struct
import socket
import select
import atexit
import signal
import tempfile
import multiprocessing
from psutil import cpu_count
from astropy.table import Table
from multiprocessing import Queue, Process, RLock, Value, Arra... | 2.28125 | 2 |
vespa/analysis/functors/funct_fidsum_coil_combine.py | vespa-mrs/vespa | 0 | 12788462 | <reponame>vespa-mrs/vespa
# Python imports
# 3rd party imports
import numpy as np
# Vespa imports
from vespa.analysis.algos.suspect_channel_combination import whiten, svd_weighting, combine_channels
COILCOMBINE_MENU_ITEMS = ['Siemens',
'CMRR',
'CMRR-Sequential',
... | 2.359375 | 2 |
ipx800/__init__.py | marcaurele/py-ipx800 | 0 | 12788463 | <reponame>marcaurele/py-ipx800<filename>ipx800/__init__.py
"""Module to control the IPX800 V4 device from GCE Electronics."""
from ipx800.ipx800 import ApiError, IPX800 as ipx800 # noqa
__version__ = "0.6.dev0"
| 1.578125 | 2 |
apps/salt/salt_api.py | cc0411/oms | 0 | 12788464 | <gh_stars>0
# -*- coding: utf-8 -*-
from django.conf import settings
import time
import copy
import requests
import logging
# Create your views here.
logger = logging.getLogger('devoms.views')
# 封装salt-api的调用
class SaltAPI(object):
# 给获取token的几个参数设置默认值,这样如果真突然出现调用另一个salt-api的情况,直接把对应参数传入一样适用哈哈
# 第一个参数session... | 2.0625 | 2 |
choir/modeling/meta_arch/__init__.py | scwangdyd/large_vocabulary_hoi_detection | 9 | 12788465 | # -*- coding: utf-8 -*-
from .build import META_ARCH_REGISTRY, build_model
from .hoi_detector import HOIR
from .cascade_hoi_detector import CHOIR | 1 | 1 |
students/k3342/practical_works/Kocheshkova_Kseniia/django_project_kocheshkova/project_first_app/admin.py | Derimeer/ITMO_ICT_WebProgramming_2020 | 0 | 12788466 | from django.contrib import admin
from .models import Owner
admin.site.register(Owner)
from .models import Car
admin.site.register(Car)
from .models import Ownership
admin.site.register(Ownership)
from .models import License
admin.site.register(License)
| 1.375 | 1 |
codes_auto/1633.minimum-number-of-increments-on-subarrays-to-form-a-target-array.py | smartmark-pro/leetcode_record | 0 | 12788467 | <reponame>smartmark-pro/leetcode_record
#
# @lc app=leetcode.cn id=1633 lang=python3
#
# [1633] minimum-number-of-increments-on-subarrays-to-form-a-target-array
#
None
# @lc code=end | 1.1875 | 1 |
src/apis/scaffold/install.py | OMOBruce/epic-awesome-gamer | 0 | 12788468 | <filename>src/apis/scaffold/install.py<gh_stars>0
# -*- coding: utf-8 -*-
# Time : 2022/1/20 16:16
# Author : QIN2DIM
# Github : https://github.com/QIN2DIM
# Description:
from webdriver_manager.chrome import ChromeDriverManager
from services.settings import DIR_MODEL, logger
from services.utils import YO... | 2.25 | 2 |
divdis/model.py | AlexandreAbraham/DivDis | 0 | 12788469 | <gh_stars>0
import torch
from torch import nn
class DivDis(nn.Module):
def __init__(self, backbone, n_output, n_heads, n_classes, lambda_mi=1., lambda_reg=1.):
super().__init__()
self.backbone = backbone
self.heads = [nn.Sequential(nn.Linear(n_output, n_classes), nn.Soft... | 2.453125 | 2 |
scrapper/request.py | samedamci/searx-instance-scrapi | 0 | 12788470 | #!/usr/bin/env python3
from scrapper import INSTANCE_URL
from bs4 import BeautifulSoup
import requests
def get_html() -> BeautifulSoup:
"""Function makes GET request to instance and downloads raw HTML code
which is parsing after."""
html_doc = requests.get(f"{INSTANCE_URL}/preferences").content
html ... | 3.203125 | 3 |
security/JWT.py | TusharMalakar/Core_CollabService | 0 | 12788471 | import datetime
import jwt
import os
from functools import wraps
from flask import request, Response
SECRET_KEY = "ThisIsAVeryBadAPISecretKeyThatIsOnlyUsedWhenRunningLocally"
if 'API_KEY' in os.environ: SECRET_KEY = os.environ['API_KEY']
# generates an encrypted auth token using the encrypted using the secret key va... | 2.90625 | 3 |
Apps/WeatherApp/app.py | miyucode/MaxPyOS | 2 | 12788472 | from tkinter import *
from tkinter.ttk import *
from tkinter import ttk
import tkinter.messagebox as mb
import sys, os, requests
def weatherapp():
def closeweatherapp():
file = open('Apps/WeatherApp/src/weather-condition.txt', 'w')
file.write("")
file.close()
weatherapp.destroy()
def getWeather(canvas):... | 3.125 | 3 |
mlflow/odahuflow/trainer/helpers/fs.py | odahu/odahuTrainer | 5 | 12788473 | import os
import shutil
def copytree(src, dst):
"""
Copy file tree from <src> location to <dst> location
"""
for item in os.listdir(src):
s = os.path.join(src, item)
d = os.path.join(dst, item)
if os.path.isdir(s):
shutil.copytree(s, d)
else:
shu... | 3.359375 | 3 |
OrzMC/core/PaperAPI.py | OrzGeeker/OrzMC | 7 | 12788474 | # -*- coding: utf8 -*-
# papermc: https://papermc.io
# api v1: https://paper.readthedocs.io/en/latest/site/api.html
# api v2: https://papermc.io/api/docs/swagger-ui/index.html?configUrl=/api/openapi/swagger-config
import urllib.request
import urllib.parse
import json
class PaperAPI:
''' api documentation: https:/... | 2.109375 | 2 |
lib/BarSeqPy/data_prep1.py | OGalOz/barseqR | 0 | 12788475 | import os, logging, json, re
import pandas as pd
import numpy as np
from BarSeqPy.translate_R_to_pandas import *
def data_prep_1(data_dir, FEBA_dir, debug_bool=False, meta_ix=7, cfg=None):
""" The first phase of data preparation for the BarSeqR Computations
Args:
data_dir: (str) Path to directory whic... | 2.703125 | 3 |
python/latex_plots.py | kjetil-lye/phd_thesis_standalone_plots | 0 | 12788476 | import matplotlib
matplotlib.rcParams['savefig.dpi'] = 600
# see https://stackoverflow.com/a/46262952 (for norm symbol)
# and https://stackoverflow.com/a/23856968
matplotlib.rcParams['text.usetex'] = True
matplotlib.rcParams['text.latex.preamble'] = [
r'\usepackage{amsmath}',
r'\usepackage{amsfonts}',
r'\u... | 2.109375 | 2 |
core/utils/nagisa.py | darakudou/setlist_forecast | 0 | 12788477 | import nagisa
from core.models import Music
class Nagisa():
def __init__(self, idol):
self.musics = Music.objects.filter(artist=idol).values("id", "identifications_title")
self.overide_nagisa = nagisa.Tagger(
single_word_list=list(self.musics.values_list("identifications_title", fl... | 2.484375 | 2 |
readability/text/syllables.py | rbamos/py-readability-metrics | 198 | 12788478 | import re
def count(word):
"""
Simple syllable counting
"""
word = word if type(word) is str else str(word)
word = word.lower()
if len(word) <= 3:
return 1
word = re.sub('(?:[^laeiouy]es|[^laeiouy]e)$', '', word) # removed ed|
word = re.sub('^y', '', word)
matches = re.... | 4.09375 | 4 |
janusbackup/worker/jobs/test_job.py | NikitosnikN/janus-backup | 0 | 12788479 | import asyncio
from schedule import Scheduler
from janusbackup.logger import logger
from janusbackup.worker.jobs import BaseJob
class TestJob(BaseJob):
is_active = False
@staticmethod
async def _job(*args, **kwargs):
logger.debug("Hello world for TestJob")
@classmethod
def set_schedule... | 2.34375 | 2 |
amftrack/pipeline/functions/post_processing/global_plate.py | Cocopyth/MscThesis | 1 | 12788480 | import networkx as nx
def num_hypha(exp,args):
return("num_hypha",len(exp.hyphaes))
def prop_lost_tracks_junction(exp,args):
lost = 0
tracked = 0
lapse = args[0]
# for node in exp.nodes:
# t0 = node.ts()[0]
# if node.degree(t0) >=3 and t0 + lapse < exp.ts:
# ... | 3.125 | 3 |
pysplit/member.py | polynomialchaos/pysplit | 0 | 12788481 | <reponame>polynomialchaos/pysplit
# MIT License
#
# Copyright (c) 2021 Florian
#
# 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
#... | 2.171875 | 2 |
scrap.py | silverkip/space-app | 0 | 12788482 | import json
import requests
from bs4 import BeautifulSoup
def updatePlaces(key):
'''Puts the launch places (address and coords) in a json'''
link = "http://www.spaceflightinsider.com/launch-schedule/"
places = {}
for url in [link, link+"?past=1"]:
page = requests.get(url)
soup = Beautif... | 3.140625 | 3 |
LeetcodeAlgorithms/337. House Robber III/house-robber-iii.py | Fenghuapiao/PyLeetcode | 3 | 12788483 | # Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def rob(self, root):
"""
:type root: TreeNode
:rtype: int
"""
def df... | 3.65625 | 4 |
glow/transforms/classes.py | arquolo/ort | 0 | 12788484 | <gh_stars>0
from __future__ import annotations
__all__ = [
'ChannelMix', 'ChannelShuffle', 'CutOut', 'BitFlipNoise', 'Elastic',
'LumaJitter', 'DegradeJpeg', 'DegradeQuality', 'FlipAxis', 'HsvShift',
'MaskDropout', 'MultiNoise', 'WarpAffine'
]
from dataclasses import InitVar, dataclass, field
from typing i... | 2.046875 | 2 |
recc/emulators/python/linux-emulator-example.py | oscourse-tsinghua/OS2018spring-projects-g02 | 249 | 12788485 | <gh_stars>100-1000
# Copyright 2016 <NAME> 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 ... | 2.515625 | 3 |
microcosm_sqlite/tests/test_threading.py | globality-corp/microcosm-sqlite | 0 | 12788486 | """
Threading tests.
"""
from multiprocessing.pool import ThreadPool
from tempfile import NamedTemporaryFile
from microcosm.api import create_object_graph
from microcosm.loaders import load_from_dict
from hamcrest import assert_that, contains
from microcosm_sqlite.context import SessionContext
from microcosm_sqlite.... | 2.625 | 3 |
cloud_addresses.py | auspex-labs/cloud-ipaddresses | 3 | 12788487 | <reponame>auspex-labs/cloud-ipaddresses<gh_stars>1-10
import re
import json
from ipaddress import ip_network
import requests
AWS_SOURCE = "https://ip-ranges.amazonaws.com/ip-ranges.json"
AZURE_SOURCE = "https://www.microsoft.com/en-us/download/confirmation.aspx?id=56519"
GPC_SOURCE = "https://www.gstatic.com/iprang... | 2.5625 | 3 |
paraproc.py | herrlich10/paraproc | 0 | 12788488 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2018 herrlich10
#
# 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... | 1.742188 | 2 |
hearthbreaker/cards/minions/warlock.py | zetsubo/hearthstone-simulator | 0 | 12788489 | <filename>hearthbreaker/cards/minions/warlock.py
from hearthbreaker.cards.base import MinionCard, WeaponCard
from hearthbreaker.constants import CHARACTER_CLASS, CARD_RARITY, MINION_TYPE
from hearthbreaker.game_objects import Weapon, Minion
from hearthbreaker.tags.action import Summon, Kill, Damage, Discard, DestroyMan... | 2.125 | 2 |
matplotlib/gallery_python/ticks_and_spines/tick-formatters.py | gottaegbert/penter | 13 | 12788490 | <reponame>gottaegbert/penter
"""
===============
Tick formatters
===============
Tick formatters define how the numeric value associated with a tick on an axis
is formatted as a string.
This example illustrates the usage and effect of the most common formatters.
"""
import matplotlib.pyplot as plt
import matplotlib.... | 3.53125 | 4 |
messenger/pc2/ReaderSet2.py | ABSanthosh/Python-messenger | 0 | 12788491 | <filename>messenger/pc2/ReaderSet2.py
import imaplib
import threading
import email
import email.parser
global ik
ans="y"
while ans=="y"or ans=="Y":
mail = imaplib.IMAP4_SSL('imap.gmail.com')
mail.login('mail2', 'mail2pass')
mail.list()
mail.select('inbox')
result, data = mail.uid('searc... | 2.75 | 3 |
deeds/apps.py | kingsdigitallab/ec-django | 0 | 12788492 | from django.apps import AppConfig
class DeedsConfig(AppConfig):
name = 'deeds'
| 1.179688 | 1 |
LC/225.py | szhu3210/LeetCode_Solutions | 2 | 12788493 | class Stack(object):
def __init__(self):
"""
initialize your data structure here.
"""
self.l=[]
def push(self, x):
"""
:type x: int
:rtype: nothing
"""
self.l.append(x)
for i in range(len(self.l)-1):
self.l.append(self.... | 4.0625 | 4 |
setup.py | kazuki/pyramid-oas3 | 2 | 12788494 | <gh_stars>1-10
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from setuptools import setup
def _load_lines(filename):
with open(os.path.join(os.path.dirname(__file__), filename)) as f:
return [l.strip() for l in f.readlines()]
setup(
name='pyramid_oas3',
version='0.1.5',
descriptio... | 1.53125 | 2 |
examples/trending_example.py | RiccardoTOTI/TikTok-Api-1 | 3 | 12788495 | <reponame>RiccardoTOTI/TikTok-Api-1<gh_stars>1-10
from TikTokApi import TikTokApi
verify_fp = "verify_xxx"
api = TikTokApi(custom_verify_fp=verify_fp)
for video in api.trending.videos():
print(video.id)
| 2.25 | 2 |
backend/crawler_news.py | nohsion/Neutral_Gear_News | 1 | 12788496 | import requests
import time
from bs4 import BeautifulSoup
from pymongo import MongoClient
from selenium import webdriver
client = MongoClient('localhost', 27017)
db = client.dbnews
def crawler_daum_news(date):
db_list = client.list_database_names()
if 'dbnews' in db_list:
print('db 최신 뉴스로 새로고침')
... | 2.8125 | 3 |
dashboard/libraries/constants.py | TetsuyaKataoka/DashBoardCovid19 | 1 | 12788497 | # CSVファイルのカラムとmodelのフィールドの対応付け情報
COLUMNS_PROVINCE_STATE_04 = 'Province_State'
COLUMNS_COUNTRY_REGION_04 = 'Country_Region'
# COLUMNS_REPORT_DATE_04 = 'Last_Update'
COLUMNS_LATITUDE_04 = 'Lat'
COLUMNS_LONGITUDE_04 = 'Long_'
COLUMNS_TOTAL_CASES_04 = 'Confirmed'
COLUMNS_TOTAL_DEATHS_04 = 'Deaths'
COLUMNS_TOTAL_RECOVERED_0... | 1.632813 | 2 |
seahub/api2/endpoints/admin/org_stats.py | MJochim/seahub | 0 | 12788498 | <filename>seahub/api2/endpoints/admin/org_stats.py
# Copyright (c) 2012-2016 Seafile Ltd.
from rest_framework.authentication import SessionAuthentication
from rest_framework.permissions import IsAdminUser
from rest_framework.response import Response
from rest_framework.views import APIView
from seahub.api2.authenticat... | 2.0625 | 2 |
sites_microsoft_auth/urls.py | gskudder/django_sites_microsoft_auth | 0 | 12788499 | <filename>sites_microsoft_auth/urls.py
from .old_conf import config
app_name = "sites_microsoft_auth"
urlpatterns = []
if config.MICROSOFT_AUTH_LOGIN_ENABLED: # pragma: no branch
from django.conf.urls import url
from . import views
urlpatterns = [
url(
r"^auth-callback/$",
... | 1.4375 | 1 |
postal_code_api/migrations/0002_auto_20161008_1707.py | xecgr/postal_code_api | 0 | 12788500 | # -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2016-10-06 04:40
from __future__ import unicode_literals
from django.db import migrations
def create_locations(apps, schema_editor):
country_model = apps.get_model("postal_code_api", "Country")
region_model = apps.get_model("postal_code_api", "Region")... | 1.742188 | 2 |
my_flask_web/Config.py | s123600g/FlaskDemoNotes | 0 | 12788501 | # -*- coding: utf-8 -*-
class BaseConfig():
# Flask 主要目錄設置
static_url_path = ''
static_folder = ''
template_folder = ''
class DevelopermentConfig(BaseConfig):
DEBUG = True
SECRET_KEY = "flask1A556j/33X *~X2l!fgN]HelloWorlD/,?RT"
# 環境模式參數設置
config = {
'developermentConfig': Developerme... | 1.695313 | 2 |
train/labeler.py | lvaughn/nnsplit | 248 | 12788502 | from typing import List
from fractions import Fraction
from abc import ABC, abstractmethod
import spacy
import string
import random
import pandas as pd
import numpy as np
import diskcache
import sys
from somajo import SoMaJo
from spacy.lang.tr import Turkish
from spacy.lang.sv import Swedish
from spacy.lang.uk import U... | 2.90625 | 3 |
tests/py/test_close.py | mccolgst/www.gittip.com | 0 | 12788503 | from __future__ import absolute_import, division, print_function, unicode_literals
from datetime import date
from decimal import Decimal as D
import mock
import pytest
from gratipay.billing.payday import Payday
from gratipay.models.community import Community
from gratipay.models.participant import Participant
from g... | 2.046875 | 2 |
example/xmlrpc/rpcserver.py | tirkarthi/python-sensor | 61 | 12788504 | <gh_stars>10-100
# (c) Copyright IBM Corp. 2021
# (c) Copyright Instana Inc. 2019
from xmlrpc.server import SimpleXMLRPCServer
import opentracing
def dance(payload, carrier):
ctx = opentracing.tracer.extract(opentracing.Format.HTTP_HEADERS, carrier)
with opentracing.tracer.start_active_span('RPCServer', ch... | 2.453125 | 2 |
tmhmm/__init__.py | nicolagulmini/tmhmm.py | 25 | 12788505 | from tmhmm.api import predict
__all__ = ['predict']
| 1.054688 | 1 |
writer/newyork30.py | rayidghani/esp32 | 0 | 12788506 | <gh_stars>0
# Code generated by font_to_py.py.
# Font: NewYork.ttf
# Cmd: ../../../micropython-font-to-py/font_to_py.py -x /System/Library/Fonts/NewYork.ttf 30 newyork30.py
version = '0.33'
def height():
return 30
def baseline():
return 23
def max_width():
return 29
def hmap():
return True
def reve... | 2.203125 | 2 |
emma/interface/management/commands/set_copyright.py | djangowebstudio/emma | 0 | 12788507 | <reponame>djangowebstudio/emma
from django.core.management.base import BaseCommand, CommandError, NoArgsCommand
from emma.interface.models import *
import os, sys
from optparse import make_option
class Command(BaseCommand):
help = """
Set all copyrights to a certain value. Will optionally filter on category an... | 2.1875 | 2 |
DynamicPortfolioBuilder/Files/FetchData.py | shiv-24/PFbuilder | 0 | 12788508 | <gh_stars>0
import Files.ConnectMongo as MC
client = MC.getMongoClient('127.0.0.1:27017')
# dbCur = MC.getDataFindWithFiltersAndCustomFields(client,'market_data','stock_data',{'Ticker':'AAPL'},{'CompanyName':1,'Date':1,'_id':0},[('Date',1)])
# for docs in dbCur:
# print(docs)
# disStockVal = MC.getDistinctVal... | 2.34375 | 2 |
lr_prediction.py | taskera/Altran | 0 | 12788509 | <filename>lr_prediction.py
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 6 13:30:11 2019
@author: <EMAIL>
"""
""" Importing all the libraries and the dataset"""
import matplotlib.pyplot as plt
import pandas as pd
from sklearn.feature_selection import RFE
from sklearn.linear_model import LogisticRegressio... | 2.84375 | 3 |
devilry/apps/core/migrations/0036_auto_20170523_1748.py | aless80/devilry-django | 29 | 12788510 | <gh_stars>10-100
# -*- coding: utf-8 -*-
# Generated by Django 1.9.9 on 2017-05-23 17:48
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0035_auto_20170523_1747'),
]
operations = [
migrations.AlterField(
model_name=... | 1.421875 | 1 |
python/lib/singly_linked_list.py | mmore21/ds_algo | 0 | 12788511 | <reponame>mmore21/ds_algo
"""
Topic: Singly Linked List
Category: Data Structure
Author: <NAME>
"""
class Node:
def __init__(self, val, next=None):
""" Constructor of Node class. """
self.val = val
self.next = next
def __str__(self):
""" Override default string format of node w... | 3.703125 | 4 |
flax/Ports.py | drewp/light9 | 2 | 12788512 | # super rough code
class AbstractPort:
def __init__(self):
pass
def put_data(self, value):
pass
def get_data(self):
pass
class Port(AbstractPort):
"Connects from a node to exactly one node."
def __init__(self, value=None):
AbstractPort.__init__(self)
self.va... | 3.546875 | 4 |
setup.py | phuongnh3012/django-scraper | 16 | 12788513 | import scraper
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
version = scraper.__version__
setup(
name='django-scraper',
version=version,
description='Django application for collecting online content following '
'user-defined instructions'... | 1.414063 | 1 |
vos/utils.py | rnikutta/datalab | 13 | 12788514 | <gh_stars>10-100
__author__ = 'jjk'
import errno
import os
def mkdir_p(path, mode):
try:
os.makedirs(path, mode)
except OSError as exc: # Python >2.5
if exc.errno == errno.EEXIST and os.path.isdir(path):
os.chmod(path, mode)
else:
raise OSError(errno.ENOTDIR, ... | 2.8125 | 3 |
scripts/analysis/scheduling_duration_cdf.py | Container-Projects/firmament | 287 | 12788515 | #!/usr/bin/python
import sys, re
from datetime import datetime
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
if len(sys.argv) < 2:
print "usage: scheduling_duration_cdf.py <log file 0> <label 0> " \
"<log file 1> <label 1> ..."
sys.exit(1)
durations = {}
for i in range(1, len(sy... | 2.84375 | 3 |
ml_preprocess_tools/nlp/tokenizer.py | altescy/ml-preprocess-tools | 0 | 12788516 | <reponame>altescy/ml-preprocess-tools
from __future__ import annotations
import typing as tp
from collections import namedtuple
from itertools import chain
import joblib
from sklearn.base import BaseEstimator, TransformerMixin
from sklearn.utils import gen_even_slices
from .token import Token, TokenType
Text = tp.L... | 2.234375 | 2 |
pommermanLearn/util/rewards.py | kungskode/playground | 0 | 12788517 | import numpy as np
from pommerman import constants
from pommerman.constants import Item
from util.data import calc_dist
def staying_alive_reward(nobs, agent_id):
"""
Return a reward if the agent with the given id is alive.
:param nobs: The game state
:param agent_id: The agent to check
... | 3.1875 | 3 |
src/attrbench/suite/dashboard/components/pages/detail_page.py | zoeparman/benchmark | 0 | 12788518 | import dash_bootstrap_components as dbc
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
from plotly import express as px
from attrbench.suite.dashboard.components.pages import Page
class DetailPage(Page):
def __init__(self, result_obj, app):
... | 2.375 | 2 |
result/models.py | thesaihan/ytu-su-voting | 0 | 12788519 | from django.db import models
# Create your models here.
class Candidate(models.Model):
id = models.IntegerField(primary_key=True)
cand_no = models.IntegerField(blank=True, null=True)
cand_type = models.CharField(max_length=1, blank=True, null=True)
name = models.CharField(max_length=150, blank=True, n... | 2.40625 | 2 |
micropython/term_server.py | al177/blinkencard | 2 | 12788520 |
from machine import UART
import sys
import select
import socket
import iceboot
import gc
def go():
"""
Stupid telnet to serial terminal for Blinkencard
"""
uart=UART(2, rx=16, tx=17, timeout=1)
uart.init(9600)
s = socket.socket()
s.bind(socket.getaddrinfo('0.0.0.0', 5000)[0][-1])
s.li... | 2.4375 | 2 |
E#09/temp.py | vads5/-Python-Prog | 2 | 12788521 | '''
name: E#09
author: <NAME>
email: <EMAIL>
link: https://www.youtube.com/channel/UCNN3bpPlWWUkUMB7gjcUFlw
MIT License https://github.com/repen/E-parsers/blob/master/License
'''
import requests
from bs4 import BeautifulSoup
base_url = "https://wallpapershome.com"
space = "/space?page=4"
response = requests.get(base... | 2.984375 | 3 |
model/model.py | Team-Glare/calorieApp_server | 0 | 12788522 | <filename>model/model.py
import pandas as pd
import pymongo
import collections
import matplotlib.pyplot as plt
import numpy as np
import string
df = pd.read_csv('C:\\Users\\Shivam\\Desktop\\calorieApp_server\\model\\cleaned_data.csv')
index_list = df.index.tolist()
client = pymongo.MongoClient('mongodb://localhost:27... | 2.859375 | 3 |
contrib/internal/build-i18n.py | SCB2278252/reviewboard | 1 | 12788523 | #!/usr/bin/env python
from __future__ import unicode_literals
import os
import sys
import django
from django.core.management import call_command
import reviewboard
if __name__ == '__main__':
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'reviewboard.settings')
if hasattr(django, 'setup'):
# Dja... | 1.65625 | 2 |
PageBotNano-002-Exporting/pagebotnano_002/document.py | juandelperal/PageBotNano | 0 | 12788524 | <filename>PageBotNano-002-Exporting/pagebotnano_002/document.py
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
# -----------------------------------------------------------------------------
#
# P A G E B O T N A N O
#
# Copyright (c) 2020+ <NAME> + <NAME>
# www.pagebot.io
# Licensed under MIT conditions
#
# ... | 2.734375 | 3 |
Sliding-Window/Fruits-Into-Baskets.py | umerkhan95/teaching-python | 0 | 12788525 | def fruits_into_baskets(fruits):
window_start = 0
max_length = 0
fruit_frequency = {}
# In this loop, we extend the range [window_start, window_end]
for window_end in range(len(fruits)):
right_fruit = fruits[window_end]
if right_fruit not in fruit_frequency:
fruit_freque... | 3.5 | 4 |
bit_manipulation/0868_binary_gap/0868_binary_gap.py | zdyxry/LeetCode | 6 | 12788526 | <gh_stars>1-10
# -*- coding: utf-8 -*-
class Solution(object):
def binaryGap(self, N):
"""
:type N: int
:rtype: int
"""
pre = dist = 0
for i, c in enumerate(bin(N)[2:]):
if c == "1":
dist = max(dist, i - pre)
pre = i
... | 3.109375 | 3 |
tests/test_fds.py | CyberFlameGO/fds | 322 | 12788527 | <reponame>CyberFlameGO/fds
import unittest
from unittest.mock import patch
import pytest
import re
from fds.version import __version__
from fds.services.fds_service import FdsService
from fds.run import HooksRunner
BOOLS = [True, False]
# NOTE unittest.mock:_Call backport
def patch_unittest_mock_call_cls():
im... | 2.40625 | 2 |
venv/Lib/site-packages/pdfminer/pslexer.py | richung99/digitizePlots | 202 | 12788528 | import re
import ply.lex as lex
states = (
('instring', 'exclusive'),
)
tokens = (
'COMMENT', 'HEXSTRING', 'INT', 'FLOAT', 'LITERAL', 'KEYWORD', 'STRING', 'OPERATOR'
)
delimiter = r'\(\)\<\>\[\]\{\}\/\%\s'
delimiter_end = r'(?=[%s]|$)' % delimiter
def t_COMMENT(t):
# r'^%!.+\n'
r'%.*\n'
pass
RE... | 2.4375 | 2 |
testFile1.py | Roxannelevi/Oksana | 0 | 12788529 | name = "Sergey"
department = "QA"
year = 2020
month = 10
print(name, department, year, month)
print(name + department)
if name == "Sergey":
print(name)
else:
print("name is different")
weather = 'rainy'
temperature = 21
print(weather)
print(temperature)
| 4.15625 | 4 |
doc_scanner/math_utils.py | guoli-lyu/document-scanner | 2 | 12788530 | import numpy as np
import pandas as pd
def intersection_cartesian(L1: pd.DataFrame, L2: pd.DataFrame):
"""
Compute cartesian coordinates of intersection points given two list of lines in general form.
General form for a line: Ax+By+C=0
:param L1:
:param L2:
:return:
"""
if not {'A', '... | 3.65625 | 4 |
asn1PERser/test/per/encoder/test_per_encode_enumerated.py | erupikus/asn1PERser | 3 | 12788531 | import pytest
from pyasn1.type.namedval import NamedValues
from asn1PERser.codec.per.encoder import encode as per_encoder
from asn1PERser.classes.data.builtin.EnumeratedType import EnumeratedType
from asn1PERser.classes.types.constraint import ExtensionMarker
def SCHEMA_my_enum(enumerationRoot_list, extensionMarker_v... | 2.171875 | 2 |
test/test_four_bit_mac.py | Atman-Kar/reram-architectures | 2 | 12788532 | from error.error_crossbar import *
from basic_blocks.mvm_four_bit import mvm_four_by_four
import unittest
import os
import sys
dir_path = os.path.dirname(os.path.realpath(__file__))
parent_dir_path = os.path.abspath(os.path.join(dir_path, os.pardir))
sys.path.insert(0, parent_dir_path)
class TestFourBitMAC(unittest.T... | 2.640625 | 3 |
split_image.py | eguzman3/BMI-CAAE | 1 | 12788533 | <filename>split_image.py
from PIL import Image
import glob
import sys
import os
# USAGE:
# python <split_image.py> <input_dir> <output_dir>
# where input_dir conatains PNG files (outputs from the model)
# and output_dir will contain 10 PNG files labeled by bucket number
if len(sys.argv) != 3:
print("WRong args")... | 3.140625 | 3 |
problems/484.Find_Permutation/stefan_1line_sort.py | subramp-prep/leetcode | 0 | 12788534 | def findPermutation(self, s):
return sorted(range(1, len(s) + 2), cmp=lambda i, j: -('I' not in s[j - 1:i - 1]))
# My 1 - liner tells sorted that the(larger) number i comes before
# the(smaller) number j iff they're both under the same D-streak, i.e.,
# iff there's no I between them. (I'm not totally sure that i wil... | 3.53125 | 4 |
activitysimulations/watchingsimulation.py | TheImaginaryOne/movies-py | 0 | 12788535 | <reponame>TheImaginaryOne/movies-py
from domainmodel.movie import Movie
from domainmodel.user import User
from domainmodel.review import Review
class MovieWatchingSimulation:
pass | 1.171875 | 1 |
algs4/merge.py | dumpmemory/algs4-py | 230 | 12788536 | """
Sorts a sequence of strings from standard input using merge sort.
% more tiny.txt
S O R T E X A M P L E
% python merge.py < tiny.txt
A E E L M O P R S T X [ one string per line ]
% more words3.txt
bed bug dad yes zoo ... all bad yet
% python merge.py < words3.txt
all bad bed bug dad .... | 4.09375 | 4 |
pick_choose.py | iomintz/python-snippets | 2 | 12788537 | <gh_stars>1-10
from math import factorial as fac
P = lambda n, r: fac(n) // fac(n - r)
C = lambda n, r: P(n, r) // fac(r)
| 2.125 | 2 |
accounts/views.py | Xavier-Cliquennois/ac-mediator | 9 | 12788538 | <reponame>Xavier-Cliquennois/ac-mediator<filename>accounts/views.py
from django.shortcuts import render
from django.contrib.auth.decorators import login_required
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
from accounts.forms import RegistrationForm, ReactivationForm
from a... | 1.890625 | 2 |
Chinese/HPS3D_SDK_ROS_Demo/devel/lib/python2.7/dist-packages/hps_camera/msg/__init__.py | hypersen/HPS3D_SDK | 13 | 12788539 | <filename>Chinese/HPS3D_SDK_ROS_Demo/devel/lib/python2.7/dist-packages/hps_camera/msg/__init__.py
from ._PointCloudData import *
from ._distance import *
from ._measureData import *
| 1.023438 | 1 |
mir3/modules/unsupervised/detection/threshold/tests.py | pymir3/pymir3 | 12 | 12788540 | import numpy
import mir3.data.linear_decomposition as ld
import mir3.module
class Tests(mir3.module.Module):
def get_help(self):
return """computes the values at which the threshold should be tested"""
def build_arguments(self, parser):
parser.add_argument('-n','--number-values', default=10,... | 2.765625 | 3 |
course/views.py | ZzzD97/Graduate-master | 0 | 12788541 | from django.shortcuts import render
# Create your views here.
from django.shortcuts import render
from django.http import JsonResponse, HttpResponse
from rest_framework.response import Response
from rest_framework.utils import json
from rest_framework.viewsets import ViewSetMixin
from course import models
from rest_fr... | 2.0625 | 2 |
observations/r/capm.py | hajime9652/observations | 199 | 12788542 | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import csv
import numpy as np
import os
import sys
from observations.util import maybe_download_and_extract
def capm(path):
"""Stock Market Data
monthly observations from 1960–01... | 3.203125 | 3 |
src/tests/test_pagure_flask_api_plugins_view.py | yifengyou/learn-pagure | 0 | 12788543 | # -*- coding: utf-8 -*-
"""
(c) 2019 - Copyright Red Hat Inc
Authors:
<NAME> <<EMAIL>>
"""
from __future__ import unicode_literals, absolute_import
import unittest
import sys
import os
import json
from mock import patch
sys.path.insert(
0, os.path.join(os.path.dirname(os.path.abspath(__file__)), "..")
)... | 1.882813 | 2 |
simple_history/tests/tests/test_commands.py | mikhsol/django-simple-history | 1 | 12788544 | from contextlib import contextmanager
from datetime import datetime
from six.moves import cStringIO as StringIO
from django.test import TestCase
from django.core import management
from simple_history import models as sh_models
from simple_history.management.commands import populate_history
from .. import models
@c... | 2.25 | 2 |
topologic/statistics/degree_centrality.py | microsoft/topologic | 24 | 12788545 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import networkx as nx
import numpy as np
from .defined_histogram import DefinedHistogram
from typing import List, Union
from .make_cuts import MakeCuts, filter_function_for_make_cuts
def histogram_degree_centrality(
graph: nx.Graph,
bin_... | 3.5625 | 4 |
dexp/processing/utils/nan_to_zero.py | haesleinhuepf/dexp | 16 | 12788546 | from dexp.utils import xpArray
from dexp.utils.backends import Backend, CupyBackend, NumpyBackend
def nan_to_zero(array: xpArray, copy: bool = True) -> xpArray:
"""
Replaces every nan in an array to zero. It might, or not, be able to operate in-place.
To be safe, the returned array should always be used..... | 3.09375 | 3 |
Utils.py | Vrroom/IRL | 2 | 12788547 | <reponame>Vrroom/IRL<gh_stars>1-10
""" Utility functions """
import torch
import numpy as np
def computeReturns(R, gamma, normalize=False) :
""" Compute discounted returns """
g = 0
G = []
for r in R[::-1] :
g = g * gamma + r
G.insert(0, g)
G = np.array(G)
if normalize :
... | 2.78125 | 3 |
pkg/agents/team4/trainingAgent/getLifeExpectancy.py | SOMAS2021/SOMAS2021 | 13 | 12788548 | import sys
import json
log_file_name = sys.argv[1]
number_of_agents = sys.argv[2]
agent_config_file_name = sys.argv[3]
best_agents_file_name = sys.argv[4]
current_iteration = sys.argv[5]
# reading contents of logfile
log_file = open(log_file_name, 'r')
lines = log_file.readlines()
log_file.close()
# convert log entr... | 3 | 3 |
Medium/0018. 4Sum/0018. 4Sum_still_slow.py | FlyProbe/LeetCode-Solutions | 1 | 12788549 | class Solution:
def fourSum(self, nums: List[int], target: int) -> List[List[int]]:
l = len(nums)
res = set() # 用set来处理重复的组合
nums.sort()
pre_i = None
for i in range(l-3):
if nums[i] == pre_i: # 跳过重复的固定数字
continue
... | 2.828125 | 3 |
packages/lintol/capstone/examples/processors/boundary_checker_impr.py | lintol/capstone | 0 | 12788550 | """Boundary checking (improved)
This function will (hopefully!) find if data in a csv file is contained within Northern Ireland.
If not so, this will be reported back to the user.
For now, please make sure that the second geojson in the argument is a boundary of Northern Ireland.
"""
import shapely
from geojson_util... | 3.125 | 3 |