repo_name stringlengths 6 97 | path stringlengths 3 341 | text stringlengths 8 1.02M |
|---|---|---|
radugaf/application-development-2 | edesia_main/edesia_main/users/admin.py | <reponame>radugaf/application-development-2<gh_stars>0
# from django.contrib import admin
# from django.contrib.auth import admin as auth_admin
# from django.contrib.auth import get_user_model
# from edesia_main.users.forms import (
# UserChangeForm,
# UserCreationForm,
# )
# User = get_user_model()
# @admi... |
radugaf/application-development-2 | edesia_main/edesia_main/users/api/urls.py |
from django.urls import path
from django.conf import settings
from django.conf.urls.static import static
from .views import *
app_name='users-api'
urlpatterns = [
path('user-registration/', UserRegistrationView.as_view(), name='user-registration'),
path('check-user-type/', CheckUserTypeAPIView.as_view(), n... |
radugaf/application-development-2 | edesia_main/edesia_main/products/migrations/0016_restaurantorderitemhistory.py | <gh_stars>0
# Generated by Django 3.0.8 on 2021-01-05 14:30
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('products', '0015_auto_20201229_0158'),
]
operations = [
migrations.CreateModel(
nam... |
radugaf/application-development-2 | edesia_main/edesia_main/products/migrations/0003_auto_20201223_0055.py | # Generated by Django 3.0.8 on 2020-12-23 00:55
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_MODEL),
('products', '0002_auto_20... |
radugaf/application-development-2 | edesia_main/edesia_main/users/apps.py | from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
class UsersConfig(AppConfig):
name = "edesia_main.users"
verbose_name = _("Users")
def ready(self):
import edesia_main.users.signals # noqa F401
super().ready()
|
radugaf/application-development-2 | edesia_main/edesia_main/products/migrations/0004_auto_20201224_2100.py | # Generated by Django 3.0.8 on 2020-12-24 21:00
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('products', '0003_auto_20201223_0055'),
]
operations = [
migrations.RenameField(
model_name='company',
old_name='titl... |
radugaf/application-development-2 | edesia_main/edesia_main/staff/urls.py | <filename>edesia_main/edesia_main/staff/urls.py<gh_stars>0
from django.urls import include, path
from rest_framework.authtoken.views import obtain_auth_token
from .views import UserCreateView
from .api import LoginAPI, UserAPI, ChangePasswordAPI, SendInvitationAPI, StaffRegistrationAPI
app_name = "staff"
urlpatterns ... |
radugaf/application-development-2 | edesia_main/edesia_main/products/admin.py | from django.contrib import admin
from edesia_main.products.models import *
# Register your models here.
admin.site.register(Restaurant)
# admin.site.register(StaffDetail)
# admin.site.register(SupplierDetail)
admin.site.register(Product)
admin.site.register(Variation)
admin.site.register(ProductVariation)
admin.site... |
radugaf/application-development-2 | edesia_main/edesia_main/products/migrations/0017_auto_20210105_1528.py | # Generated by Django 3.0.8 on 2021-01-05 15:28
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('products', '0016_restaurantorderitemhistory'),
]
operations = [
migrations.AlterField(
model_na... |
radugaf/application-development-2 | edesia_main/edesia_main/products/migrations/0002_auto_20201222_0112.py | # Generated by Django 3.0.8 on 2020-12-22 01:12
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('prod... |
radugaf/application-development-2 | edesia_main/edesia_main/users/models.py | from django.contrib.auth.models import AbstractUser
from django.db import models
from django.urls import reverse
from django.conf import settings
from django.utils.translation import gettext_lazy as _
from edesia_main.products.models import Restaurant
class User(AbstractUser):
name = models.CharField(
_(... |
radugaf/application-development-2 | edesia_main/edesia_main/staff/serializers.py | from rest_framework import serializers
from django.contrib.auth.models import User
from django.contrib.auth import authenticate
from django.conf import settings
from edesia_main.staff.models import StaffDetail
class StaffDetailsSerializer(serializers.Serializer):
class Meta:
model = StaffDetail
f... |
radugaf/application-development-2 | edesia_main/edesia_main/users/tests/test_models.py | <reponame>radugaf/application-development-2<gh_stars>0
import pytest
from edesia_main.users.models import User
pytestmark = pytest.mark.django_db
def test_user_get_absolute_url(user: User):
assert user.get_absolute_url() == f"/users/{user.username}/"
|
radugaf/application-development-2 | edesia_main/edesia_main/products/apps.py | <gh_stars>0
from django.apps import AppConfig
class ProductsConfig(AppConfig):
name = "edesia_main.products"
def ready(self):
import edesia_main.products.signals # noqa F401
super().ready() |
radugaf/application-development-2 | edesia_main/edesia_main/users/migrations/0002_auto_20201223_0055.py | <filename>edesia_main/edesia_main/users/migrations/0002_auto_20201223_0055.py
# Generated by Django 3.0.8 on 2020-12-23 00:55
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0001_initial'),
]
operations = [
migrations.RenameFie... |
radugaf/application-development-2 | edesia_main/edesia_main/staff/apps.py | <gh_stars>0
from django.apps import AppConfig
class StaffConfig(AppConfig):
name = 'edesia_main.staff'
|
radugaf/application-development-2 | edesia_main/edesia_main/users/adapters.py | from typing import Any
from django.core import mail
from django.template import TemplateDoesNotExist
from django.core.mail import EmailMessage, EmailMultiAlternatives
from django.template.loader import render_to_string
from allauth.account.adapter import DefaultAccountAdapter
from allauth.socialaccount.adapter impor... |
radugaf/application-development-2 | edesia_main/edesia_main/products/migrations/0013_auto_20201229_0111.py | # Generated by Django 3.0.8 on 2020-12-29 01:11
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('products', '0012_remove_orderitem_final_quantity'),
]
operations = [
migrations.AlterField(
model_name='orderitem',
... |
radugaf/application-development-2 | edesia_main/edesia_main/products/api/views.py | <filename>edesia_main/edesia_main/products/api/views.py
import datetime
import json
import time
import os
from io import BytesIO
from weasyprint.fonts import FontConfiguration
from weasyprint import HTML
from django.template.loader import render_to_string
from django.core.files.storage import FileSystemStorage
from ... |
radugaf/application-development-2 | edesia_main/edesia_main/products/migrations/0009_auto_20201227_2325.py | <filename>edesia_main/edesia_main/products/migrations/0009_auto_20201227_2325.py
# Generated by Django 3.0.8 on 2020-12-27 23:25
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('products', '0008_invoice'),
]
operations = [
migrations.Alt... |
radugaf/application-development-2 | edesia_main/edesia_main/staff/admin.py | from django.contrib import admin
from edesia_main.staff.models import StaffDetail
admin.site.register(StaffDetail)
|
radugaf/application-development-2 | edesia_main/edesia_main/products/migrations/0001_initial.py | <reponame>radugaf/application-development-2<gh_stars>0
# Generated by Django 3.0.8 on 2020-12-22 01:12
from django.db import migrations, models
import django.db.models.deletion
import django_countries.fields
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
... |
Untesler/BeneficialTweetCOVID-19 | scraper/tweets.py | import json
from codecs import open
from utils.jsonTweetEncoder import JSONEncoder
from twitterscraper import query_tweets
from os.path import join, abspath
def scrape(query_string = '(#COVID19,#COVID-19,#COVID_19)', limit=1, lang='th', poolsize=1, file_name = 'covid19_raw_dataset', save = True):
tweets_lst = quer... |
Untesler/BeneficialTweetCOVID-19 | scraper/tweet.py | import requests, re
from codecs import open
from os.path import join, abspath
from bs4 import BeautifulSoup as bs
from urllib.parse import unquote
def get_url_title(urls):
titles = []
for url in urls:
try:
res = requests.get(url)
soup = bs(res.content, 'lxml')
titles... |
Untesler/BeneficialTweetCOVID-19 | utils/__init__.py | from pythainlp.corpus import thai_stopwords
from pythainlp.tokenize import word_tokenize
from pythainlp.word_vector import sentence_vectorizer
from utils.ProgressBarThread import ProgressBarThread
def remove_duplicated_sent(sentence):
sents = sentence.split(' ')
sents = list(dict.fromkeys(sents)) # remove dupl... |
Untesler/BeneficialTweetCOVID-19 | beneficialtweets/train_model.py | import random, json, time
import numpy as np
from codecs import open
from joblib import dump
from sklearn import svm
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score
from sklearn.ensemble import RandomForestClassifier
from os.path import abspath, join
from utils import cle... |
Untesler/BeneficialTweetCOVID-19 | beneficialtweets/__init__.py | <gh_stars>1-10
from beneficialtweets.train_model import train
from beneficialtweets.test_model import predict |
Untesler/BeneficialTweetCOVID-19 | beneficialtweets/test_model.py | <reponame>Untesler/BeneficialTweetCOVID-19<filename>beneficialtweets/test_model.py
from joblib import load
from os.path import abspath, join
from utils import remove_stopwords, sentence_vectorizer
def predict(sentence, model_path='./model/svm_classifier.joblib'):
classifier = load(abspath(join(*model_path.split('/... |
Untesler/BeneficialTweetCOVID-19 | main.py | import re
import time
from optparse import OptionParser
from beneficialtweets import train, predict
from utils import ProgressBarThread
parser = OptionParser()
parser.add_option('--train', dest='train', help='Build the classifier from given dataset', default='')
parser.add_option('--predict', dest='predict', help='Cl... |
Untesler/BeneficialTweetCOVID-19 | utils/jsonTweetEncoder.py | import json
import collections
import datetime as dt
class JSONEncoder(json.JSONEncoder):
def default(self, obj):
if hasattr(obj, '__json__'):
return obj.__json__()
elif isinstance(obj, collections.Iterable):
return list(obj)
elif isinstance(obj, dt.datetime):
... |
Untesler/BeneficialTweetCOVID-19 | utils/ProgressBarThread.py | <gh_stars>1-10
import sys
import threading
import time
class ProgressBarThread(threading.Thread):
def __init__(self, label='Working', delay=0.2):
super(ProgressBarThread, self).__init__()
self.label = label
self.delay = delay # interval between updates
self.running = False
def ... |
ajaykumar426344/me | consoleme/lib/redis.py | <filename>consoleme/lib/redis.py
import sys
import threading
from typing import Optional
import boto3
import redis
import ujson as json
from asgiref.sync import sync_to_async
from redis.client import Redis
from consoleme.config import config
from consoleme.lib.plugins import get_plugin_by_name
region = config.region... |
RajeshThakur1/TextSummarization | forms.py | from flask_wtf import FlaskForm
from wtforms.widgets import TextArea
from wtforms import StringField, SubmitField
from wtforms.validators import DataRequired
class LinkForm(FlaskForm):
link = StringField('Link', validators=[DataRequired()])
sum = StringField('Sum', widget=TextArea())
submit = SubmitFie... |
RajeshThakur1/TextSummarization | app.py | <reponame>RajeshThakur1/TextSummarization
from flask import Flask, redirect, request
# For flashing a message
from flask import flash
# For rendering html templates
from flask import render_template
# For linking files, generates a URL
from flask import url_for
# Import our forms
from forms import LinkForm
from s... |
googlewaitme/vk-bot-malina | sendler.py | from vk_api import VkApi
import random
class Sendler:
"""
Приветствую и уважаю,
Этот класс нужен для отправки сообщений через vk_api
В словарь message нужно заносить данные для отправки
вконктате. Процесс запуска фукнций указан в функции
procces. Поэтому нужно смотреть. self.obj это обьект ... |
googlewaitme/vk-bot-malina | settings.py | <filename>settings.py
vk_token = 'Your vk token for sending messages'
vk_access_token = 'Your access token for callback api' |
szlin/sandsifter | sifter-summarize.py | <reponame>szlin/sandsifter
#!/usr/bin/env python2
# we had a much more automated and intelligent approach to reducing the log, but
# could not come up with a reasonable way to differentiate between a modr/m byte
# and an opcode byte. e.g. if the instruction is xxyy..., and changing xx or yy
# changes the instruction ... |
klen/muffin | muffin/pytest.py | """Support testing with Pytest."""
import pytest
import os
import logging
from asgi_tools.tests import manage_lifespan
from . import TestClient
def pytest_addoption(parser):
"""Append pytest options for testing Muffin apps."""
parser.addini('muffin_app', 'Set path to muffin application')
parser.addoptio... |
klen/muffin | setup.py | <filename>setup.py
"""Setup the muffin package."""
from setuptools import setup
setup()
|
klen/muffin | muffin/utils.py | """The Muffin Utils."""
import asyncio
import importlib
import pkgutil
import sys
import os
import typing as t
from types import ModuleType
import threading
from collections import OrderedDict
from asgi_tools._compat import trio, curio
from asgi_tools.typing import ASGIApp
__all__ = (
'aio_lib', 'aio_run', 'imp... |
klen/muffin | tests/test_handler.py | import pytest
async def test_handler(app, client):
from muffin.handler import Handler, route_method
assert Handler
@app.route('/handler', '/handler/{res}')
class Index(Handler):
async def get(self, request):
return request.path_params or 'ok'
async def post(self, reques... |
klen/muffin | tests/app.py | <reponame>klen/muffin
"""Simple basic app for testing."""
from muffin import Application
app = Application(debug=True, name='muffin')
@app.route('/')
async def index(request):
return 'OK'
@app.on_startup
async def start():
app.state = 'started'
|
klen/muffin | muffin/manage.py | <reponame>klen/muffin<filename>muffin/manage.py
"""CLI Support is here."""
import argparse
import inspect
import logging
import os
import code
import re
import sys
import typing as t
from . import __version__, CONFIG_ENV_VARIABLE
from .app import Application
from .utils import aio_lib, aio_run, import_app, AIOLIBS, A... |
klen/muffin | tests/conftest.py | import pytest
import muffin
@pytest.fixture(params=[
pytest.param(('asyncio', {'use_uvloop': False}), id='asyncio'),
pytest.param(('asyncio', {'use_uvloop': True}), id='asyncio+uvloop'),
'trio', 'curio'
], scope='session')
def aiolib(request):
return request.param
# @pytest.fixture
# def app():
#... |
klen/muffin | tests/test_pytest.py | <reponame>klen/muffin
import pytest
@pytest.fixture
def name(app):
return app.cfg.name
async def test_app_imported(app, name):
assert app.cfg.name == 'muffin'
assert app.state == 'started'
|
klen/muffin | tests/test_plugin.py | from unittest import mock
import pytest
@pytest.fixture
def app():
from muffin import Application
return Application()
async def test_plugin_config(app, client):
from muffin import Application
from muffin.plugins import BasePlugin
class Plugin(BasePlugin):
name = 'plugin'
def... |
klen/muffin | docs/conf.py | # -*- coding: utf-8 -*-
"""Setup Muffin documentation."""
import sys
import os
import pkg_resources
sys.path.append(os.path.abspath('_themes'))
sys.path.append(os.path.abspath('.'))
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your c... |
klen/muffin | muffin/app.py | <reponame>klen/muffin
"""Implement Muffin Application."""
import typing as t
from types import ModuleType
import logging
import inspect
from asgi_tools import App as BaseApp
from modconfig import Config
from . import CONFIG_ENV_VARIABLE
from .utils import import_submodules
class MuffinException(Exception):
""... |
klen/muffin | muffin/typing.py | <reponame>klen/muffin<filename>muffin/typing.py
from asgi_tools.typing import * #noqa
|
klen/muffin | muffin/plugins.py | """A helper to write Muffin Plugins."""
import typing as t
from abc import ABC, abstractmethod
from asgi_tools.utils import to_awaitable
from modconfig import Config
from . import MuffinException
from .app import Application
class PluginException(MuffinException):
"""Implement any exception in plugins."""
c... |
klen/muffin | tests/appcfg.py | CONFIG_VARIABLE = 42
PLUGIN_OPTION = 42
|
klen/muffin | muffin/__init__.py | <filename>muffin/__init__.py<gh_stars>100-1000
"""Muffin is a web framework to build ASGI applications."""
# Package information
# ===================
__version__ = "0.86.0"
__project__ = "muffin"
__author__ = "<NAME> <<EMAIL>>"
__license__ = "MIT"
from asgi_tools import ( # noqa
Request, Response, ResponseText... |
klen/muffin | tests/test_application.py | """Base Tests."""
from pathlib import Path
from unittest import mock
def test_imports():
import muffin
assert muffin.Request
assert muffin.Response
assert muffin.ResponseError
assert muffin.ResponseFile
assert muffin.ResponseHTML
assert muffin.ResponseJSON
assert muffin.ResponseRedir... |
klen/muffin | tests/test_manage.py | <filename>tests/test_manage.py<gh_stars>100-1000
import pytest
from unittest import mock
@pytest.fixture(params=['curio', 'trio', 'asyncio'])
def cmd_aiolib(request):
return request.param
def test_command(app):
@app.manage
def cmd1(name, lower=False):
"""Custom description.
:param name... |
klen/muffin | muffin/handler.py | <reponame>klen/muffin
"""Muffin Handlers."""
import inspect
import typing as t
from http_router import Router
from http_router.typing import TYPE_METHODS
from asgi_tools import Request
from asgi_tools.app import HTTPView, HTTP_METHODS
from asgi_tools.utils import is_awaitable
class HandlerMeta(type):
"""Prepar... |
Guilhermeslucas/OpenCL2CUDA | createCUDAapp.py | #!/usr/bin/python3
########################################################################
# Copyright 2016 <NAME> (<EMAIL>) #
# #
# Licensed under the Apache License, Version 2.0 (the “License”); #
# you may not use this file except in complia... |
ktdreyer/helga-users | helga_users/ldap.py | <reponame>ktdreyer/helga-users<gh_stars>0
from twisted.internet import reactor, defer
from ldaptor.protocols.ldap import ldapclient, ldapsyntax, ldapconnector
from helga import settings
from helga_users.user import User
class NoUsersFoundError(Exception):
""" Found no users in LDAP for this query """
pass
c... |
ktdreyer/helga-users | helga_users/user.py | class User(object):
def __init__(self, uid, client):
"""
A user account
:param uid: kerberos uid str like "kdreyer"
:param client: LDAPClient
"""
self.uid = uid
self.client = client
# Set these dynamically later:
self.nick = None
self.... |
ktdreyer/helga-users | helga_users/command.py | from helga.plugins import command, ResponseNotReady
from helga_users import ldap
from twisted.internet import defer
@command('user', help='Usage: helga user <pattern>')
def helga_users(client, channel, nick, message, cmd, args):
if not args:
return '%s, specify a nick to search' % nick
d = ldap.conne... |
elliotwaite/rule-30-and-game-of-life | video_writer.py | <gh_stars>100-1000
import glob
import os
import pathlib
import shutil
import subprocess
import tempfile
from cv2 import VideoWriter
from cv2 import VideoWriter_fourcc
import imageio
import numpy as np
# Set `FFMPEG_PATH` to the local path of your installation of ffmpeg.
# The conda version doesn't support the libx264... |
elliotwaite/rule-30-and-game-of-life | rule_30_and_game_of_life.py | <gh_stars>100-1000
import colour
import cv2
import imutils
import numpy as np
from scipy import signal
import tqdm
import video_writer
# # Instagram.
# VIDEO_WIDTH = 1080
# VIDEO_HEIGHT = 1350
# SECS = 60
# PIXEL_SIZE = 5
# OUTPUT_PATH = 'videos/instagram-60s-5px.mp4'
# # Twitter.
# VIDEO_WIDTH = 1024
# VIDEO_HEIGH... |
cgx027/cc_edu | baidu_python.py | <gh_stars>0
# encoding=utf-8
import wave
import urllib, urllib2, pycurl
import base64
import json
## get access token by api key & secret key
def get_token():
apiKey = "<KEY>"
secretKey = "<KEY>"
auth_url = "https://openapi.baidu.com/oauth/2.0/token?grant_type=client_credentials&client_id=" + apiKey + ... |
cgx027/cc_edu | baidu_python_record_back1.py | <reponame>cgx027/cc_edu<filename>baidu_python_record_back1.py
# -*- coding: utf-8 -*-
from pyaudio import PyAudio, paInt16
import numpy as np
from datetime import datetime
import wave
import time
import urllib, pycurl
from urllib.request import urlopen
import base64
import json
import os
import sys
from importlib impor... |
cgx027/cc_edu | sound_recorder.py | import sounddevice as sd
duration = 3
fs = 48000
myrecording = sd.rec(int(duration * fs), samplerate=fs, channels=2)
sd.wait()
sd.play(myrecording.data, fs)
print(myrecording.data)
|
sungeunchoi/chapel | util/chplenv/chpl_platform.py | #!/usr/bin/env python
import platform, os, sys, optparse
from utils import memoize
@memoize
def get(flag='host'):
if flag == 'host':
platform_val = os.environ.get('CHPL_HOST_PLATFORM')
elif flag == 'target':
platform_val = os.environ.get('CHPL_TARGET_PLATFORM')
if not platform_val:
... |
sungeunchoi/chapel | util/chplenv/chpl_arch.py | #!/usr/bin/env python
import os, optparse
from sys import stdout, stderr
from string import punctuation
import utils, chpl_platform, chpl_comm, chpl_compiler
from utils import memoize
class argument_map(object):
# intel does not support amd archs... it may be worth testing setting the
# equivalent intel arch... |
sungeunchoi/chapel | util/chplenv/chpl_tasks.py | #!/usr/bin/env python
import sys, os
import chpl_locale_model
from utils import memoize
@memoize
def get():
tasks_val = os.environ.get('CHPL_TASKS')
if not tasks_val:
locale_model_val = chpl_locale_model.get()
if locale_model_val == 'numa':
tasks_val = 'qthreads'
else:
... |
sungeunchoi/chapel | util/cron/syncPerfGraphs.py | #!/usr/bin/env python
# This script is intended to sync the performance graphs for the specified host
# to sourceforge. It is essentially a large wrapper for rsync. The reason it is
# separated, rather than just have an rsync command in place is so that we make
# sure the SF dest is the same, and that we can check for... |
sungeunchoi/chapel | util/chplenv/utils.py | <filename>util/chplenv/utils.py
import os, re, subprocess
from distutils.spawn import find_executable
def memoize(func):
cache = func.cache = {}
def memoize_wrapper(*args):
if args not in cache:
cache[args] = func(*args)
return cache[args]
return memoize_wrapper
@memoize
def ... |
sungeunchoi/chapel | util/chplenv/chpl_mem.py | <reponame>sungeunchoi/chapel
#!/usr/bin/env python
import sys, os, optparse
import chpl_comm, chpl_comm_segment
from utils import memoize
@memoize
def get(flag='host'):
if flag == 'host':
mem_val = 'default'
elif flag == 'target':
mem_val = os.environ.get('CHPL_MEM')
if not mem_val:
... |
symengine/symengine.github.io | docs/conf.py | # -- Project information -----------------------------------------------------
project = 'Symengine'
copyright = '2021, Symengine Development Team'
author = 'Symengine Development Team'
# The full version, including alpha/beta/rc tags
release = 'latest'
# -- General configuration -----------------------------------... |
maggiemaes/Methods-for-BAX-recruitment-analysis | analysis.py | from plotters import plot_bax_oligo, plot_dist_rate, plot_compiled_dist_rate, plot_agg_initiation, plot_oligo_rate_histo, plot_cytc, plot_scatter, plot_oligo_double_axis
import analysis_tools as tools
from scipy.spatial import distance
import matplotlib.pyplot as plt
import numpy as np
import data
import math
from iter... |
maggiemaes/Methods-for-BAX-recruitment-analysis | analysis_tools.py | <gh_stars>0
import numpy as np
from scipy.spatial import distance
from scipy.optimize import curve_fit
import csv
import math
def get_rows(fname, nheader):
counter = 0
rows = []
with open(fname, 'rU') as f:
csvrows = csv.reader(f, delimiter=',',quotechar='|')
for row in csvrows:
if counter > nhead... |
maggiemaes/Methods-for-BAX-recruitment-analysis | data.py | <reponame>maggiemaes/Methods-for-BAX-recruitment-analysis
bax_oligo_data = {}
#HCT WT 111114
# bax_oligo_data["111114_protocol154_cell1_Detailed"] = [28, 42, 45, 46, 65, 72, 239, 273, 456, 466, 468, 481]
# bax_oligo_data["111114_protocol153_cell2_Detailed"] = [28, 90, 152, 184, 187, 208, 217, 316]
# bax_oligo_data["... |
maggiemaes/Methods-for-BAX-recruitment-analysis | plotters.py | import matplotlib.pyplot as plt
import matplotlib.mlab as mlab
import analysis_tools as tools
import scipy.spatial as spatial
from scipy.stats import norm, rayleigh
from itertools import cycle
from scipy import stats
import numpy as np
from pylab import *
import matplotlib
def plot_bax_oligo(data, fit=True, verbose=F... |
Kislo-gif/P1ngPodg | P1ngPodg-main/Cool Game.py | from pygame import *
from random import randint
from time import time as timer
#Класс спрайта
class GameSprite(sprite.Sprite):
def __init__(self, player_image, w, h, player_x, player_y, player_speed):
sprite.Sprite.__init__(self)
self.image = transform.scale(image.load(player_image), (w, h)... |
natpacket/curl-impersonate | tests/conftest.py | def pytest_addoption(parser):
# Where to find curl-impersonate's binaries
parser.addoption("--install-dir", action="store", default="/usr/local")
parser.addoption("--capture-interface", action="store", default="eth0")
|
natpacket/curl-impersonate | tests/signature.py | <filename>tests/signature.py
import enum
import struct
import collections
from typing import List, Any
import yaml
# Special value to denote GREASE in various placements in the Client Hello.
# Intentionally negative so that it won't conflict with any real field.
TLS_GREASE = -1
class TLSVersion(enum.Enum):
# S... |
natpacket/curl-impersonate | tests/test_impersonate.py | <filename>tests/test_impersonate.py
import os
import io
import re
import logging
import subprocess
import yaml
import dpkt
import pytest
from signature import (
BrowserSignature,
TLSClientHelloSignature,
HTTP2Signature
)
@pytest.fixture
def browser_signatures():
with open("signatures.yaml", "r") as ... |
leonkozlowski/baseline | baseline/__init__.py | <filename>baseline/__init__.py
"""Top-level package for baseline."""
__author__ = """<NAME>"""
__email__ = "<EMAIL>"
|
leonkozlowski/baseline | baseline/d2v_logistic_regression.py | #!/usr/bin/env python
# coding: utf-8
# In[1]:
import re
import numpy as np
import pandas as pd
from gensim.models.doc2vec import Doc2Vec, TaggedDocument
from nltk.stem import PorterStemmer
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import train_test_split
from sklearn.preproc... |
leonkozlowski/baseline | baseline/wbn.py | #!/usr/bin/env python
# coding: utf-8
# In[1]:
import pickle
from sklearn.model_selection import train_test_split
from wbn.classifier import WBN
from wbn.object import Document, DocumentData, Documents
# In[2]:
# Load dataset
with open("../data/pr-newswire.pickle", "rb") as infile:
raw_data = pickle.load(in... |
leonkozlowski/baseline | baseline/tfidf_svm.py | #!/usr/bin/env python
# coding: utf-8
# In[1]:
import numpy as np
import pandas as pd
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import LabelEncoder
from sklearn.svm import SVC
# In[2]:
# load PR Newswire Annotated ... |
leonkozlowski/baseline | baseline/scripts.py | """Utility Modules."""
import argparse
import csv
import logging
import os
import pickle
from bson import ObjectId
from pymongo import MongoClient
from baseline.config import (
MONGODB_COL_ANNOTATION,
MONGODB_COL_CONTEXT,
MONGODB_CONNECTION,
MONGODB_WBN,
)
logging.basicConfig(level="INFO")
_LOGGER = ... |
leonkozlowski/baseline | baseline/words.py | <reponame>leonkozlowski/baseline
#!/usr/bin/env python
# coding: utf-8
# In[1]:
import itertools
import re
from collections import Counter
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import squarify
from baseline.config import STOP_WORDS
# In[2]:
# load PR Newswire Annotated Dataset
... |
coolshas124/cudpp | doc/bib/bib.py | #!/usr/bin/env python
import sys, os, re
# Generate all pubs from cudpp.bib; put refs into ref.txt
# This just generates a list of the cite keys from cudpp.bib into ref.txt.
os.system("bib2bib -oc ref.txt cudpp.bib")
# sort by reverse-date; don't generate keys; use cudpp.bst as bib style file
# writes into cudpp_ref... |
AlexH-UB/Citation-Tracker | constants.py | <reponame>AlexH-UB/Citation-Tracker
from os.path import expanduser, join, sep
# Constants
VERSION = "beta 1.0"
NAME = f"Alex's Citation Manager Version {VERSION}"
FONT_SIZE = 11
EXPLAIN_TEXT = f'Welcome to {NAME}. The purpose of this app is to help you keep track of your articles. When ' \
f'inserting ... |
AlexH-UB/Citation-Tracker | citation_tool.py | # External libraries
import subprocess
import sys
import json
import urllib.request
from bibtexparser.bparser import BibTexParser
from PyQt5.QtWidgets import QApplication, QDesktopWidget, QWidget
from time import asctime
from os import path, mkdir, rename
if sys.platform == "win32":
from os import startfile
# Ow... |
AlexH-UB/Citation-Tracker | GUI.py | from PyQt5.QtCore import Qt, QSize
from PyQt5.QtWidgets import QWidget, QPushButton, QLabel, QLineEdit, QGridLayout, QTextEdit, QCheckBox, \
QMainWindow, QListWidget, QTableWidget, QTableWidgetItem, QTableView, QComboBox, QFileDialog, QAction,\
QColorDialog, QMessageBox
from os import path
import sys
from PyQ... |
AlexH-UB/Citation-Tracker | core.py | class article:
def __init__(self, index: int, name: str, path: str, tags: list, access, bibtex: dict, relevance: int, note_path: str = ''):
"""An article is the basic storing unit of the tool.
:param index: all articles are indexed with numbers in ascending order
:param name: articles have... |
lucianoleite/med2image | med2image/color_map.py | mycolors = ( (0,0,0,0), (0,9/255.,204/255.,1), (0,214/255.,42/255.,1), (242/255.,217/255.,24/255.,1), (204/255.,129/255.,41/255.,1), (220/255.,24/255.,24/255.,1))
mycolors = ( (0,0,0,0),
(0.168841, 0.168841, 0.972549,1), # azul medio
(0, 0.837995, 0.164996,1), # verdinho
(0.949996, 0.850004, 0.0939956,1), #amarelinh... |
lucianoleite/med2image | med2image/med2image.py | # NAME
#
# med2image
#
# DESCRIPTION
#
# 'med2image' converts from medical image data files to
# display-friendly formats (like png and jpg).
#
# HISTORY
#
# 23 February 2015
# o Initial design and coding.
#
# System imports
import os
import glob
import numpy as np
import re
# System dependency i... |
BotMaid/BotMaid | plugins/sh.py | class pluginClass:
"""
直接执行 shell 命令
⚠️注意: 不要执行无法自动结束的命令"""
registCommand = "sh",
listenPlainMessage = False
listenChatAction = False
async def onCommandMessageReceivedListener(self, client, event, command, args):
import io
import subprocess
proc = subprocess.Popen(... |
BotMaid/BotMaid | plugins/id.py | class pluginClass:
"""打印相关 ID 信息"""
registCommand = "id",
listenPlainMessage = False
listenChatAction = False
async def onCommandMessageReceivedListener(self, client, event, command, args):
# chat = await event.get_chat()
# sender = await event.get_sender()
tempText = "chat_... |
BotMaid/BotMaid | plugins/keywords.py | <reponame>BotMaid/BotMaid
class pluginClass:
"""根据关键词回复
添加: keywords add <关键词>===<回复内容>
删除: keywords del <关键词>"""
registCommand = "keywords",
listenPlainMessage = True
listenChatAction = False
keywordsDict = {}
def __init__(self):
import os
import sqlite3
if not... |
BotMaid/BotMaid | userbot.py | api_id: int
api_hash: str
proxy: tuple
COMMAND_HEADER: str
disableCommandList: list
pluginDict: dict
class myInfo:
id: int
username: str
nickname: str
def start():
import os
from telethon import TelegramClient, events
import logging
client = TelegramClient('BotMaid', api_id, api_hash, p... |
BotMaid/BotMaid | plugins/help.py | class pluginClass:
"""~~你搁着套娃呢~~
help <插件名字> - 查看插件帮助信息"""
registCommand = "help",
listenPlainMessage = False
listenChatAction = False
async def onCommandMessageReceivedListener(self, client, event, command, args):
from userbot import pluginDict
if not args:
tempText... |
BotMaid/BotMaid | plugins/delete.py | class pluginClass:
"""删除回复的消息"""
registCommand = "del", "delete",
listenPlainMessage = False
listenChatAction = False
async def onCommandMessageReceivedListener(self, client, event, command, args):
if event.is_private:
await client.delete_messages(event.chat_id, event.message.re... |
BotMaid/BotMaid | plugins/example.py | class pluginClass:
"""这是说明"""
# 要注册的命令
registCommand = "example", "example1",
# 是否监听所有消息
listenPlainMessage = False
# 群聊事件(加群退群等)
listenChatAction = False
# 配置文件建议放在 configs 目录下
# 直接 configs/fileName 这样使用即可
async def onCommandMessageReceivedListener(self, client, event, comma... |
BotMaid/BotMaid | main.py | <filename>main.py
import configparser
import logging
import userbot
config = configparser.ConfigParser()
config.read("config.ini")
userbot.api_id = int(config["BotConfig"]["api_id"])
userbot.api_hash = config["BotConfig"]["api_hash"]
if config["BotConfig"]["useProxy"] == "True":
userbot.proxy = (
int(con... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.