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 |
|---|---|---|---|---|---|---|
switchmng/wsgi.py | AnsgarKlein/switchmng | 0 | 21600 | <filename>switchmng/wsgi.py
from switchmng import config
from switchmng.schema.base import Base
from switchmng.database import DatabaseConnection
from switchmng.routes import create_app
def app(*args, **kwargs):
"""
Entry point for wsgi server like `gunicorn` serving this
application.
Parse all comman... | 2.75 | 3 |
records_mover/db/postgres/copy_options/date_output_style.py | ellyteitsworth/records-mover | 0 | 21601 | from records_mover.utils import quiet_remove
from records_mover.records.delimited import cant_handle_hint, ValidatedRecordsHints
from typing import Set, Tuple, Optional
from .types import DateOrderStyle, DateOutputStyle
def determine_date_output_style(unhandled_hints: Set[str],
hints: ... | 2.171875 | 2 |
tacker/tests/unit/vnfm/infra_drivers/openstack/test_vdu.py | takahashi-tsc/tacker | 0 | 21602 | <gh_stars>0
# Copyright 2018 NTT DATA
# 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 require... | 1.59375 | 2 |
tests/test_example.py | jlane9/mockerena | 1 | 21603 | <gh_stars>1-10
"""test_example
.. codeauthor:: <NAME> <<EMAIL>>
"""
from flask import url_for
from eve import Eve
import pytest
@pytest.mark.example
def test_example(client: Eve):
"""Example test for reference
:param Eve client: Mockerena app instance
:raises: AssertionError
"""
res = client.... | 2.21875 | 2 |
tests/TestPoissonSpikeGeneration.py | VadimLopatkin/AtlasSnnController | 2 | 21604 | <reponame>VadimLopatkin/AtlasSnnController<filename>tests/TestPoissonSpikeGeneration.py<gh_stars>1-10
# 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 ... | 2.0625 | 2 |
stream.py | Abhishek-Aditya-bs/Streaming-Spark-For-Machine-Learning | 1 | 21605 | <reponame>Abhishek-Aditya-bs/Streaming-Spark-For-Machine-Learning
#! /usr/bin/python3
import time
import json
import pickle
import socket
import argparse
import numpy as np
from tqdm import tqdm
parser = argparse.ArgumentParser(
description='Streams a file to a Spark Streaming Context')
parser.add_argument('--fil... | 2.546875 | 3 |
subcontent/backup/python3_closure_nonlocal.py | fingerkc/fingerkc.github.io | 2 | 21606 | #!/usr/bin/python3
##python3 闭包 与 nonlocal
#如果在一个内部函数里,对在外部作用域(但不是在全局作用域)的变量进行引用,
#那么内部函数就被认为是闭包(closure)
def A_():
var = 0
def clo_B():
var_b = 1 # 闭包的局部变量
var = 100
print(var) # 引用外部的var , 但是不会改变var 的值
return clo_B
#clo_B是一个闭包
#nonlocal 关键字
def A_():
var = 0
def clo_B():
nonlocal var # nonlocal关... | 4.03125 | 4 |
utils/tracker.py | emarche/Fashion-MNIST | 0 | 21607 | <filename>utils/tracker.py
import os
import numpy as np
class Tracker:
def __init__(self, seed, model_name):
self.save_tag = model_name + '_seed_' + str(seed)
self.model_save = "models/"
if not os.path.exists(self.model_save): os.makedirs(self.model_save)
def save_model(self, model):
... | 2.671875 | 3 |
kittycad/models/cluster.py | KittyCAD/kittycad.py | 1 | 21608 | from typing import Any, Dict, List, Type, TypeVar, Union, cast
import attr
from ..types import UNSET, Unset
T = TypeVar("T", bound="Cluster")
@attr.s(auto_attribs=True)
class Cluster:
""" """
addr: Union[Unset, str] = UNSET
auth_timeout: Union[Unset, int] = UNSET
cluster_port: Union[Unset, int] = U... | 2.390625 | 2 |
Crypto.py | akshatsri89/Cryptogram | 1 | 21609 | # import tkinter module
from tkinter import *
# import other necessery modules
import random
# Vigenère cipher for encryption and decryption
import base64
# creating root object
root = Tk()
# defining size of window
root.geometry("1200x4000")
# setting up the title of window
root.title("Message Enc... | 3.453125 | 3 |
bootstrap_rmsf/__init__.py | jeeberhardt/bootstrap_rmsf | 1 | 21610 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# <NAME> 2018
# Bootstrap RMSF
# Author: <NAME> <<EMAIL>>
#
# License: MIT
from bootstrap_rmsf import Bootstrap_RMSF
from utils import plot_rmsf
| 1.25 | 1 |
fixture/application.py | OSavchik/python_training | 0 | 21611 | from selenium import webdriver
from fixture.session import SessionHelper
from fixture.group import GroupHelper
from fixture.contact import ContactHelper
class Application:
def __init__(self, browser, base_url):
if browser == "firefox":
self.wd = webdriver.Firefox()
elif browser == "Ch... | 2.53125 | 3 |
data_managers/data_manager_gatk_picard_index_builder/data_manager/data_manager_gatk_picard_index_builder.py | supernord/tools-iuc | 142 | 21612 | <gh_stars>100-1000
#!/usr/bin/env python
# <NAME>.
# Uses fasta sorting functions written by <NAME>.
import json
import optparse
import os
import shutil
import subprocess
import sys
import tempfile
CHUNK_SIZE = 2**20
DEFAULT_DATA_TABLE_NAME = "fasta_indexes"
def get_id_name(params, dbkey, fasta_description=None):
... | 2.46875 | 2 |
django_for_startups/django_customizations/drf_customizations.py | Alex3917/django_for_startups | 102 | 21613 | # Standard Library imports
# Core Django imports
# Third-party imports
from rest_framework import permissions
from rest_framework.throttling import UserRateThrottle, AnonRateThrottle
# App imports
class BurstRateThrottle(UserRateThrottle):
scope = 'burst'
class SustainedRateThrottle(UserRateThrottle):
sc... | 2.265625 | 2 |
python/mapCells.py | claraya/meTRN | 2 | 21614 | <filename>python/mapCells.py
#!/usr/bin/env python
# perform cellular-resolution expression analyses!
import sys
import time
import optparse
import general
import hyper
import numpy
import math
import pickle
import pdb
import metrn
import modencode
import itertools
import os
import re
import datetime
import calendar
... | 2.390625 | 2 |
gravity/bak/gravity3.py | baijianhua/pymath | 0 | 21615 | # https://stackoverflow.com/questions/47295473/how-to-plot-using-matplotlib-python-colahs-deformed-grid
"""
这个形状仍然不对。靠近坐标轴的地方变化太大。不管是横轴还是纵轴。应该是以原点为圆心,各个网格均匀分担才对
而不管是否靠近坐标轴
变形的目标,是在某处给定一个球体或者立方体,整个坐标中的网格,靠近这个物体的,受到变形影响,距离越远,影响
越小,直到可以忽略不计
但有个要求是靠近物体的网格,是均匀的受到影响,不能有的多,有的少
或许用极坐标是更好的选择?但是也不行。极坐标如何体现原有的坐标系呢?
极坐标没有平直的地方... | 3.59375 | 4 |
IR_Extraction.py | Kazuhito00/yolo2_onnx | 15 | 21616 | <reponame>Kazuhito00/yolo2_onnx
from Onnx import make_dir, OnnxImportExport
import subprocess
import pickle
import os
import numpy as np
import time
def generate_svg(modelName, marked_nodes=[]):
"""
generate SVG figure from existed ONNX file
"""
if marked_nodes ==[]:
addfilenamestr = ""
... | 2.609375 | 3 |
app.py | rshane7/Sqlalchemy-Challenge | 0 | 21617 | # Python script uses flask and SQL alchemy to create API requests for weather data from Hawaii.
# Import dependencies.
import numpy as np
import datetime as dt
import sqlalchemy
from sqlalchemy.ext.automap import automap_base
from sqlalchemy.orm import Session
from sqlalchemy import create_engine, func
from flask impo... | 3.125 | 3 |
optimalTAD/__main__.py | cosmoskaluga/optimalTAD | 0 | 21618 | import argparse
import logging
import sys
import time
import glob
import os
from . import logger
from . import config
from . visualization import plot
from . optimization import run
from . optimization import utils
class optimalTAD:
def __init__(self):
self.log = logger.initialize_logger()
self.cfg... | 2.40625 | 2 |
communications/migrations/0002_auto_20190902_1759.py | shriekdj/django-social-network | 368 | 21619 | <reponame>shriekdj/django-social-network
# Generated by Django 2.2.4 on 2019-09-02 11:59
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_M... | 1.71875 | 2 |
examples/sht2x.py | kungpfui/python-i2cmod | 0 | 21620 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Sensirion SHT2x humidity sensor.
Drives SHT20, SHT21 and SHT25 humidity and temperature sensors.
Sensirion `SHT2x Datasheets <https://www.sensirion.com/en/environmental-sensors/humidity-sensors/humidity-temperature-sensor-sht2x-digital-i2c-accurate/>`
"""
from i2cmo... | 3 | 3 |
__init__.py | HarisNaveed17/aws-boxdetector | 0 | 21621 | <reponame>HarisNaveed17/aws-boxdetector
from pipeline import *
box_detection = BoxDetector() | 1.171875 | 1 |
bazel_versions.bzl | pennig/rules_xcodeproj | 1 | 21622 | <gh_stars>1-10
"""Specifies the supported Bazel versions."""
CURRENT_BAZEL_VERSION = "5.0.0"
OTHER_BAZEL_VERSIONS = [
"6.0.0-pre.20220223.1",
]
SUPPORTED_BAZEL_VERSIONS = [
CURRENT_BAZEL_VERSION,
] + OTHER_BAZEL_VERSIONS
| 0.9375 | 1 |
Pymug/server/game/parse.py | Aitocir/UnfoldingWorld | 2 | 21623 |
def _compile(words):
if not len(words):
return None, ''
num = None
if words[0].isdigit():
num = int(words[0])
words = words[1:]
return num, ' '.join(words)
def _split_out_colons(terms):
newterms = []
for term in terms:
if ':' in term:
subterms = term... | 3.15625 | 3 |
files/OOP/Encapsulation/Encapsulation 3.py | grzegorzpikus/grzegorzpikus.github.io | 0 | 21624 | <reponame>grzegorzpikus/grzegorzpikus.github.io
class BankAccount:
def __init__(self, checking = None, savings = None):
self._checking = checking
self._savings = savings
def get_checking(self):
return self._checking
def set_checking(self, new_checking):
self._checking = new_checking
def get_... | 3.296875 | 3 |
utils/folder_to_list.py | abhatta1234/face_analysis_pytorch | 27 | 21625 | import argparse
from os import listdir, path
import numpy as np
def convert(main_folder, output):
ret = []
for label, class_folder in listdir(main_folder):
class_folder_path = path.join(main_folder, class_folder)
for img_name in listdir(class_folder_path):
image_path = path.join... | 2.953125 | 3 |
Leetcode/Python Solutions/Strings/ReverseString.py | Mostofa-Najmus-Sakib/Applied-Algorithm | 1 | 21626 | """
LeetCode Problem: 344. Reverse String
Link: https://leetcode.com/problems/reverse-string/
Language: Python
Written by: <NAME>
Time Complexity: O(n)
Space Complexity: O(1)
"""
class Solution:
def reverseString(self, s: List[str]) -> None:
"""
Do not return anything, modify s in-place instead.
... | 3.59375 | 4 |
packages/verify_layer.py | OpenTrustGroup/scripts | 0 | 21627 | <gh_stars>0
#!/usr/bin/env python
# Copyright 2018 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import argparse
from common import FUCHSIA_ROOT, get_package_imports, get_product_imports
import json
import os
import subpr... | 2.359375 | 2 |
server/main.py | MrCheka/langidnn | 0 | 21628 | <gh_stars>0
import tensorflow as tf
import argparse
import logging
from src.helpers.NNHelper import NNHelper
from src.controller.Controller import Controller
from src.params.Parameters import Parameters
def createParser():
parser = argparse.ArgumentParser(prog='langid_server',
... | 2.21875 | 2 |
Python/Code/Python3-Base/13_Network/Server/SingleProgressServer.py | hiloWang/notes | 2 | 21629 | #########################
# 单进程服务器
#########################
"""
同一时刻只能为一个客户进行服务,不能同时为多个客户服务类似于找一个“明星”签字一样,客户需要耐心等待才可以获取到服务
当服务器为一个客户端服务时,而另外的客户端发起了connect,只要服务器listen的队列有空闲的位置,就会为这个新客户端进行连接,
并且客户端可以发送数据,但当服务器为这个新客户端服务时,可能一次性把所有数据接收完毕当receive接收数据时,返回值为空,
即没有返回数据,那么意味着客户端已经调用了close关闭了;因此服务器通过判断receive接收数据是否为空 来判断客户端是否... | 2.921875 | 3 |
webapp/kortkatalogen/base/models.py | snickaren/CIPAC | 0 | 21630 | <filename>webapp/kortkatalogen/base/models.py
# -*- coding: utf-8 -*-
from django.db import models
class BaseCatalog(models.Model):
name = models.CharField(max_length=255)
description = models.TextField()
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=Tr... | 2.046875 | 2 |
script/raw-word-cloud.py | ranyxr/infoVis | 2 | 21631 | <reponame>ranyxr/infoVis<filename>script/raw-word-cloud.py
import os
import nltk
import spacy
from datetime import datetime
from pyspark.sql import SparkSession
from pyspark.sql.types import StringType, ArrayType
from pyspark.sql.functions import udf, col, explode, collect_list, count
from SYS import COL, MODE, DIR, FI... | 2.671875 | 3 |
main/ftpServer.py | McUtty/FlowerPlan | 0 | 21632 | <gh_stars>0
import uftpd
uftpd.stop()
# uftpd.start([port = 21][, verbose = 1])
uftpd.restart()
# Version abfragen
# wenn neuer - Dateien downloaden
| 1.335938 | 1 |
Entradas/views.py | ToniIvars/Blog | 0 | 21633 | <filename>Entradas/views.py<gh_stars>0
from django.shortcuts import render, redirect
from django.core.mail import send_mail
from django.contrib import messages
from django.core.exceptions import ObjectDoesNotExist
from django.contrib.auth.models import User
from django.contrib.auth import authenticate, login, logout
fr... | 2.09375 | 2 |
setup.py | remiolsen/anglerfish | 0 | 21634 | #!/usr/bin/env python
from setuptools import setup, find_packages
import sys, os
setup(
name='anglerfish',
version='0.4.1',
description='Anglerfish, a tool to demultiplex Illumina libraries from ONT data',
author='<NAME>',
author_email='<EMAIL>',
url='https://github.com/remiolsen/anglerfish',
... | 1.023438 | 1 |
files/urls.py | danielchriscarter/part2-django | 0 | 21635 | <filename>files/urls.py
from django.urls import path
from . import views
app_name = 'files'
urlpatterns = [
path('', views.index, name='index'),
path('file/<int:file_id>/', views.fileview, name='file'),
path('file/<int:file_id>/edit', views.fileedit, name='fileedit'),
path('dir/<int:di... | 2.21875 | 2 |
morpheus/algorithms/kmeans.py | amirsh/MorpheusPy | 12 | 21636 | # Copyright 2018 <NAME> and <NAME>
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, ... | 2.140625 | 2 |
670/main.py | pauvrepetit/leetcode | 0 | 21637 | <gh_stars>0
# 670. 最大交换
#
# 20200905
# huao
class Solution:
def maximumSwap(self, num: int) -> int:
return int(self.maximumSwapStr(str(num)))
def maximumSwapStr(self, num: str) -> str:
s = list(num)
if len(s) == 1:
return num
maxNum = '0'
maxLoc = 0
... | 3 | 3 |
tests/resources/test_codegen/template.py | come2ry/atcoder-tools | 313 | 21638 | <reponame>come2ry/atcoder-tools<filename>tests/resources/test_codegen/template.py
#!/usr/bin/env python3
import sys
def solve(${formal_arguments}):
return
def main():
def iterate_tokens():
for line in sys.stdin:
for word in line.split():
yield word
tokens = iterate_to... | 2.78125 | 3 |
orghtml.py | waynezhang/orgextended | 0 | 21639 | <reponame>waynezhang/orgextended
import sublime
import sublime_plugin
import datetime
import re
import regex
from pathlib import Path
import os
import fnmatch
import OrgExtended.orgparse.node as node
from OrgExtended.orgparse.sublimenode import *
import OrgExtended.orgutil.util as util
import OrgExtended.orgutil.nav... | 1.695313 | 2 |
qso_toolbox/LBT_MODS_script.py | jtschindler/qso_toolbox | 0 | 21640 | <filename>qso_toolbox/LBT_MODS_script.py
import os
import pandas as pd
from qso_toolbox import utils as ut
from qso_toolbox import catalog_tools as ct
targets = pd.read_csv('/Users/schindler/Observations/LBT/MODS/190607-190615/lukas_efficiency_candidates.csv')
offsets = pd.read_csv('')
# query = 'rMeanPSFMag - rMean... | 2.234375 | 2 |
EASTAR/main/migrations/0008_auto_20191005_0012.py | DightMerc/EASTAR | 1 | 21641 | <filename>EASTAR/main/migrations/0008_auto_20191005_0012.py
# Generated by Django 2.2.6 on 2019-10-04 19:12
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('main', '0007_auto_20191005_0011'),
]
operations = [
migrations.AddField(
... | 1.578125 | 2 |
archived-stock-trading-bot-v1/utils/alerts.py | Allcallofduty10/stock-trading-bot | 101 | 21642 | import os
from sys import platform
def say_beep(n: int):
for i in range(0, n):
if platform == "darwin":
os.system("say beep")
| 3.359375 | 3 |
tests/test_company_apis.py | elaoshi/my_planet_flask_api_backend_with_mongo | 0 | 21643 | <reponame>elaoshi/my_planet_flask_api_backend_with_mongo
from starlette.testclient import TestClient
import pytest,os
# from server.app import app
import json
import requests
from faker import Faker
fake = Faker()
# The root url of the flask app
url = 'http://127.0.0.1:5000/employee'
@pytest.mark.skip(reason="long... | 2.515625 | 3 |
doc2json/grobid2json/grobid/grobid_client.py | josephcc/s2orc-doc2json | 0 | 21644 | <reponame>josephcc/s2orc-doc2json<filename>doc2json/grobid2json/grobid/grobid_client.py
import os
import io
import json
import argparse
import time
import glob
from doc2json.grobid2json.grobid.client import ApiClient
import ntpath
from typing import List
'''
This version uses the standard ProcessPoolExecutor for paral... | 2.5625 | 3 |
hm_gerber_ex/rs274x.py | halfmarble/halfmarble-panelizer | 0 | 21645 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2022 HalfMarble LLC
# Copyright 2019 <NAME> <<EMAIL>>
from hm_gerber_tool.cam import FileSettings
import hm_gerber_tool.rs274x
from hm_gerber_tool.gerber_statements import *
from hm_gerber_ex.gerber_statements import AMParamStmt, AMParamStmtEx, ADParamStmtEx
f... | 2.171875 | 2 |
salamander/mktcalendar.py | cclauss/statarb | 51 | 21646 | <reponame>cclauss/statarb<gh_stars>10-100
from pandas.tseries.holiday import AbstractHolidayCalendar, Holiday, nearest_workday, \
USMartinLutherKingJr, USPresidentsDay, GoodFriday, USMemorialDay, \
USLaborDay, USThanksgivingDay
from pandas.tseries.offsets import CustomBusinessDay
class USTradingCalendar... | 1.679688 | 2 |
wall/views.py | pydanny/pinax-wall | 1 | 21647 | """ Sample view for group aware projects """
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from django.contrib.auth.decorators import login_required
from django.http import Http404, HttpResponseRedirect
from django.shortcuts import render_to_response, get_object_or_404
from dja... | 2.28125 | 2 |
cdc/src/NoteDeid.py | ZebinKang/cdc | 0 | 21648 | #!/usr/bin/python
# -*- coding: utf-8 -*-
'''
The MIT License (MIT)
Copyright (c) 2016 <NAME>
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 th... | 2.078125 | 2 |
turbo_transformers/python/tests/qbert_layer_test.py | xcnick/TurboTransformers | 1 | 21649 | <reponame>xcnick/TurboTransformers<filename>turbo_transformers/python/tests/qbert_layer_test.py
# Copyright (C) 2020 THL A29 Limited, a Tencent company.
# All rights reserved.
# Licensed under the BSD 3-Clause License (the "License"); you may
# not use this file except in compliance with the License. You may
# obtain a... | 2.078125 | 2 |
datasets/__init__.py | cogito233/text-autoaugment | 1 | 21650 | <reponame>cogito233/text-autoaugment
from .imdb import IMDB
from .sst5 import SST5
from .sst2 import SST2
from .trec import TREC
from .yelp2 import YELP2
from .yelp5 import YELP5
__all__ = ('IMDB', 'SST2', 'SST5', 'TREC', 'YELP2', 'YELP5')
def get_dataset(dataset_name, examples, tokenizer, text_transform=None):
... | 2.171875 | 2 |
src/pypleasant/artifacts.py | weibell/pypleasant | 3 | 21651 | <gh_stars>1-10
import base64
import pathlib
from collections import UserDict
from pypleasant.api import PleasantAPI
class Attachment:
def __init__(self, attachment_as_json: dict, api: PleasantAPI):
self.api = api
self._entry_id = attachment_as_json["CredentialObjectId"]
self._attachment_i... | 2.53125 | 3 |
npc/gui/util.py | Arent128/npc | 0 | 21652 | # Helpers common to the gui
from contextlib import contextmanager
from PyQt5 import QtWidgets
@contextmanager
def safe_command(command):
"""
Helper to suppress AttributeErrors from commands
Args:
command (callable): The command to run. Any AttributeError raised by
the command will be ... | 2.734375 | 3 |
meterbus/wtelegram_header.py | noda/pyMeterBus | 44 | 21653 | import simplejson as json
from .telegram_field import TelegramField
class WTelegramHeader(object):
def __init__(self):
# self._startField = TelegramField()
self._lField = TelegramField()
self._cField = TelegramField()
# self._crcField = TelegramField()
# self._stopField = T... | 2.65625 | 3 |
clitt/actions.py | Leviosar/tt | 0 | 21654 | <reponame>Leviosar/tt
import tweepy
from .interface import show_message, show_tweet, show_user
def dm(api: tweepy.API, target: str, content: str):
"""
Sends a direct message to target user
Keyword arguments:
api -- API instance for handling the request
target -- Target user's scr... | 3.0625 | 3 |
test/test_html.py | dominickpastore/pymd4c | 7 | 21655 | # Based on spec_tests.py from
# https://github.com/commonmark/commonmark-spec/blob/master/test/spec_tests.py
# and
# https://github.com/github/cmark-gfm/blob/master/test/spec_tests.py
import sys
import os
import os.path
import re
import md4c
import md4c.domparser
import pytest
from normalize import normalize_html
ex... | 2.1875 | 2 |
codes/fetch.py | Pregaine/debian | 0 | 21656 | <gh_stars>0
# -*- coding: utf-8 -*-
#
# Usage: Download all stock code info from TWSE
#
# TWSE equities = 上市證券
# TPEx equities = 上櫃證券
#
import csv
from collections import namedtuple
import requests
from lxml import etree
TWSE_EQUITIES_URL = 'http://isin.twse.com.tw/isin/C_public.jsp?strMode=2'
TPEX_EQUITIES_URL = 'ht... | 2.90625 | 3 |
SimplePyGA/FitnessCalc/__init__.py | UglySoftware/SimplePyGA | 1 | 21657 | <filename>SimplePyGA/FitnessCalc/__init__.py
#-----------------------------------------------------------------------
#
# __init__.py (FitnessCalc)
#
# FitnessCalc package init module
#
# Copyright and Distribution
#
# Part of SimplePyGA: Simple Genetic Algorithms in Python
# Copyright (c) 2016 <NAME> (<EMAIL>)
#... | 1.507813 | 2 |
pyaz/billing/invoice/section/__init__.py | py-az-cli/py-az-cli | 0 | 21658 | <filename>pyaz/billing/invoice/section/__init__.py
'''
billing invoice section
'''
from .... pyaz_utils import _call_az
def list(account_name, profile_name):
'''
List the invoice sections that a user has access to. The operation is supported only for billing accounts with agreement type Microsoft Customer Agre... | 2.453125 | 2 |
fifth.py | leephoter/coding-exam | 0 | 21659 | <filename>fifth.py<gh_stars>0
# abba
# foo bar bar foo
text1 = list(input())
text2 = input().split()
# text1 = set(text1)
print(text1)
print(text2)
for i in range(len(text1)):
if text1[i] == "a":
text1[i] = 1
else:
text1[i] = 0
for i in range(len(text2)):
if text2[i] == "foo":
tex... | 3.296875 | 3 |
login_checks.py | mhhoban/basic-blog | 0 | 21660 | """
Methods for user login
"""
from cgi import escape
from google.appengine.ext import ndb
def login_fields_complete(post_data):
"""
validates that both login fields were filled in
:param post_data:
:return:
"""
try:
user_id = escape(post_data['user_id'], quote=True)
except KeyErr... | 2.8125 | 3 |
models/lstm_hands_enc_dec.py | amjltc295/hand_track_classification | 6 | 21661 | # -*- coding: utf-8 -*-
"""
Created on Fri Nov 16 13:20:51 2018
lstm encoder decoder for hands
@author: Γιώργος
"""
import torch
import torch.nn as nn
from utils.file_utils import print_and_save
class LSTM_Hands_encdec(nn.Module):
# source: https://github.com/yunjey/pytorch-tutorial/blob/master/tutorials/02-in... | 2.671875 | 3 |
My_Simple_Chatroom/MyChat_C1.py | WilliamWuLH/Network_Basic_Programming | 1 | 21662 | <gh_stars>1-10
import socket
import sys
import os
ip_port = ('127.0.0.1',6666)
sk = socket.socket()
sk.bind(ip_port)
sk.listen(5)
def FTP_send(conn):
path = input('Path:')
file_name = os.path.basename(path)
file_size=os.stat(path).st_size
Informf=(file_name+'|'+str(file_size))
conn.send(Informf.e... | 3.109375 | 3 |
2020/day14-1.py | alvaropp/AdventOfCode2017 | 0 | 21663 | import re
with open("day14.txt", "r") as f:
data = f.read().splitlines()
def apply_mask(mask, value):
binary_value = f"{value:>036b}"
masked_value = "".join(
value if mask_value == "X" else mask_value
for value, mask_value in zip(binary_value, mask)
)
return int(masked_value, 2)
... | 3.125 | 3 |
heppy/modules/host.py | bladeroot/heppy | 0 | 21664 | from ..Module import Module
from ..TagData import TagData
class host(Module):
opmap = {
'infData': 'descend',
'chkData': 'descend',
'creData': 'descend',
'roid': 'set',
'name': 'set',
'clID': 'set',
'crID': 'set... | 2.3125 | 2 |
setup.py | ANich/patois-stopwords | 0 | 21665 | <filename>setup.py<gh_stars>0
from setuptools import setup, find_packages
setup(
name='patois-stop-words',
version='0.0.1',
description='A list of patois stop words.',
long_description=open('README.md').read(),
license='MIT',
author='<NAME>',
author_email='<EMAIL>',
url='https://github.... | 1.304688 | 1 |
ls/joyous/tests/test_manythings.py | tjwalch/ls.joyous | 72 | 21666 | # ------------------------------------------------------------------------------
# Test Many Things Utilities
# ------------------------------------------------------------------------------
import sys
import datetime as dt
import pytz
from django.test import TestCase
from django.utils import translation
from ls.joyous... | 2.734375 | 3 |
sgqlc/__init__.py | pberthonneau/sgqlc | 0 | 21667 | __version__ = '10.0'
| 1.070313 | 1 |
brew/migrations/0007_auto_20180307_1842.py | williamlagos/brauerei | 0 | 21668 | <reponame>williamlagos/brauerei
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2018-03-07 18:42
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
... | 1.5 | 2 |
src/box/importer.py | p-ranav/box | 91 | 21669 | from box.parser import Parser
from box.generator import Generator
import os
class Importer:
def __init__(self, path):
# Path to directory containing function graphs to import
self.path = os.path.abspath(path)
# { "FunctionName": <Generator>, ... }
self.function_declarations = {}
... | 2.71875 | 3 |
gargantua/utils/elasticsearch.py | Laisky/laisky-blog | 18 | 21670 | <gh_stars>10-100
import json
def parse_search_resp(resp):
return [i['_source'] for i in json.loads(resp)['hits']['hits']]
def generate_keyword_search(keyword, field='post_content'):
query = {
"query": {
"match": {
field: keyword
}
}
}
return js... | 2.734375 | 3 |
HackerRank/Python_Learn/03_Strings/13_The_Minion_Game.py | Zubieta/CPP | 8 | 21671 | <gh_stars>1-10
# https://www.hackerrank.com/challenges/the-minion-game
from collections import Counter
def minion_game(string):
# your code goes here
string = string.lower()
consonants = set("bcdfghjklmnpqrstvwxyz")
vowels = set("aeiou")
# Stuart will get 1 point for every non-distinct substring tha... | 3.75 | 4 |
Data/girisbolum.py | kemalsanli/wordKontrol | 1 | 21672 | import os
from docx import Document
from docx.shared import Inches
from docx import Document
from docx.text.paragraph import Paragraph
def Iceriyomu(dosyayol):
document = Document('{}'.format(dosyayol))
headings = []
texts = []
para = []
giris = ""
for paragraph in document.paragraphs... | 2.953125 | 3 |
src/damn_at/analyzers/mesh/analyzer_assimp.py | sagar-kohli/peragro-at | 5 | 21673 | """Assimp-based analyzer."""
from __future__ import absolute_import
import os
import logging
import subprocess
import pyassimp
from damn_at import (
mimetypes,
MetaDataType,
MetaDataValue,
FileId,
FileDescription,
AssetDescription,
AssetId
)
from damn_at.pluginmanager import IAnalyzer
from... | 2.234375 | 2 |
src/stk/ea/selection/selectors/remove_batches.py | stevenbennett96/stk | 21 | 21674 | <gh_stars>10-100
"""
Remove Batches
==============
"""
from .selector import Selector
class RemoveBatches(Selector):
"""
Prevents a :class:`.Selector` from selecting some batches.
Examples
--------
*Removing Batches From Selection*
You want to use :class:`.Roulette` selection on all but th... | 2.90625 | 3 |
students/migrations/0010_institutionalemail_title_email.py | estudeplus/perfil | 0 | 21675 | # Generated by Django 2.2.1 on 2019-06-30 00:31
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('students', '0009_auto_20190629_0125'),
]
operations = [
migrations.AddField(
model_name='institutionalemail',
name='... | 1.726563 | 2 |
azure_utility_tool/config.py | alextricity25/azure_utility_tool | 5 | 21676 | """
Author: <NAME>
Email: <EMAIL>
Date: 12/21/2019
Description:
Loads Azure Utility Tool configuration file. The configuration
file is a blend of what the Microsoft Authentication Library
requires and some extra directives that the Auzre Utility
Tool requires. It is a JSON file that is required to be
... | 2.625 | 3 |
ics/structures/secu_avb_settings.py | intrepidcs/python_ics | 45 | 21677 | # This file was auto generated; Do not modify, if you value your sanity!
import ctypes
import enum
from ics.structures.can_settings import *
from ics.structures.canfd_settings import *
from ics.structures.s_text_api_settings import *
class flags(ctypes.Structure):
_pack_ = 2
_fields_ = [
('disableUsb... | 1.898438 | 2 |
unaccepted/Substring_with_Concatenation_of_All_Words.py | sheagk/leetcode_solutions | 0 | 21678 | <reponame>sheagk/leetcode_solutions
## https://leetcode.com/problems/substring-with-concatenation-of-all-words/submissions/
## this method fails on test case 171 of 173 because it's too slow.
## i'm not sure I see a way to avoid checking every starting position
## in s, and I'm also not sure I see a way to avoid havin... | 3.53125 | 4 |
python_app/supervised_learning/train_data/Data.py | 0xsuu/Project-Mahjong | 9 | 21679 | #!/usr/bin/env python3
'''
The MIT License (MIT)
Copyright (c) 2014 <NAME>
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 limi... | 1.882813 | 2 |
tests/_geom/test_path_control_x_interface.py | ynsnf/apysc | 16 | 21680 | <reponame>ynsnf/apysc
from random import randint
from retrying import retry
import apysc as ap
from apysc._geom.path_control_x_interface import PathControlXInterface
class TestPathControlXInterface:
@retry(stop_max_attempt_number=15, wait_fixed=randint(10, 3000))
def test_control_x(self) -> None... | 2.375 | 2 |
test/PySrc/tools/collect_tutorials.py | lifubang/live-py-plugin | 224 | 21681 | import json
from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter, FileType
from pathlib import Path
def main():
parser = ArgumentParser(description='Collect markdown files, and write JSON.',
formatter_class=ArgumentDefaultsHelpFormatter)
project_path = Path(__file__).... | 2.96875 | 3 |
autobiography.py | wcmckee/wcmckee | 0 | 21682 | <gh_stars>0
# -*- coding: utf-8 -*-
# <nbformat>3.0</nbformat>
# <markdowncell>
# My name is <NAME> and this is my autobiography. Written in November 2014.
#
# Structure:
#
# <markdowncell>
# Hello and goodNIĢ
# testing one two there.
# <markdowncell>
# Hello. Testing one two three.
# Screw you guys. I'm going... | 2.171875 | 2 |
tests/configured_tests.py | maxcountryman/flask-security | 0 | 21683 | # -*- coding: utf-8 -*-
from __future__ import with_statement
import base64
import time
import simplejson as json
from flask.ext.security.utils import capture_registrations, \
capture_reset_password_requests, capture_passwordless_login_requests
from flask.ext.security.forms import LoginForm, ConfirmRegisterForm,... | 2.234375 | 2 |
Server/programs/__init__.py | VHirtz/CC-mastermind | 0 | 21684 | from . import program
from . import turtle_test
from . import antoine_test
from . import dance | 1.171875 | 1 |
src/robotkernel/utils.py | robocorp/robocode-kernel | 4 | 21685 | <filename>src/robotkernel/utils.py
# -*- coding: utf-8 -*-
from copy import deepcopy
from difflib import SequenceMatcher
from IPython.core.display import Image
from IPython.core.display import JSON
from json import JSONDecodeError
from lunr.builder import Builder
from lunr.stemmer import stemmer
from lunr.stop_word_fil... | 2.484375 | 2 |
Pyduino/__init__.py | ItzTheDodo/Pyduino | 0 | 21686 | <gh_stars>0
# Function Credits: https://github.com/lekum/pyduino/blob/master/pyduino/pyduino.py (lekum (as of 2014))
# Written By: ItzTheDodo
from Pyduino.Boards.Uno import UnoInfo
from Pyduino.Boards.Mega import MegaInfo
from Pyduino.Boards.Diecimila import DiecimilaInfo
from Pyduino.Boards.Due import DueInfo
... | 2.78125 | 3 |
apps/api/v1/social_auth.py | asmuratbek/oobamarket | 0 | 21687 | from allauth.socialaccount.helpers import complete_social_login
from allauth.socialaccount.models import SocialApp, SocialToken, SocialLogin, SocialAccount
from allauth.socialaccount.providers.facebook.views import fb_complete_login
from allauth.socialaccount.providers.google.views import GoogleOAuth2Adapter
from djang... | 2.046875 | 2 |
Global and Local Inversions/Solution.py | chandrikadeb7/Awesome-LeetCode-Python | 2 | 21688 | class Solution:
def isIdealPermutation(self, A: List[int]) -> bool:
n = len(A)
g = local = 0
for i in range(1, n):
if A[i] < A[i-1]:
local += 1
if A[i] < i:
diff = i - A[i]
... | 2.875 | 3 |
queryable_properties/properties/common.py | W1ldPo1nter/django-queryable-properties | 36 | 21689 | <filename>queryable_properties/properties/common.py
# encoding: utf-8
import operator
import six
from django.db.models import BooleanField, Field, Q
from ..utils.internal import MISSING_OBJECT, ModelAttributeGetter, QueryPath
from .base import QueryableProperty
from .mixins import AnnotationGetterMixin, AnnotationMi... | 2.1875 | 2 |
experiments/examples/example_run_bench_s1_periodic_bench.py | cogsys-tuebingen/uninas | 18 | 21690 | """
training a super-network and periodically evaluating its performance on bench architectures
a work in this direction exists: https://arxiv.org/abs/2001.01431
"""
from uninas.main import Main
# default configurations, for the search process and the network design
# config_files = "{path_conf_bench_tasks}/s1_fairna... | 2.4375 | 2 |
zuds/photometry.py | charlotteaward/zuds-pipeline | 0 | 21691 | import numpy as np
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql as psql
from sqlalchemy.orm import relationship
from sqlalchemy.ext.hybrid import hybrid_property
from sqlalchemy.schema import UniqueConstraint
from astropy import units as u
from .core import Base
from .constants import APER_KEY, A... | 1.914063 | 2 |
animazya/apps.py | KenFon/kenfontaine.fr | 0 | 21692 | from django.apps import AppConfig
class AnimazyaConfig(AppConfig):
name = 'animazya'
| 1.101563 | 1 |
python/testData/debug/test4.py | jnthn/intellij-community | 2 | 21693 | <filename>python/testData/debug/test4.py
xval = 0
xvalue1 = 1
xvalue2 = 2
print(xvalue1 + xvalue2)
| 1.828125 | 2 |
pres/ray-tracing/main.py | sosterwalder/mte7103-qde | 0 | 21694 | <reponame>sosterwalder/mte7103-qde<gh_stars>0
from kivy.animation import Animation
from kivy.app import App
from kivy.core.window import Window
from kivy.graphics import Color
from kivy.graphics import Ellipse
from kivy.graphics import Line
from kivy.uix.widget import Widget
class ProjCenter(Widget):
def __init__... | 2.59375 | 3 |
sookie.py | anygard/sookie | 0 | 21695 |
""" Sookie, is a waiter, waits for a socket to be listening then it moves on
Usage:
sookie <socket> [--timeout=<to>] [--retry=<rt>] [--logsocket=<ls>] [--logfacility=<lf>] [--loglevel=<ll>]
sookie -h | --help
sookie --version
Options:
-h --help Show this screen
--version ... | 2.828125 | 3 |
tests/parser/syntax/test_ann_assign.py | williamremor/vyper | 1 | 21696 | <filename>tests/parser/syntax/test_ann_assign.py
import pytest
from pytest import raises
from vyper import compiler
from vyper.exceptions import VariableDeclarationException, TypeMismatchException
fail_list = [
"""
@public
def test():
a = 1
""",
"""
@public
def test():
a = 33.33
""",
"""
... | 2.78125 | 3 |
tests/test_mongoengine_dsl.py | StoneMoe/mongoengine_dsl | 3 | 21697 | <filename>tests/test_mongoengine_dsl.py
#!/usr/bin/env python
import unittest
from mongoengine import Document, Q, StringField, connect
from mongoengine_dsl import Query
from mongoengine_dsl.errors import InvalidSyntaxError, TransformHookError
from tests.utils import ts2dt
class DSLTest(unittest.TestCase):
def t... | 2.8125 | 3 |
dmidecode/__init__.py | hamgom95/dmidecode | 0 | 21698 | import subprocess
from collections import UserDict
from functools import lru_cache
def _parse_handle_section(lines):
"""
Parse a section of dmidecode output
* 1st line contains address, type and size
* 2nd line is title
* line started with one tab is one option and its value
* line started with... | 2.75 | 3 |
{{cookiecutter.repo_name}}/webapp/config/settings/cache.py | bopo/django-template | 0 | 21699 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
try:
from .base import MIDDLEWARE_CLASSES
except ImportError as e:
raise e
# MIDDLEWARE_CLASSES += (
# 'django.middleware.cache.CacheMiddleware',
# 'django.middleware.cache.UpdateCacheMiddleware',
# 'django.middleware.cache.FetchFrom... | 1.789063 | 2 |