blob_id stringlengths 40 40 | content_id stringlengths 40 40 | repo_name stringlengths 5 114 | path stringlengths 5 318 | language stringclasses 5
values | extension stringclasses 12
values | length_bytes int64 200 200k | license_type stringclasses 2
values | content stringlengths 143 200k |
|---|---|---|---|---|---|---|---|---|
f1abbc4b586e208d0e60dd7e262971c4b55bcb7b | eb33ddf15cf18eab907c5541d9f998e066b659cb | jowlyzhang/learn_python_the_experimental_way | /magic/py_callable.py | Python | py | 3,881 | no_license | #!/usr/bin/python
"""The module experiments objects in python that are callable.
This includes but not limited to:
1. Class is callable, calling them usually cause a new instance of
that class to be initiated, but that behavior can be customized by
overriding the __new__ method of the function
2. Class ... |
612c65d949eac0de409689adeea2594160110f61 | 2e723ce474de8a6d04d4def15558733d5cdf8688 | fighting666/Python | /【5】Code_example/Xici_ip_ask.py | Python | py | 1,754 | no_license | #!./usr/bin/env.python
# -*- coding:utf-8 -*-
import urllib2
import os
import re
import pymysql
conn = pymysql.connect(
host='127.0.0.1',
port=3306,
user='root',
passwd='123456',
db='csn_db'
)
cur = conn.cursor()
def dowload_ip(url):
for page_num in range(1, 50):
ask_url = url + str(p... |
7d7cbf29884eae8b7ad1b69ce25022d52d65c6ce | 573ce833dc4bdcbb6b89cc31633d00a1c913854d | hayderimran7/stepler | /stepler/cli_clients/steps/glance.py | Python | py | 7,310 | no_license | """
-----------------------
Glance CLI client steps
-----------------------
"""
# 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 req... |
ebc046a3b57366bc310436a2cc2e89ab6953c20a | c4b718d0228f28af9c9ef2e359cd6438692694e4 | diegofalconc/Final-Project | /todo/migrations/0004_auto_20210318_1308.py | Python | py | 543 | no_license | # Generated by Django 3.1.7 on 2021-03-18 19:08
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('todo', '0003_auto_20210318_1304'),
]
operations = [
migrations.AlterField(
model_name='task',
name='taskpriority',
... |
dfe93f0bb0362050994c9f195987986a25b793e6 | f0b291a036b5bcd9fe1e858b5e4c13e99dc45722 | MrKolbaskin/boston_gene | /python_flask_api/python_SQL/test.py | Python | py | 713 | no_license | import sqlite3
connection = sqlite3.connect('data.db')
cursor = connection.cursor()
#Создание таблицы
create_table = 'CREATE TABLE users (id int, username text, password text)'
cursor.execute(create_table)
#Добавление строки в таблицу
user = (1, 'jose', 'asdf')
insert_query = 'INSERT INTO users VALUES (?, ?, ?)'
cu... |
d90ef74bebbfb3fec2ca2956aa05fda20cf7d39e | b4e91122c2f5a7dca7b8bdabcdfc7063096dab46 | cjlauer/hadstruct-progs | /Stampede/cA211.30.32/mkinput.py | Python | py | 4,461 | no_license | import xml.etree.ElementTree as ET
from xml.dom import minidom
import sys
import re
L = 32
T = 64
procs = 8,4,4,4
mu = 0.003
mu_l = 0.003
mu_s = 0.022
csw = 1.74
kappa = 0.1400645
n_ape = 50
alpha_ape = 0.5
n_gauss = 90
alpha_gauss = 0.2
n_gauss_l = 50
alpha_gauss_l = 0.2
n_gauss_s = 40
alpha_gauss_s = 0.2
multigri... |
88848a29e204abc9b1b47fdcb21fe5be785a7373 | 53990f70773b1b2686b1419c34325dff1ff9db75 | rillis/ProjectEuler | /0-100/035.py | Python | py | 1,171 | no_license |
# Time to achieve the answer: 0.0451414s
# Notes: Running in PyPy3
#
# ProjectEuler
# Copyright (c) ProjectEuler - rillis. All rights reserved.
#
# https://github.com/rillis/ProjectEuler
#
import math
import os
import random
import re
import sys
import itertools
import timeit
def sieveEratos(limit):
a = [True] ... |
6be8b1a1113a12ff7b335acb6f61c68bf07ab259 | d5169b8bb1dc2d808a92d1b8eb3b57b2d01c860c | nakhodnov17/Samsung-Tasks | /Stein Gradients/Experiments/Configs/config_ml_est.py | Python | py | 2,200 | no_license | """
Params:
use_cuda (bool)
cuda_device_id (int): id of selected gpu
dataset (str): name of dataset to train
Default: 'MNIST'
batch_size (int)
Default: 100
net_arc (str): description of network
'fc-18-14' | 'fc-300-100'
Default: 'fc-18-14'
use_var_prior (bool): if... |
c062e0e8ddff8909c9597c73070abfe84d8ef57b | 9487bccf1f25033d1a5b39eb5f912d540cc46435 | fd-davari/chat-application | /server.py | Python | py | 1,089 | no_license | import socket
import threading
host = '127.0.0.1'
port = 55555
server = socket.socket(socket.AF_INET , socket.SOCK_STREAM)
server.bind((host , port))
server.listen()
clients = []
nicknames = []
def broadcast(message):
for client in clients:
client.send(message)
def handle(client):
while True:
try:
message... |
424567f1a755911eee92bf9a1ccf1d35aa0fd18b | 0e6b3d0ddb8078dc711482a6c4d60bf4ae36569f | al-yakubovich/bokeh | /bokeh/io/tests/test_state.py | Python | py | 4,501 | permissive | #-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2018, Anaconda, Inc. All rights reserved.
#
# Powered by the Bokeh Development Team.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#---------------------------------------------------... |
56ff556ddab19231e9031f6390bb89a7b72b35b4 | 18708a5c49d400fd9f8107999b16b98e215eb284 | Yulia-Yakovleva/BI_2019_Python | /PyTrimm/trimmomatic_clone.py | Python | py | 9,328 | no_license | import argparse
import os.path
def write_record(out_file, rec):
with open(out_file, 'a') as out_f:
out_f.write(rec[0] + '\n')
out_f.write(rec[1] + '\n')
out_f.write('+' + '\n')
out_f.write(rec[2] + '\n')
def partition_by_length(sequence, n):
if n is None:
return True
... |
c2d906facd85e16e8766c2515551e044b6a294b5 | 66eff764224e4c6ece365daa40a3b0fc0973bb54 | Kobie-Kirven/yeastGlucoseTransporters | /structuralAnalysis/structure_builder/PeptideBuilder.py | Python | py | 47,211 | no_license | """This module is part of the PeptideBuilder library,
written by Matthew Z. Tien, Dariya K. Sydykova,
Austin G. Meyer, and Claus O. Wilke.
The PeptideBuilder module contains code to generate 3D
structures of peptides. It requires the Geometry module
(also part of the PeptideBuilder library), which contains
default bond... |
c2c407b3e46366bebff772ca143b226b8af25c23 | a0f677b5de63baed7852706c7f6266d81e04c813 | DanielBergshoeff/csgobetting | /Mess/HTMLscrapingMatch.py | Python | py | 5,379 | no_license | import sys
sys.path.append('/usr/local/lib/python2.7/site-packages')
import numpy as np
from datetime import date
from lxml import html
import requests
vetoFile = 'matches_vetoProces.txt'
# import existing teamnames
with open('teamIDs.txt', "r") as text_file:
teamIDs = text_file.readline().split()
# import ... |
bbf24e2b9b612781f7ca15b147fee522e1b3469f | b1e6603544741d5cd7cbfa0d891b602abf10e76d | mperlmutter/geomstats | /examples/quantization_s1.py | Python | py | 911 | permissive | """
Plot the result of optimal quantization of the uniform distribution
on the circle.
"""
import matplotlib.pyplot as plt
import geomstats.visualization as visualization
from geomstats.hypersphere import Hypersphere
CIRCLE = Hypersphere(dimension=1)
METRIC = CIRCLE.metric
N_POINTS = 1000
N_CENTERS = 5
N_REPETITION... |
f167721ae98721cfb8481c64219142bf270555bc | 7ca7c59038409fc3cc671651c3515161706eee2e | dbinetti/kidsallin | /conftest.py | Python | py | 920 | permissive | # Django
# First-Party
import pytest
from app.factories import UserFactory
from django.test.client import Client
@pytest.fixture
def anon_client():
client = Client()
return client
@pytest.fixture
def user():
user = UserFactory(
username='user',
name='User',
email='user@localhost'... |
7a63a2fbaf64940863836fca48f7515706c2dbcf | 41fa80b99789699a78c16a49540caeaba10794f0 | openvinotoolkit/training_extensions | /src/otx/algorithms/detection/adapters/mmdet/nncf/builder.py | Python | py | 9,804 | permissive | """NNCF wrapped mmdet models builder."""
# Copyright (C) 2022 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
from functools import partial
from typing import Optional, Union
import torch
from mmcv.parallel import DataContainer
from mmcv.runner import CheckpointLoader
from mmcv.utils import Config, ConfigDi... |
bfe93b85501940d1a3525795960027346cac0992 | d98529fe1855e1ae9a30f5d65bb0e2be10e771bc | alexanderbart/PHGN498A_bart_alexander | /project2.py | Python | py | 9,777 | no_license | import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import math
import random as rand
import time as t
from mpl_toolkits.mplot3d import Axes3D
import mpl_toolkits.mplot3d.axes3d as p3
import scipy.integrate as scint
steps = 1000
finalt = 10
N = 5
m = 1
b = 0.1 #damping
g = 10 # ... |
eb9690fe135a28926088ac14e03a56e796fe9025 | 73e6cc89a05c395d13e9c8968aa941c82146062f | ceyhunsahin/TRAINING | /EXAMPLES/EDABIT/EXPERT/001_100/73_the_ECG_sequence.py | Python | py | 2,035 | no_license | """
https://edabit.com/challenge/9Px2rkc9TPhK54wDb
The ECG Sequence
In the ECG Sequence (that always starts with the numbers 1 and 2), every number that succeeds is the smallest not already present in the sequence and that shares a factor (excluding 1) with its preceding number. Every number in the ECG Sequence (beside... |
60dba6e91d14ac5b6247db4cb3bddf2f0852bcbd | 799b868f5f35472564f1bdf7f8e0755cb12c089a | Rita-Ning/sc-turing | /stanCode-Project/name popularity searching system/babynames.py | Python | py | 4,665 | permissive | """
SC101 Baby Names Project
Adapted from Nick Parlante's Baby Names assignment by
Jerry Liao.
YOUR DESCRIPTION HERE
"""
import sys
def add_data_for_name(name_data, year, rank, name):
"""
Adds the given year and rank to the associated name in the name_data dict.
Input:
name_data (dict): dict ho... |
1d7d37053e3416d3333d74bc3e851c12a91f0d49 | d0d077a6a88ae19cf9ff4d644127f84738f75c92 | ElectronicCats/Adafruit_nRF52_nrfutil | /nordicsemi/version.py | Python | py | 1,649 | permissive | #!/usr/bin/env python
# Copyright (c) 2015, Nordic Semiconductor
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
... |
34be67052f453951d00dd9989399366299d39c85 | 09dd9cd4ae892324a6dd9c7715c2d59a8136fe71 | nett55/pants | /src/python/pants/goal/context.py | Python | py | 13,626 | permissive | # coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
import sys... |
26c96d9379816f8b83d44dd268af598d5dedbba1 | cd3c4b9a62e96c44ae7d3725892d4aaf72bdc5e6 | mKeRix/home-assistant | /homeassistant/components/rfxtrx/const.py | Python | py | 344 | permissive | """Constants for RFXtrx integration."""
COMMAND_ON_LIST = [
"On",
"Up",
"Stop",
"Open (inline relay)",
"Stop (inline relay)",
]
COMMAND_OFF_LIST = [
"Off",
"Down",
"Close (inline relay)",
]
ATTR_EVENT = "event"
SERVICE_SEND = "send"
DEVICE_PACKET_TYPE_LIGHTING4 = 0x13
EVENT_RFXTRX... |
011523c3dba9d3a94df35fb50a2d89173cac35f9 | 35bcec73f7538588512be6b88c9a57b0acae32b7 | oamg/leapp-repository | /repos/system_upgrade/common/actors/peseventsscanner/libraries/pes_event_parsing.py | Python | py | 12,969 | permissive | import json
import os
from collections import defaultdict, namedtuple
from enum import IntEnum
from itertools import chain
from leapp import reporting
from leapp.exceptions import StopActorExecution
from leapp.libraries.common import fetch
from leapp.libraries.common.config import architecture
from leapp.libraries.com... |
39e65fd30978b74b78ff41ae3283e09d3c8714f9 | 9856f75bfd7cdc2d624959c533354d43a016140f | 1615961606/haocao | /django_blog/blogs/models.py | Python | py | 2,836 | no_license | from django.db import models
from users.models import BlogUser
from datetime import datetime
class Banner(models.Model):
title = models.CharField(verbose_name='标题', max_length=50)
cover = models.ImageField(verbose_name='轮播图', upload_to='static/images/banner')
link_url = models.URLField(max_length=150, ver... |
814d5a6c8b8f1b8d5673c1b4c1f1090b5f047cd6 | ff898ec9204f91495a8e7ad4b372166f2bec285d | YukoEn/Python_MachineLearning | /KONE_Challenge/KoneModel.py | Python | py | 7,139 | no_license | # -*- coding: UTF-8 -*-
import pandas as pd
import numpy as np
import scipy.stats as stats
import matplotlib.pyplot as plt
import sklearn
from sklearn.metrics import mean_squared_error as mse
from sklearn.metrics import r2_score
from sklearn.linear_model import LinearRegression
from sklearn.linear_model import Ridge
... |
cd80a0b7582cf1caa458b1a64dfd62e52c69a714 | bc8ec98a605b7d4d12205537aa9a052f6e205a74 | CAgAG/Arithmetic_PY | /字符串/最长回文子串.py | Python | py | 1,434 | no_license | def find(arr, ele, start: int, end: int):
index = []
for i, v in enumerate(arr[start: end], start=start):
if v == ele:
index.append(i)
return index
def GetLong(arr: str):
if arr is None:
return
length = len(arr)
if length == 1:
return arr
elif length =... |
74dcdf96d5f68be27459fc99c48700b75df6de64 | a0cd5e7aa54fa8051dc5d8c0386d8a86f2882ef5 | MikhailMoor/SOBE_Project | /SOBE/register/views.py | Python | py | 6,047 | no_license | from django.shortcuts import render, redirect
from django.http import HttpResponseRedirect
from .forms import UserSignInForm, UserSignUpForm, UserKeycodeForm,ForgotPasswordForm, ChangePasswordForm
from django.contrib.auth.models import User
from django.contrib.auth import authenticate
from django.contrib.sessions.mode... |
aff28b39721b0235d22a4eb2649464a459691bf8 | da2790ebdc4f8d216cc63007a75e84c91bf05cf2 | Ctfbuster/caldera | /app/api/v2/handlers/operation_api.py | Python | py | 10,063 | permissive | import json
import aiohttp_apispec
from aiohttp import web
from app.api.v2.handlers.base_object_api import BaseObjectApi
from app.api.v2.managers.operation_api_manager import OperationApiManager
from app.api.v2.responses import JsonHttpNotFound
from app.api.v2.schemas.base_schemas import BaseGetAllQuerySchema, BaseGe... |
19ace978d1f9c13ef71522cc9354d4902e971515 | 3b3219a4ec15cc1c3bfa2b92edbb00f466f0fff7 | yrrodriguezb/online_shop | /src/apps/orders/migrations/0002_order_braintree_id.py | Python | py | 390 | permissive | # Generated by Django 3.1.7 on 2021-04-05 05:00
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('orders', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='order',
name='braintree_id',
... |
8f5b7df2b1a6249230e67b2a584cfe69e796ff78 | 11673957270e8cba3b18b7d2eb3868627348c842 | icmll/common-modules | /sendMailNews.py | Python | py | 10,144 | no_license | #!/usr/bin/python2
#-*- coding: utf-8 -*-
import os
import sys
import time
import logging
import email
from nntplib import NNTP
from smtplib import SMTP
from email.header import Header
from email.mime.text import MIMEText
from email.mime.multipart import MIMEBase
from email.mime.multipart import MIMEMultipart
#定义输出日志... |
8f2cf8b15f4ff91fdf3dec5f7139079d2cd9920d | 835b5d1115dc64943c370e4c5999cb42d727deea | Neryop12/pyDataPush | /exportjson.py | Python | py | 281 | no_license | import config.db as db
import dbconnect as sql
import sys
import re
import mysql.connector as mysql
from datetime import datetime, timedelta
import time
import configparser
import pandas as pd
import numpy as np
now = datetime.now()
CreateDate = now.strftime("%Y-%m-%d %H:%M:%S")
|
91f9ffd1b8de2348d4fe48ad4f940810e9720483 | 4fec6808bc099acc139e5b365f8a680c6def59f1 | a-zuckut/HandBasedPokerStatistics | /src/visualize.py | Python | py | 1,734 | no_license | # visualize.py
import os
import numpy as np
import seaborn as sb
import matplotlib.pyplot as plt
from hand import Hand
import log
logger = log.get_logger(__name__)
DIRECTORY = 'mydata'
def visualize(function, data):
if function.lower() == "profitperhand":
table = construct_order()
create_heatmap(... |
33678af500b55ee68be98ba4e9bf87e36928d2ad | 073f962531d55183b54a70b8d22505ba3aab37a3 | detcitty/100DaysOfCode | /python/unfinshed/adding_shifted_values.py | Python | py | 1,631 | no_license | # https://www.codewars.com/kata/57c7231c484cf9e6ac000090/train/python
'''
#Adding values of arrays in a shifted way
You have to write a method, that gets two parameter:
1. An array of arrays with int-numbers
2. The shifting value
#The method should add the values of the arrays to one new array.
The arrays in the ar... |
39e639fbfa1e1cdde612e17a88af3c67601ff2c2 | 0b24e7ee108cf64d680055b824928bb061fca191 | samahakk/revolut-case-study | /.history/hc_data/exercise2_20210719175916.py | Python | py | 419 | no_license | import sqlite3, csv
connection = sqlite3.connect('revoult')
cursor = connection.cursor()
tables = ['countries.csv', 'currency_details.csv','fraudsters.csv','fx_rates.csv', 'transactions.csv', 'users.csv']
with open('countries.csv', 'r'):
no_records = 0
for row in file:
cursor.execute("INSERT... |
88f1f270af5b0e54865e71b49dfec0bcac6fae16 | 1a97b6ef8771e057f3005fa2da9bca4fd897d6f3 | jsreynaud/EARS | /ears/config.py | Python | py | 971 | permissive | # -*- coding: utf-8 -*-
import librosa
AUDIO_DEVICE = 'default' # Recording device name as listed by `python -m sounddevice`
AUDIO_DURATION = 10 # Duration of audio material to retain, in seconds
SAMPLING_RATE = 44100 # Audio sampling rate, other parameters are hand-tuned for 44.1 kHz
CHUNK_SIZE = 882 # Spectr... |
b52a9276c74e7c57a22f6e1c54f2a172280e550d | cf99ec078806f703e4823d7a2626f4457f9f6d69 | yanlingz/SSNENAS | /tools_predictors/visualize/visualize_predictors_predictive_performance_comparison.py | Python | py | 4,989 | permissive | import matplotlib.pyplot as plt
import pickle
import numpy as np
import argparse
from collections import defaultdict
import os
import math
plt.rcParams["font.family"] = "Times New Roman"
marker_list = ['*', '^', '1', '+', 'x', 'v', '2', 'D', 'd', 'p', 'o', 's']
# k: black m: purple b: blue g: green r: red
color_list ... |
1c7eed5e7a56ec1727a070ac14c5729adebd2e66 | bfe5ffbdc4475095cb0090b09b328a1380d826ff | m-2k/elixir-tmbundle | /mix_format_file.py | Python | py | 578 | permissive | import sublime, sublime_plugin, subprocess
class MixFormatFileCommand(sublime_plugin.TextCommand):
def run(self, edit):
window = self.view.window()
window.run_command("save")
cmd = ["mix", "format", self.view.file_name()]
cwd = window.folders()[0]
returncode = subprocess.call(cmd, cwd=cwd)
... |
751cd961511e74d3b74c5ddda0378f4c408c1e81 | 4f3b3de3a2109bfec4f422f26058aae433671d28 | dTypePrototype/fifa2017analysis | /complete-fifa-2017-player-dataset-global/Solution/untitled1.py | Python | py | 645 | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Nov 11 20:56:53 2017
@author: Abhishek
"""
# Importing Library
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import ggplot
path = "C:/Users/Abhishek Sharma/Desktop/5th sem project/complete-fifa-2017-player-dataset-global/"
Ful... |
588f0ea72d9ef1e557143c0b82b7405d115c203f | c140fd8702d90b8cbb241912c8b340b0d5fa4762 | TLupinski/Number_Recognition | /disp_custom.py | Python | py | 9,433 | no_license | # -*- coding: utf-8 -*-
''' '''
import os
import itertools
import codecs
import re
import datetime
import numpy as np
import pylab
from pylab import *
import matplotlib
from keras import backend as K
from keras.layers.convolutional import Conv2D, MaxPooling2D
from keras.layers import Input, Dense, Activation, Dropout
f... |
24e76e8c5f8d09f24374067490cbfe4f2cbc32b8 | 2c1e5fc7c68507613dff3ab9b59fced575a5cdd0 | kk1124/home-work | /caike_homework/HomeWork_2.py | Python | py | 1,115 | no_license | # -*- coding: utf-8 -*-
import re
#验证手机号是否正确
#判断手机号的前三位,可以为13[0-9]、145、147、15[0-9]、166、173、176、177、18[0-9]
#用该正则表达式去匹配用户的输入来判断是否合法。
#创建匹配11位手机号的正则表达式
#match()方法判断是否匹配。
class Singleton(object):
def __new__(cls, *args, **kwargs):
if not hasattr(cls, '_instance'):
orig = super(Singleton,cls)
... |
137edab059c90b17ddc469584a298377cfb3dd66 | cbdfdb7ef4b55ea5c543953ae87e44c0d9df21d4 | Animadversio/lucent | /lucent/optvis/objectives.py | Python | py | 11,002 | permissive | # Copyright 2020 The Lucent 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 applicable ... |
9b2ecd91ac742b51aa77cb88d254d0eb89a672d7 | 67ea084899a6117eb1c37f923e9e1a4a59cf437d | ldoktor/avocado-virt-tests | /qemu/usb_boot.py | Python | py | 3,309 | no_license | #!/usr/bin/python
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it w... |
441cd321339ce6246ef793f831045f5c56bccab5 | 89bae726688a08d8ea8953d20b52b64220aaf3ba | jc01480/h8mail | /h8mail/utils/run.py | Python | py | 12,567 | permissive | # -*- coding: utf-8 -*-
# Most imports are after python2/3 check further down
import configparser
import argparse
import os
import re
import time
import sys
from .breachcompilation import breachcomp_check
from .classes import target
from .colors import colors as c
from .helpers import (
fetch_emails,
find_file... |
cb9347141cd74510ed355abd0723f6f482e766d3 | 13493ba33b9f1049d687f84b6b23470162a3b2b4 | KariusDx/terraform-elasticache | /redis-snapshot-replicator/functions/remove_snapshot.py | Python | py | 1,111 | permissive | import boto3
import botocore
import datetime
import re
import os
instances = os.environ['DB_INSTANCES']
duration = os.environ['RETENTION']
print('Loading function')
def lambda_handler(event, context):
source = boto3.client('elasticache')
for instance in instances.split(','):
paginator = source.g... |
1164b8e2f5087c03fa25c20e554df3e89eac2e61 | 6c02988b65bf623eb81dc3c1c93021ae4a7d72db | alexbruf/canvoice | /functions/helper_test.py | Python | py | 1,313 | permissive | from helper import parse_webhook_request, generate_webhook_response
import json
def test_parse_request():
f = open('test_request.json', 'rb')
if not f:
raise Exception()
req = json.load(f)
resp = parse_webhook_request(req)
assert resp == {
'detect_intent_response... |
11efd62d706571c3302f80a85d7d943d2b8d8af4 | 495a2db87225d26e126365ce2d5575799fbb2a0c | packiba/mech-calculation | /initial_data.py | Python | py | 4,708 | no_license | import re
from openpyxl import load_workbook
class InitialData:
"""Исходные данные для расчётов. Класс создаётся на основе excel файла."""
def __init__(self, filename):
self.filename = filename
self.workbook = None
self.worksheet = None
self.ST_number = None
self.feed... |
456ce3f3f1e6f145f26db65689a34b5453165505 | 1f1ba1e2907c93d708aa3c320913de08f12d4c2e | ashwanitr/flask-jogg-app | /init_sqlite_db.py | Python | py | 1,082 | no_license | from flask_app import db, bcrypt
from flask_app.models import User, Jogg, Location
"""
Database initialization commands
run `python init_sqlite_db.py` from command line to setup local sqlite database
"""
db.create_all()
# Create a dummy user
user = User(username="user", password=bcrypt.generate_password_hash("passwor... |
b95451c436b449ebbee0a6307c4abba0b9dd0339 | a7acddacdb13bbdb73222b37a96772b74b40f27c | prediction2020/vessel_annotation | /src/RF/utils/prepare_samples.py | Python | py | 622 | permissive | import os
import pandas as pd
from src.RF import rf_config
def get_balanced_samples(feature_names=None):
rf_data_dirs = os.path.join(rf_config.DATA_DIR, rf_config.VESSEL_VOXEL_DATA_DIR)
df = pd.read_pickle(os.path.join(rf_data_dirs, rf_config.BALANCED_DATAFRAME_FILE_NAME))
df = df[['patient_id'] + featu... |
64f94e87ee96f8ec062bed6b7cf92a7f0f14d843 | 2e926ede1236d09c6b6871b37805b30de2420d0f | jochasinga/miniblock | /node_test.py | Python | py | 892 | no_license | """
"""
import hashlib
from node import Chain, Node
def blockchain_test():
"""Test the creation of a genesis block node"""
init_hash = hashlib.md5('foobarbaz').hexdigest()
chain = Chain(genesis=Node(data=None, hash_str=init_hash))
genesis = chain.genesis
assert chain
assert chain.size == 1
... |
0ecd851517bafe17d33e7db23edcf53947e93df9 | fc06e4bc51b3fa9e080c9c5fdd83a05e50809e8c | grzes5003/LicensePlateRec | /core/tests/test_basic_config.py | Python | py | 283 | permissive | from core.manager.Manager import Manager
def test_proper_import():
import toml
with open("./core/tests/test_config.toml") as file:
config = toml.load(file)
manager = Manager(config)
res = manager.mock()
assert config['manager']['max_workers'] is res
|
26a06b80c768cb9aa4ae1c3833bd85c2b00b83b6 | b5763232e5e94bda90690a03c924327d15590104 | satyam-seth-learnings/python_learning | /Geeky Shows/Core Python/170.values_Method[201].py | Python | py | 265 | no_license | stu={101:'Rahul',102:'Raj',103:'Sonam'}
print("Original Dict:")
print(stu)
all_values=stu.values()
print(all_values)
print(type(all_values))
values_lst=list(all_values)
print(values_lst)
print(type(values_lst))
print(values_lst[0])
for v in values_lst:
print(v) |
3f5b1b4aae2de236a297b2e590edbb68b107dba8 | c61bf1a232e206e13afb1c49fe00974827de1584 | paciadawid/selenium-wro | /day_3/pages/search.py | Python | py | 749 | no_license | from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from day_3.selectors.search_selectors import *
from day_3.config import *
class SearchPage:
def __init__(self, driver):
self.driver = driver
def search(self, search_text):
... |
41dc35258a5ae3c7279bc1e290369c7f279016da | f191b00b7a18300d8a2ffd5de0154614ee1eb872 | zhxjenny/SoftTest | /preview-exercise/ex9.py | Python | py | 415 | no_license | # Here's some new strange stuff, remember type is exactly.
days ="Mon Tue Wed Thu Fri Sat Sun"
months = "Jan\nFeb\nMar\nApr\nMay\nJun\nJul\nAug"
print "Here are the days:", days
print "Here are the months:", months
print """
There's something going on here.
With the three double-quotes.
We'll be able to type as uch a... |
81fad92aaf9a0f5188051bc816b0155dbdf21c8d | 7e89261090a6b33d690e6438c40908da7ba9cf3e | KsushaSeliv/Portfolio-python-6-semestr- | /Лабораторная работа №1/labrab.py | Python | py | 5,282 | no_license | # coding: utf-8
# In[2]:
#Скачайте train (обучающий) набор данных о пассажирах Титаника.
#С использованием кода на Python найдите ответы на вопросы.
# In[2]:
import pandas as pd #импорт библиотеки pandas (высокоуровневая Python библиотека для анализа данных.)
Res = pd.read_csv('train.csv') #считываем csv-файл
# ... |
b72d4892180fceef790474c2efe0d0f42a9fa327 | c2edae16fe9fc8515e52953ede6f65cfdd488e20 | sensisoft/celery | /celery/beat.py | Python | py | 7,497 | permissive | import time
import math
import shelve
import atexit
import threading
from UserDict import UserDict
from datetime import datetime
from celery import log
from celery import conf
from celery import registry
from celery.log import setup_logger
from celery.exceptions import NotRegistered
TIME_UNITS = (("day", 60 * 60 * 24... |
8ab7090784520b890fd3886d4c5667ac84e6c6a9 | 91b91d95087c486a9fe7c35dbe74c751a1ff8ce0 | samsgates/mediapipe-models | /face_detection/model.py | Python | py | 4,546 | permissive | # BlazeFace: Sub-millisecond Neural Face Detection on Mobile GPUs (https://arxiv.org/abs/1907.05047)
## but it's "not same architecture" as shown in the above.
import tensorflow as tf
from tensorflow.keras.models import Model
from tensorflow.keras.layers import Input, Conv2D, Add, ReLU, MaxPooling2D, Reshape, Lambda, ... |
1db1c604fd2a13fdcf99763e72113328425643a9 | 20eecf36bb2d21654162af9b987f79f50a29739a | Aasthaengg/IBMdataset | /Python_codes/p03013/s332569324.py | Python | py | 274 | no_license | MOD = 10**9 + 7
N, M = map(int,input().split())
A = set()
for _ in range(M):
A.add(int(input()))
dp = [1] * (N+1)
if 1 in A:
dp[1] = 0
for i in range(N-1):
if i+2 in A:
dp[i+2] = 0
else:
dp[i+2] = (dp[i] + dp[i+1]) % MOD
print(dp[N]) |
d76794fbd0204b897615ae314c0c4aeffcc36f04 | 3e63156edbcb7e04d0fbf42cbb69d30d2f8b37b5 | sinajamshidi247/social-django-api | /api/serializer.py | Python | py | 809 | no_license | from rest_framework import serializers
from posts.models import Post , Comment
class PostSerializer(serializers.ModelSerializer):
created = serializers.ReadOnlyField()
poster_id = serializers.ReadOnlyField(source='user.id')
user = serializers.HiddenField(default = serializers.CurrentUserDefault())
clas... |
7ae91cc83059b5da5e6eeea0ab71ae1abaf51ddc | d1ad011796f6027d3642636a69fc898d91a696f8 | csw816/TS-anomaly | /demo/mad_gan_demo.py | Python | py | 3,075 | no_license | import os
import sys
import json
import numpy as np
from time import time
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "3"
sys.path.append("../")
from common.data_preprocess import (
generate_windows,
preprocessor,
generate_windows_with_index,
)
from common.dataloader import load_dataset
from common.evaluation im... |
1821c0d19e574f8ccbc71b56615cae7d6d47304f | 6b4d1a2ec4b22fd226b01b4df5efd34c620b5962 | softwarelikeyou/CS303E | /dad_isbn.py | Python | py | 2,425 | no_license | # File: ISBN.py
# Description: Validate a collection of ISBNs
# Student Name: Courntey C. Thomas
# Student UT EID: cct685
# Course Name: CS 303E
# Unique Number: 1
# Date Created: 4/2/2016
# Date Last Modified: 4/2/2016
import os.path
import sys
def removeHyphens(line):
result = []
for char in line... |
5bb0cb3b3fadf505f2b5cf5e63a60488633fcb75 | e6a4ab1435b5664279b396c949c67c9195efbd3b | ykomal/passport-automation | /passport/abc1/Admins/migrations/0008_auto_20181124_1858.py | Python | py | 958 | no_license | # -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2018-11-24 13:28
from __future__ import unicode_literals
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('Admins', '0007_auto_20181124_1016'),
]
operations = [
migrati... |
a86365ea670dcdf854dbe31bc9b3a6e5f43e353f | 7980b74972aec74f7975d74c1ecae114da662dac | daohuei/MapReduce-Program-Synthesis | /biglambda/setup.py | Python | py | 937 | no_license | from argparse import ArgumentParser
import os
PATH = "/home/biglambda/biglambda"
parser = ArgumentParser("BigLambda - synthesizing MapReduce programs since 2015")
parser.add_argument("-s", "--signature")
parser.add_argument("-d", "--data")
parser.add_argument("-v", "--verbose", action="store_true")
parser.add_argumen... |
58074731f74371c1b88d6972bcfa26425f81075e | 731d3ccfc8014b86bec98d704b05d2c1deecfee5 | NOAA-PMEL/envDataSystem | /envdsys/envdatasystem/migrations/0015_controllercomponentinstrument.py | Python | py | 1,244 | permissive | # Generated by Django 3.1.7 on 2021-02-27 19:11
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('envdatasystem', '0014_delete_controllercomponentinstrument'),
]
operations = [
migrations.CreateModel(
... |
c4fed9da543e1156e0bd3eaeb1eefbb26266eff5 | bd69c8b49469ceedc9c5fadac169c30aeb0bcb83 | koshchii/dns_mantid_gui | /DNSReduction/main_view.py | Python | py | 5,333 | no_license | # Mantid Repository : https://github.com/mantidproject/mantid
#
# Copyright © 2021 ISIS Rutherford Appleton Laboratory UKRI,
# NScD Oak Ridge National Laboratory, European Spallation Source
# & Institut Laue - Langevin
# SPDX - License - Identifier: GPL - 3.0 +
"""
Reduction GUI for DNS Instrument at MLZ
"... |
fdf909c7fd1cba648b74735b9d6b423efa229726 | a3deb46f9dc9901f717503a1bd53138cdfa3cc8a | ericsouza/django_ecommerce | /store/migrations/0002_product_image.py | Python | py | 394 | no_license | # Generated by Django 3.1.2 on 2020-10-21 22:03
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('store', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='product',
name='image',
field... |
1bfde4b29042ed9d35525e6c41c1fc338ce7bab6 | 333e907ee1334deff2b9e84f56bfe62f0cd9a53d | pudo-attic/newshacks | /cosine.py | Python | py | 2,033 | no_license | import json, re
from pprint import pprint
from common import load_article_dict
from gensim import corpora, models, similarities
from nltk.tokenize import WordPunctTokenizer
def similarity(article, other):
total = 0
for gram, score in article.items():
total += abs(score - other.get(gram, 0))
return ... |
0061e6db986ddd36d44fad4d354038053ee4a113 | f3365fbcc90ab6244df49783dc043bd6b2d8c615 | ProjectQ-Framework/ProjectQ | /projectq/backends/_sim/_simulator.py | Python | py | 18,488 | permissive | # Copyright 2017, 2021 ProjectQ-Framework (www.projectq.ch)
#
# 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 ... |
af1e390e7ab323b1e63379a53ab204ca86669a57 | 1a0b9361c633e25ae500260caa87a477cabd442f | reypader/gcp-samples | /gae-product-service/main.py | Python | py | 2,575 | permissive | import logging
import base64
import json
import sys
from flask import Flask, request
from google.appengine.api import search
from google.appengine.api.search import Query, QueryOptions
from google.appengine.ext import ndb
from flask import jsonify
import traceback
app = Flask(__name__)
class Product(ndb.Model):
... |
7349f36158fcc18af476424f71fb80898c2bbb8b | e5dbf9ef33f7f522a8a9fb85ffbce1aef2ac36eb | samfway/university_network | /models/pick_sigmoid.py | Python | py | 3,825 | no_license | #!/usr/bin/env python
__author__ = "Sam Way"
__copyright__ = "Copyright 2014, The Clauset Lab"
__license__ = "BSD"
__maintainer__ = "Sam Way"
__email__ = "samfway@gmail.com"
__status__ = "Development"
from numpy import zeros, ones, array, exp, hstack
from numpy.random import shuffle, seed, choice, random
from scipy.... |
ebfa82690cc98276088f82a9a13d84ec96c1cdc2 | 9b76344064a557387e95ba62773dffb7c4669f36 | jhess90/classification_scripts | /dPCA/python/dPCA_demo.py | Python | py | 2,811 | permissive |
# coding: utf-8
# In[1]:
#get_ipython().magic(u'pylab inline')
from numpy import *
from numpy.random import rand, randn, randint
from dPCA import dPCA
import matplotlib as plt
# We first build surrogate data to apply dPCA to.
# In[2]:
# number of neurons, time-points and stimuli
N,T,S = 100,250,6
# noise-level... |
76178efcdcd56dd5e3446491650c3075f1de8332 | ae481d712877e3364d466b35c16d375f4ff84ee7 | TransferEasyDev/hipopay-python-sdk | /examples/api/alipay/get_bill.py | Python | py | 294 | no_license | # -*- coding: utf-8 -*-
from config import MERCHANT_NO
from kernel.api.alipay import Alipay
if __name__ == '__main__':
params = {
'merchant_no': MERCHANT_NO,
'start_date': '20190101',
'end_date': '20190120',
}
alipay = Alipay()
alipay.get_bill(params)
|
0ee64f88127e98a6572708c368419718fabb199d | 7f05d2f3af598308ee3db7a04939fa5f4feea710 | raghavddps2/Technical-Interview-Prep-1 | /UD_DSA/Course1/Arrays+LL/reverse_words.py | Python | py | 689 | no_license | # Code
def word_flipper(our_string):
"""
Flip the individual words in a sentence
Args:
our_string(string): String with words to flip
Returns:
string: String with words flipped
"""
# TODO: Write your solution here
str1 = our_string.split(" ")
for i in range(0,len(st... |
260c93cd5a53792281e6ec9142b28bdbb9b92ba5 | 983650bbbd0544ad06a519fe36b164182c5ad8df | tyge318/tyge318.github.io | /leetcode/231. Power of Two/231._Power_of_Two_2.py | Python | py | 240 | no_license | class Solution(object):
def isPowerOfTwo(self, n):
"""
:type n: int
:rtype: bool
"""
bitString = bin(n)
return (n >= 1) and (bitString.count('1') == 1)
|
42974b104fe9643c05b8983745a669f40ddc724a | da8316de03a2b6f47c6f2afc6f68cd102e4c0627 | jlin22/MIT_Algorithms | /Unit2/avl_sort.py | Python | py | 1,427 | no_license | class AVLNode:
left = None
right = None
parent = None
key = None
height = 1
def height(node):
if node is None:
return -1
else:
return node.height
def update_height(node):
node.height = max(height(node.left), height(node.right)) + 1
def rebalance(node):
while node i... |
90f8b0b9a24fb87ec94017f81878cdd974b8f31f | 3585b822793adab5aae32a22a517a28b5a88e93c | luc-leonard/taming-transformers | /scripts/clip_generator/utils.py | Python | py | 6,558 | permissive | import math
import torch
import torch.nn.functional as F
from torch import nn
import kornia.augmentation as K
def noise_gen(shape):
n, c, h, w = shape
noise = torch.zeros([n, c, 1, 1])
for i in reversed(range(5)):
h_cur, w_cur = h // 2**i, w // 2**i
noise = F.interpolate(noise, (h_cur, w_c... |
dec52991f010c4c1bf21ac054b89f585aab0e2bd | b4e764cab8e0ecb1e5f3bd9f17dfe194049263b9 | gitter-badger/bodine | /bodine/syn.py | Python | py | 1,681 | no_license | from textblob import Word, TextBlob
import requests
from api import Wordnik, GoogleBooks
from itertools import chain
class Synonyms(object):
"""returns synonyms of words"""
def __init__(self, query):
'''currently only support 1 synonym search per query'''
if not query:
raise Exception, 'Empty input.'
self.qu... |
ad61b8a000bc62a671c53eaf38b164b136f89363 | 50118d15d9f75beac0a7aa835c1d74ca3cccca1b | KvSaiMahesh/lanforge-scripts | /py-scripts/test_generic.py | Python | py | 17,732 | permissive | #!/usr/bin/env python3
"""
NAME: test_generic.py
PURPOSE:
test_generic.py will create stations and endpoints to generate traffic based on a command-line specified command type.
This script will create a variable number of stations to test generic endpoints. Multiple command types can be tested
including ping, speedt... |
2d0249038abd360aa0fd4aac5ebc70e83d62620f | e45c1ff71b49e48126e2259603ffa351d9a227d3 | RichardcLee/Spiders | /爆米花视频/baomihua/pipelines.py | Python | py | 1,061 | no_license | # -*- coding: utf-8 -*-
from baomihua.items import VideoItem, ImgItem
import os
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://doc.scrapy.org/en/latest/topics/item-pipeline.html
class BaomihuaPipeline(object):
def process_item(self, item, spid... |
f75cf155ae86f61adeaf40f43d481a81ef6f929f | 6d996657c956f86cb136f891874b42f7a78eecb3 | R-ando/copefrito | /web_list_view_sticky/__openerp__.py | Python | py | 634 | no_license | {
'name': 'List View Fixed Table Header',
'version': '9.0.1',
'category': 'Tools',
'sequence': 15,
'summary': 'Web List View Fixed Table Header',
'description': """
Web List View Fixed Table Header
=================================
* Fixed (sticky) list view table header, very helpful when deali... |
e8efc0833219aa46dee26971a5ce79a7520c52a5 | 6a9aa619e079ce566395054649a589d6aeea94bb | cash2one/xai | /xai/brain/wordbase/nouns/_embargoes.py | Python | py | 247 | permissive |
from xai.brain.wordbase.nouns._embargo import _EMBARGO
#calss header
class _EMBARGOES(_EMBARGO, ):
def __init__(self,):
_EMBARGO.__init__(self)
self.name = "EMBARGOES"
self.specie = 'nouns'
self.basic = "embargo"
self.jsondata = {}
|
808e3f289a843c40004992c6151b346f339ef7fb | 04e8b1ca52be13acc829a6d2230f155d100ad4d0 | OneGov/onegov-cloud | /tests/onegov/core/test_security.py | Python | py | 6,782 | permissive | import morepath
import onegov.core.security
from onegov.core.framework import Framework
from onegov.core.security import Public, Personal, Private, Secret
from onegov.core.security import forget, remembered
from webtest import TestApp as Client
def spawn_basic_permissions_app(redis_url):
class App(Framework):
... |
6da413bbe2f85d54f3d641504f8b677ca1187330 | 89705e9005e1d4927e49a37d6d3af234c5a2bc84 | skaben/device_audio | /app.py | Python | py | 977 | no_license | import os
import sys
import json
from skabenclient.config import SystemConfig
from skabenclient.helpers import get_mac
from skabenclient.main import start_app
from dotenv import load_dotenv
from device import SoundDevice
from config import SoundConfig
root = os.path.abspath(os.path.dirname(__file__))
sys_config_pa... |
2af1fdbc5329002a79dac9379d5abaa7827e7329 | 0e38d4bc9979dda3e98e178117937115f5e913c1 | txrproject/tor_classifier | /find_bridge_nodes.py | Python | py | 1,954 | no_license | from scapy.all import *
import os
import binascii
import math
#Taken from: http://freecode.com/projects/revelation/
def new_entropy(string):
"Calculates the Shannon entropy of a string"
# get probability of chars in string
prob = [ float(string.count(c)) / len(string) for c in dict.fromkeys(lis... |
7d533c9caeb16d1099ab0803c4970900ab93c2fc | c47d865b25e73cc4d4cfc4b8d5be5699ef742396 | sr-dev/audio | /wsgi.py | Python | py | 1,146 | no_license | # audio.wsgi
'''
WSGI config for audio project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_AP... |
4f00c0792fe6a786b380ad292846c8f0284f7743 | 2f3fed9deebaf14f974eb6d6640d739c9d614e54 | sumukharm/Detecting-distracted-Drivers | /main.py | Python | py | 3,071 | no_license | from __future__ import print_function
from __future__ import division
import os
import time
import pickle
import numpy as np
import tensorflow as tf
from sklearn.cross_validation import LabelShuffleSplit
from model import Model
from utilities import write_submission, calc_geom, calc_geom_arr, mkdirp
from architectur... |
138c2fe741dfbd6073f86b6f2d372e5d891ce246 | 61cf60f3119bd477b16d8f211bea5e8a75e62ed6 | naapavalley/weibo-spyder | /weibo_spyder.py | Python | py | 8,762 | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Feb 26 18:02:56 2019
Updated 2019-10-9 13:30:07
@author: Administrator
"""
from selenium import webdriver
from bs4 import BeautifulSoup
import numpy as np
from scipy import *
import time
import re
niCheng = 'big4parttime'
fileName = niCheng + '.txt'
# todo 增加自动爬取图片的功能
def s... |
36302f70da58bcf9fda9ed0c9f2140fa9413c6ff | 9092861169c24b329aaa4839b353dd6571602411 | cleancoindev/dala-wallet | /src/microraiden/dala_proxy.py | Python | py | 4,819 | permissive | import logging
import requests
import json
import configparser
import os
import boto3
import jwt
import urllib.parse
from microraiden.click_helpers import main, pass_app
from microraiden.proxy.resources import Expensive, PaywalledProxyUrl
from flask import Response, make_response, request, render_template_string, jsoni... |
d9ebe427376fa04c840e51d436eb37dba5d12783 | fd7ac126b22bf9ab66dc8d1a931584de53e2b53a | sundial-dreams/SentimentApp | /Back-End/lib/extract.py | Python | py | 1,175 | no_license | import sys
import os
import json
dirname = sys.path[0].replace("\\", "/")
support_dir = dirname + "/resource/support"
temp_dir = dirname + "/resource/temp/"
def config(config_path: str = dirname + "/config.json") -> dict:
with open(config_path) as f:
return json.load(f)
def generate_feature(filepath: s... |
e2ecb972b7eb914e3da7252c55cf94d399d7e384 | 0ad4b77d974353b3ea74d53e13cc628e50753348 | 1553007/BBC-News-Clawler | /remove_vi_stopwords.py | Python | py | 1,313 | no_license | import os, io, codecs
import sys
from underthesea import word_tokenize
path = sys.argv[1]
def sorted_stopwords_list(stopwords_list):
stopwords_list.sort(key = lambda s: len(s), reverse=True)
return stopwords_list
def load_vietnamese_stopwords():
vi_stopwords_list = []
with io.open("stopwords.vi", 'r', ... |
11ae8ad81964069a001a9a5e3cc647fea2867829 | eb0455093a3358b56981c9f353aa8f8598433bf1 | sensecollective/PhotosynQ-Python | /photosynq_py/auth.py | Python | py | 2,350 | no_license | """
Provides a login() function that should be called before querying the Photosynq API.
"""
import getpass
import requests
import photosynq_py.globals as gvars
import photosynq_py.getjson as getJson
def login(u_email=None):
"""
Login to the PhotosynQ API using your PhotosynQ account email addr... |
62dcbc2a07b4269a7fc0819a023fc0edd65dcb67 | 0be5753a0a6b92be47bf7709586ee688de7ed01a | Afdrif-K/py | /Management software-1/Ri.py | Python | py | 1,357 | permissive | #encoding=utf-8
from openpyxl import load_workbook
import pandas as pd
from nameout import out
R=input("输入年份:")
date=pd.date_range(R+'/01/01',R+'/12/31', freq='D')
print(date)
week=[int(i.strftime("%w")) for i in date] # 0表示星期日
dataframe = pd.DataFrame({'date':date,'week':week})
dataframe.to_excel('dates.xl... |
d8eb5749d918649a96129804800ead1112dcb97d | 03f7e89f19f59177ba8883fa7b37d635871b6870 | petroav/sublime-settings | /sublime-text-2/Packages/auto-save/auto_save.py | Python | py | 4,166 | permissive | '''
AutoSave - Sublime Text Plugin
Provides a convenient way to turn on and turn off
automatically saving the current file after every modification.
'''
import os
import sublime
import sublime_plugin
from threading import Timer
settings_filename = "auto_save.sublime-settings"
on_modified_field = "auto_save_on_modi... |
a70b463f398e7c6dcf58287c0712953beb0b09ab | 5c19505de28228f93921d1385e76ec9f9539dd09 | ucb-sejits/ast_tool_box | /ast_tool_box/controllers/shell.py | Python | py | 6,025 | permissive | """
basic shell that allows for application of ast_transformer and code serializers to be applied to
an AST
"""
from __future__ import print_function
import os
import readline
import atexit
history_file = os.path.join(os.path.expanduser("~"), ".ast_viewer_hist")
try:
readline.read_history_file(history_file)
except... |
b6d7f46fe1d8ff0cd169cbe34edb924e60738361 | 6192b1727eaae8c3496acab545cc77f8b42150e0 | hartl3y94/HousesAPI | /services/api/endpoints/houses/resource.py | Python | py | 3,995 | permissive | import json
from flask_restful import Resource, reqparse
from api.endpoints.houses.model import House
from api.endpoints.utils import add_common_arguments, log_context
class HousesOperator(Resource):
def __init__(self):
self.model = House
self._set_get_parser()
self._set_post_parser()
... |
222f27b31c03a1a950a8b3aeba766b58a5da3ff4 | c9a6d46054b71b1a22d8dbe8ff41c9f7a51c5244 | jihyuns/RespectableCompromisesWebApp-Python | /word2vec.py | Python | py | 928 | no_license | # -*- coding: utf-8 -*-
from gensim.models import Word2Vec
from flask import Flask, request, jsonify, send_file
from flask_cors import CORS
import os
import json
app = Flask(__name__, static_folder='outputs')
CORS(app)
def init():
global model
mode... |
d2d4d99f5fba4365ae22fe9631051002a67a95b4 | b9752af99df02fa191c174d6fbe9c7a463a8973a | pitipund/basecore | /users/migrations/0014_auto_20171219_1526.py | Python | py | 601 | no_license | # -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-12-19 15:26
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('users', '0013_auto_20171212_1423'),
]
operations = [
migrations.RemoveField(
... |
4137598adc6c94ce658972164d41232e47441364 | a9f53eba24a92f20cf6e4e2923583b1fc5debea8 | renwl/mylinux | /python-2/datastruct/btree.py | Python | py | 1,250 | no_license | class BTree:
def __init__(self,value):
self.left=None
self.data=value
self.right=None
def insertLeft(self,value):
self.left=BTree(value)
return self.left
def insertRight(self,value):
self.right=BTree(value)
return self.right
def show(self):
... |
09809c3d5a9497858bc9a6dfe7f7f9c822c2910a | 212eaed2cf8b076dbc5481bc39950cd45ee53f1f | kumkumchoudhary14/ProblemStatement-X | /app.py | Python | py | 971 | no_license | from flask import Flask
from flask import jsonify
from flask import request
app = Flask(__name__)
@app.route("/scores", methods=['POST'])
def index():
json_input = request.json
lists = json_input["lists"]
scores = generate_scores(lists)
return jsonify({"scores" : scores})
def generate_scores(dictio... |
33c57a12277604f87d48babdb5e6db2b540b7f4f | f06aa6a2e694a8168331b4289bbb994296ccfe24 | kant/ci_edit | /app/window.py | Python | py | 26,464 | permissive | # Copyright 2016 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
dd2969ffe3ed8e3feb1bf9c5d455943b5c998303 | 4d436f6987ee87e666b25c599d164078c2d8e85f | 355731090990871/dataplicity-agent | /tests/dataplicity/test_rpi.py | Python | py | 2,263 | permissive | from dataplicity.rpi import get_machine_revision
from mock import patch
import six
REVISION_TEMPLATE = '\nRevision: %s'
""" Unfortunetely, we can't use mock_open from mock library, because
the underlying code uses an iterator, which mock_open doesn't implement.
There is a brief solution which might work for... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.