seq_id
stringlengths
4
11
text
stringlengths
113
2.92M
repo_name
stringlengths
4
125
sub_path
stringlengths
3
214
file_name
stringlengths
3
160
file_ext
stringclasses
18 values
file_size_in_byte
int64
113
2.92M
program_lang
stringclasses
1 value
lang
stringclasses
93 values
doc_type
stringclasses
1 value
stars
int64
0
179k
dataset
stringclasses
3 values
pt
stringclasses
78 values
43536088674
import re import math import scipy.stats as stats from statsmodels.stats.multitest import multipletests import numpy as np import pandas as pd from tqdm import tqdm # import functools import pprint from mutagene.dna import ( nucleotides, complementary_nucleotide, bases_dict, # comp_dict, extended_nucl...
neksa/mutagene
mutagene/motifs/__init__.py
__init__.py
py
17,419
python
en
code
3
github-code
6
5221428710
def encode(s): k = '0123456789abcdefghijklmnopqrstuv' v = 0 vbits = 0 output = [] for c in s: v |= ord(c) << vbits vbits += 8 while vbits >= 5: output.append(k[v & 31]) v >>= 5 vbits -= 5 if vbits: output.append(k[v]) return ''.join(output) def decode(s): v = 0 ...
agl/dnscurve
tools/base32.py
base32.py
py
765
python
en
code
24
github-code
6
21836480019
import sys sys.stdin = open('../input.txt', 'r') def solve(d, next): global real if d == 7: if sum(real) == 100: print('\n'.join(map(str, sorted(real)))) sys.exit(0) else: for i in range(next, 9): if sum(real) <= 100: real.append(heights[i...
liza0525/algorithm-study
BOJ/boj_2309_seven_drwaf.py
boj_2309_seven_drwaf.py
py
452
python
en
code
0
github-code
6
7713977328
#!/usr/bin/python # -*- coding: utf-8 -*- from flask import Flask, render_template import platform import netifaces myApp = Flask(__name__) @myApp.route('/') def home(): data = {'user': 'ramy', 'machine':platform.node(), 'os':platform.system(), 'dist':platform.linux_distribution(), 'interfaces':netifaces.interfa...
RMDHMN/pythonFlash_testing
system-template.py
system-template.py
py
469
python
en
code
1
github-code
6
14765002641
from time import strftime from configuration_validation import extract_data from configuration_validation import configuration_validation_tool import os def main(): user_response = input('Do you want to search for all master.pmc files? [Y/N]\n') master_file_list = list() if user_response.lower() == 'y': ...
naderafsh/configuration_validation
configuration_validation/cable_labels.py
cable_labels.py
py
6,895
python
en
code
0
github-code
6
2642837677
def majorityElement(nums): # Moore’s Voting Algorithm n = len(nums) count = 0 element = None for i in range(n): if count == 0: count = 1 element = nums[i] elif element == nums[i]: count += 1 else: count -= 1 # Checking i...
ArunRawat404/DSA
Array/Medium/3. Majority Element.py
3. Majority Element.py
py
586
python
en
code
0
github-code
6
8167072903
from keras.callbacks import EarlyStopping, ModelCheckpoint from keras import regularizers import numpy as np import pandas as pd import math as math import sys import os import keras from keras.models import load_model from keras.layers import Dropout , Flatten from keras.layers import BatchNormalization from keras.pre...
muachilin/Machine-Learning
hw5/hw5_test.py
hw5_test.py
py
3,172
python
en
code
0
github-code
6
5200586519
""" This module contains the main transmittance/reflectance calculation bits. Users can run the calculations through `model.Model()` and avoid accessing `core` directly. """ import numpy as np import scipy as sp def rt_amp(index, delta, theta, pol): """Calculate the reflected and transmitted amplitudes through t...
anadolski/armmwave
armmwave/core.py
core.py
py
13,897
python
en
code
1
github-code
6
8762469387
from llm_rs import SessionConfig, GenerationConfig, Gpt2 class Chainer: _instance = None def __new__(cls): if cls._instance is None: cls._instance = super(Chainer, cls).__new__(cls) cls._instance.init_chainer() return cls._instance def init_chainer(self): s...
andri-jpg/termux-fa
lib.py
lib.py
py
1,917
python
en
code
2
github-code
6
45386585406
# -*- coding: utf-8 -*- #!/usr/bin/env python from theory.conf import settings from theory.utils.safestring import markSafe from theory.utils import six def format(number, decimalSep, decimalPos=None, grouping=0, thousandSep='', forceGrouping=False): """ Gets a number (as a number or string), and returns it...
grapemix/theory
theory/utils/numberformat.py
numberformat.py
py
1,639
python
en
code
1
github-code
6
4991495509
#!/usr/bin/python3 # enable debugging import cgi, cgitb import json import requests import responses cgitb.enable() class Expense: def __init__(self, exp_name,exp_date,exp_amount,exp_type): self.name = exp_name self.date = exp_date self.amount = exp_amount self.type = exp_type...
eliz-liu/money_site_html
form.py
form.py
py
795
python
en
code
0
github-code
6
31975617255
from django import template from ..models import Page register = template.Library() @register.simple_tag def main_menu(): "Query top-level pages" return Page.objects.with_tree_fields().filter( parent=None, is_active=True)
dnknth/feincms-demo
pages/templatetags/menus.py
menus.py
py
240
python
en
code
1
github-code
6
18801853357
import pytest from base.client_base import TestcaseBase from common import common_func as cf from common import common_type as ct from common.common_type import CaseLabel from utils.util_log import test_log as log # customer rg rg_name_0 = "RG_0" rg_name_1 = "RG_1" # coll name coll_name_1 = "ResourceGroup_111" coll_...
milvus-io/milvus
tests/python_client/chaos/testcases/test_chaos_resource_group.py
test_chaos_resource_group.py
py
9,886
python
en
code
24,190
github-code
6
39865467891
from IPython import get_ipython def type_of_script(): """ Detects and returns the type of python kernel :return: string 'jupyter' or 'ipython' or 'terminal' """ try: ipy_str = str(type(get_ipython())) if 'zmqshell' in ipy_str: return 'jupyter' if 'terminal' in i...
syj3514/MissingSat
befo231205/05b_get_involved_cpu.py
05b_get_involved_cpu.py
py
3,847
python
en
code
0
github-code
6
20841031996
from sklearn.model_selection import train_test_split from sklearn import svm def svm_classification(X, y, C_in, gamma_in, kernel_in): X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, shuffle=y, random_state=42) classifierSVM = svm.SVC(C=C_in, degree=2, gamma=gamma_in, kernel=kernel_in)...
mfaisalafandi/identification_teks_ulasan_svm
Klasifikasi.py
Klasifikasi.py
py
566
python
en
code
0
github-code
6
71474372027
# Rotating or flipping an image from PIL import Image def main(): image = Image.open('../lenna.png') image.show('Original') # Rotate 60 degrees counter clockwise rotated_image = image.rotate(60) rotated_image.show('Rotate 60') # Rotate using Image.transpose # Transpose supports these val...
gkostadinov/py-pil-imageprocessing
1-transformations/2.rotate.py
2.rotate.py
py
837
python
en
code
5
github-code
6
9411671299
from django.urls import path from . import views as blog_views # import users.views as user_views from .views import ( PostListView, PostDetailView, PostCreateView, PostUpdateView, PostDeleteView, UserPostListView ) urlpatterns = [ path('', PostListView.as_view(), name='blog-home'), ...
Coniferish/djangoTutorial
blog/urls.py
urls.py
py
935
python
en
code
0
github-code
6
35226084140
from __future__ import division # Our Backend for the App! # Built with Flask # Import Flask import flask import requests import os from flask import send_file import re import sys # Create the application app = flask.Flask(__name__) # serving home.html @app.route('/', methods=['GET']) def serve_page(): return ...
manichandra95151/TTSL
main.py
main.py
py
4,265
python
en
code
0
github-code
6
24312665302
from langdetect import detect def to_sentences(text): text = text.replace("\n", " ") sentences = [s + '.' for s in text.split(".") if s != ""] return sentences def divide(text, input_size=5000): """ Divide text into chunks of input_size Args: text (str): Text to be divided in...
hyunooss/SSUmmary
django-server/ssummary_site/modules/utils.py
utils.py
py
788
python
en
code
0
github-code
6
45375013026
""" include packages """ from settings import * import sqlite3 import discord from discord import app_commands import sys import signal import deepl from typing import Optional from lib import vote as vt from lib import deepl as dl """ Global variables """ connection : sqlite3.Connection = sqlite3.connect(D...
GrapeJuicer/GrapeBot
app/main.py
main.py
py
3,637
python
en
code
0
github-code
6
22807898242
# coding: utf8 """锁Lock 用于避免进程间对shared memory的争夺""" import multiprocessing import time def job(val, num, lo): lo.acquire() # 取得锁 for _ in range(10): time.sleep(0.1) val.value += num print(val.value) lo.release() # 释放锁 def multicore(): lo = multiprocessing....
sola1121/practice_code
python3/对于异步的例子/multiprocessing/6 multiprocessing lock锁.py
6 multiprocessing lock锁.py
py
752
python
en
code
0
github-code
6
26552257079
#!/usr/bin/env python3 ####################### # ACE3 Setup Script # ####################### import os import sys import shutil import platform import subprocess import winreg ######## GLOBALS ######### MAINDIR = "z" PROJECTDIR = "ace" CBA = "P:\\x\\cba" ########################## def main(): FULLDIR = "{}\\...
acemod/ACE3
tools/setup.py
setup.py
py
4,272
python
en
code
966
github-code
6
29074159051
from RepSys import Error, config from RepSys.util import execcmd from RepSys.VCS import * from os.path import basename, dirname from os import chdir, getcwd import sys import re import time from xml.etree import cElementTree as ElementTree import subprocess class GITLogEntry(VCSLogEntry): def __init__(self, revisi...
mdkcauldron/proyvinds-repsys
RepSys/git.py
git.py
py
2,133
python
en
code
0
github-code
6
44083632675
import gzip import inspect import os from io import StringIO from typing import Optional, List import numpy as np import pandas as pd def time_map(time_a: float, time_b: float, packet_a: int, packet_b: int, time_c: int, window_tolerance: int = 0) -> \ Optional[float]: """ Map an API time into a packet number. T...
llmhyy/malware-traffic
Experiments/exp16_visualisation/api_extraction.py
api_extraction.py
py
7,970
python
en
code
7
github-code
6
33360864969
# dicesimulation.py # The following code computes the exact probability distribution # for the sum of two dice: # probabilities = stdarray.create1D(13, 0.0) # for i in range(1, 7): # for j in range(1, 7): # probabilities[i+j] += 1.0 # for k in range(2, 13): # probabilities[k] /= 36.0 # After this code...
positronn/ippaida
chapter01/arrays/dicesimulation.py
dicesimulation.py
py
1,940
python
en
code
0
github-code
6
71119888509
import matplotlib.pyplot as plt import numpy as np # ~~~ DEFINE DATA ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ np.random.seed(1337) n = 1000000 x = np.random.standard_normal(n) y = x + .5 * np.random.standard_normal(n) hist, xedges, yedges = np.histogram2d(x, y, bins=100, density=True) hist[hist =...
braniii/prettypyplot
gallery/comparison_mpl.py
comparison_mpl.py
py
1,505
python
en
code
4
github-code
6
24091654897
from Film import Film from Forgalmazo import Forgalmazo import datetime def fajl_beolvas(): filmek = [] fp = open('nyitohetvege.txt', 'r', encoding='utf-8') lines = fp.readlines() fp.close() for line in lines[1:]: n_line = line.rstrip() (eredetiCim, magyarCim,bemutato,forgalmazo, ...
janos01/esti2020Python
gyakorlo/Nyito/src/OpeningWeekend.py
OpeningWeekend.py
py
3,940
python
hu
code
0
github-code
6
38416706519
import numpy as np class TrinomialModel(object): # Here we start defining our 'class' --> Trinomial Model! # First, a method to initialize our `TrinomialModel` algorithm! def __init__(self, S0, r, sigma, mat): self.__s0 = S0 self.__r = r self.__sigma = sigma self.__T = mat ...
piper-of-dawn/DE-GWP1
trinomial_pricing.py
trinomial_pricing.py
py
4,817
python
en
code
0
github-code
6
73591272829
# def funct1(nums): # """求从1加到nums的和""" # sum1 = 0 # for num in range(1, nums+1): # 使用循环遍历1到nums # sum1 += num # print(sum1) # # funct1(100) # # def max1(a, *numbers): # """求多个数中的最大值""" # num1 = a # 定义第一个数 # for num in numbers: # if num > num1: # 将a去比较后面的数 # ...
gilgameshzzz/learn
day7Python管理系统/作业.py
作业.py
py
2,719
python
en
code
0
github-code
6
35834788029
# https://codility.com/demo/results/training89TSCH-AEW/ def solution(X, A): # write your code in Python 2.7 N=len(A) lvs = dict.fromkeys(xrange(1,X+1),0) cnt=0 for i in xrange(N): x=A[i] if x > N+1: continue if lvs[x]==0: l...
peterkisfaludi/Codility
02-Counting-elements/frogriverone.py
frogriverone.py
py
412
python
en
code
0
github-code
6
40572545154
import os import csv candidate_dict = {} candidate_name = [] csvpath = os.path.join('Resources', 'election_data.csv') text = os.path.join('analysis', "Output.txt") print("Election Results") with open(text, "w+") as file: file.write("Election Results") with open(csvpath) as csvfile: # CSV reader specif...
David-Lucey/python-challenge
PyPoll/main.py
main.py
py
2,268
python
en
code
0
github-code
6
24584540912
# Use the file name mbox-short.txt as the file name fname = input("Enter file name: ") try: fh = open(fname) except: if fname == "na na boo boo": print ("NA NA BOO BOO TO YOU - You have been punk'd!") quit() else: print("file doesn't exist" ,fname) quit() total =...
cruzandfamily/Exercise-7
7_3.py
7_3.py
py
614
python
en
code
0
github-code
6
32043413373
import getpass import datetime import urllib, urllib.request import os, sys from random import randint from shutil import copyfileobj from html.parser import HTMLParser #Time, Right Now. now = datetime.datetime.now() #Get local username UserName = getpass.getuser() #Define End-Of-Script Quit-Action def quitting_time...
milesnielsen/DownloadEpisodesTAL
TAL_Epi_Download.py
TAL_Epi_Download.py
py
13,624
python
en
code
0
github-code
6
4657636922
import random print('Добро подаловать в числовую угадайку') def is_valid(number, gran): if gran.isdigit() and number.isdigit(): return int(number) in range(0, int(gran) + 1) def get_new_rand(gran): return random.randint(0, int(gran)) n, count = input('Введите границу интервала: '), 0 num, flag = ...
WeideR66/littlepythonprojects
ugadaika.py
ugadaika.py
py
1,741
python
ru
code
0
github-code
6
39290687517
#!/usr/bin/env python2 from __future__ import print_function from Bio import SeqIO import sys, vcf, getopt __author__ = 'Kumar' sample_number = int(0) vcf_file = '' a = int(0) x = int(0) n = int(0) position = int(0) fold = int() try: myopts, args = getopt.getopt(sys.argv[1:],"f:s:") for o, a in myopts: if o == ...
kumarsaurabh20/NGShelper
PopulationGenomics/vcf2sf.py
vcf2sf.py
py
1,109
python
en
code
0
github-code
6
35510723799
# Experiment 24 - Tile Movement # # By Chris Herborth (https://github.com/Taffer) # MIT license, see LICENSE.md for details. import base64 import os import pygame import pygame.freetype import pygame.gfxdraw import struct import sys import time import zlib from xml.etree import ElementTree SCREEN_TITLE = 'Experiment...
Taffer/pygame-experiments
24-tile-movement/main.py
main.py
py
14,875
python
en
code
2
github-code
6
7176111759
#!/usr/bin/env python3 import os import sys import re from pathlib import Path def _find_files(project_root): path_exclude_pattern = r"\.git($|\/)|venv|_build|\.tox" file_exclude_pattern = r"fill_template_vars\.py|\.swp$" filepaths = [] for dir_path, _dir_names, file_names in os.walk(project_root): ...
ethereum/py-evm
.project-template/fill_template_vars.py
fill_template_vars.py
py
2,362
python
en
code
2,109
github-code
6
20519832620
"""! @brief CCORE Wrapper for X-Means algorithm. @authors Andrei Novikov (pyclustering@yandex.ru) @date 2014-2020 @copyright BSD-3-Clause """ from ctypes import c_double, c_longlong, c_size_t, c_uint, POINTER from pyclustering.core.wrapper import ccore_library from pyclustering.core.pyclustering_pac...
annoviko/pyclustering
pyclustering/core/xmeans_wrapper.py
xmeans_wrapper.py
py
1,207
python
en
code
1,113
github-code
6
19250997206
import numpy as np import cv2 from matplotlib import pyplot as plt def SI(img, x, y, p): val = np.sum(img[y-p:y+p, x-p:x+p]) return min(max(val, 0), 255) #Read grayscale image and conversion to float64 img=np.float64(cv2.imread('../Image_Pairs/FlowerGarden2.png',0)) (h,w) = img.shape print("Image dimension:"...
gpspelle/image-mining
TP1/TP_Features_OpenCV/modified_Convolutions.py
modified_Convolutions.py
py
2,273
python
en
code
0
github-code
6
70613762747
# addtion of two numbers # printing integers x = 5 X = 6 y = 8 Y = 10 equation = (2*x+3*y)*(2*X+3*Y) print(equation) # printing strings small_alpha = "a" big_alpha = "A" print(small_alpha) print(big_alpha)
De-sam/Eccowas_College_Classes
sam_ss2/hello_world/variables.py
variables.py
py
209
python
en
code
0
github-code
6
39626332335
import numpy as np from flask import Flask, request, render_template import pickle app = Flask(__name__) model = pickle.load(open('model.pkl', 'rb')) @app.route('/') def home(): return render_template("index.html") @app.route('/predict',methods=['POST']) def predict(): label = "" sepallength = re...
Karthicksaga/IRIS
app.py
app.py
py
938
python
en
code
0
github-code
6
72690099708
import sys from antlr4 import * from xpathLexer import xpathLexer from xpathParser import xpathParser from MyErrorListener import MyErrorListener import io def main(argv): input = FileStream(argv[1], encoding = 'utf8') lexer = xpathLexer(input) lexer.removeErrorListeners() lexer.addErrorList...
bendrissou/glade-replication
antlr4/xpath/parse.py
parse.py
py
952
python
en
code
1
github-code
6
10422721293
from __future__ import annotations from enum import Enum from typing import TYPE_CHECKING, Any, TypeVar if TYPE_CHECKING: from collections.abc import Iterator T = TypeVar("T", bound=Enum) def iterate_enum(enum_class: type[T]) -> Iterator[T]: assert issubclass(enum_class, Enum) yield from enum_class d...
randovania/randovania
randovania/lib/enum_lib.py
enum_lib.py
py
739
python
en
code
165
github-code
6
11464353853
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Jun 7 13:18:01 2022 @author: sampasmann """ import time import numpy as np from mpi4py import MPI from src.functions.save_data import SaveData from src.solvers.fixed_source.solvers import Picard from src.solvers.eigenvalue.maps import MatVec_data, MatV...
spasmann/iQMC
src/solvers/eigenvalue/solvers.py
solvers.py
py
14,940
python
en
code
2
github-code
6
19209409927
import re import nltk from nltk.tokenize import word_tokenize from nltk.corpus import stopwords from nltk.stem import WordNetLemmatizer # Dictionary mapping word contractions to their full words contractions = { "ain't": "are not","'s":" is","aren't": "are not", "can't": "cannot","can't've": "canno...
kelvinchumbe/Hotel-Review-Mining-and-Web-App
Hotel Review Mining/Web App Deployment/api/preprocessing_utils.py
preprocessing_utils.py
py
4,650
python
en
code
0
github-code
6
71281284349
# mysql 테이블 생성 및 데이터 추가 import pandas as pd import pymysql xl_file = '/Users/JaehoByun/JB/_School/2021_2 데이터사이언스/과제및시험/score.xlsx' df = pd.read_excel(xl_file) conn = pymysql.connect(host='localhost', user='root', password='chunjay606', db='data_science') curs = conn.cursor(pymysql.cursors.DictCursor) ...
bjho606/python_school-data-science
score_assignment2.py
score_assignment2.py
py
1,130
python
en
code
0
github-code
6
14466536313
''' Given a collection of distinct integers, return all possible permutations. Example: Input: [1,2,3] Output: [ [1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2], [3,2,1] ] ''' class Solution: def permute(self, nums: List[int]) -> List[List[int]]: sol = [] self.backtrack(nums, 0, sol) ...
loganyu/leetcode
problems/046_permutations.py
046_permutations.py
py
671
python
en
code
0
github-code
6
30366445741
from traits.api import Bool, Instance, Float, Property # Local relative imports from .abstract_mapper import AbstractMapper from .data_range_1d import DataRange1D class Base1DMapper(AbstractMapper): """Defines an abstract mapping from a 1-D region in input space to a 1-D region in output space. """ ...
enthought/chaco
chaco/base_1d_mapper.py
base_1d_mapper.py
py
4,221
python
en
code
286
github-code
6
17635143913
from collections import Counter import pandas as pd def transform(new_subjects): list_keys = list(Counter(new_subjects).keys()) list_values = list(Counter(new_subjects).values()) df_keys = pd.DataFrame(list_keys, columns=['subject']) df_values = pd.DataFrame(list_values, columns=['frequency']) df...
ThomasKranz/arxiv_ETL
src/transformer.py
transformer.py
py
526
python
en
code
0
github-code
6
2725937228
n = int(input()) for _ in range(n): counter = 0 t = int(input()) tiros = [int(x) for x in input().split()] pulos = input() for j in range(t): if (tiros[j] <= 2 and pulos[j] == 'S') or (tiros[j] > 2 and pulos[j] == 'J'): counter += 1 print(counter)
wolney-fo/beecrowd
2-AD-HOC/python/beecrowd_1250.py
beecrowd_1250.py
py
304
python
en
code
1
github-code
6
40546336482
import dlib import os import numpy as np import matplotlib.pyplot as plt """ 此文件为正向人脸检测模块,采用dlib实现 """ def _shape_to_np(shape): xy = [] for i in range(68): xy.append((shape.part(i).x, shape.part(i).y,)) xy = np.asarray(xy, dtype='float32') return xy def get_landmarks(img, detector, predicto...
hamster1963/face-all-in-one-machine-backend
face_irobot_main/facial_feature_detector.py
facial_feature_detector.py
py
1,246
python
en
code
0
github-code
6
27103152939
from itertools import product import numpy as np import pytest from dcegm.pre_processing.params import process_params from numpy.testing import assert_array_almost_equal as aaae from scipy.special import roots_sh_legendre from scipy.stats import norm from toy_models.consumption_retirement_model.budget_functions import...
OpenSourceEconomics/dcegm
tests/test_budget_equation.py
test_budget_equation.py
py
2,269
python
en
code
15
github-code
6
910639080
import numpy as np from horton.io.utils import set_four_index_element __all__ = ['load_fcidump', 'dump_fcidump'] def load_fcidump(filename): '''Read one- and two-electron integrals from a Molpro 2012 FCIDUMP file. Works only for restricted wavefunctions. Keep in mind that the FCIDUMP format changed i...
theochem/horton
horton/io/molpro.py
molpro.py
py
4,488
python
en
code
83
github-code
6
39485957424
"""Модуль базы данных хранящей пользователей и их историю""" import datetime as dt from typing import Optional import enum from functools import cached_property import sqlalchemy as sa from sqlalchemy import create_engine, select, ForeignKey from sqlalchemy.orm import ( Session, DeclarativeBase, Mapped, ...
DemidovEvg/async_chat
src/nano_async_chat/async_chat/server/db.py
db.py
py
4,316
python
en
code
0
github-code
6
38435402089
import json import pandas def read_json(filename: list) -> dict: try: with open(filename, "r") as f: data = json.loads(f.read()) except: raise Exception(f"Reading {filename} file encountered an error") return data def create_dataframe(data: str) -> pandas.Dat...
PrasadWakle/jsontocsv
jsontocsv.py
jsontocsv.py
py
2,340
python
en
code
0
github-code
6
17977750270
import asyncio import pickle import unittest from typing import AbstractSet, Any, Mapping, Sequence, Union from testing.types import ( Digits, I32List, Integers, SetI32, StringBucket, StrStrMap, easy, hard, ) from thrift.py3.common import Protocol from thrift.py3.exceptions import Error...
WeilerWebServices/Facebook
fbthrift/thrift/lib/py3/test/serializer.py
serializer.py
py
8,534
python
en
code
3
github-code
6
8344742022
import numpy as np def Sigmoid(z): h = 1/(1+np.exp(-z)) return z def gradientDescent(x, y, theta, alpha, num_iter): m = x.shape[0] for i in range(0, num_iter): z = np.dot(x, theta) h = Sigmoid(z) J = (-1/m)*((np.dot(y.T, np.log(h))) + (np.dot((1-y).T, np.log(1-h)))) th...
Narayan-21/NLP-Specialization
Sentiment Analysis using logistic regression/utils.py
utils.py
py
404
python
en
code
0
github-code
6
32259974513
### SPDX-License-Identifier: GPL-2.0-or-later """Parse phc2sys log messages""" import re from collections import namedtuple from .parser import (Parser, parse_decimal) class TimeErrorParser(Parser): """Parse time error from a phc2sys log message""" id_ = 'phc2sys/time-error' elems = ('timestamp', 'terr...
redhat-partner-solutions/vse-sync-pp
src/vse_sync_pp/parsers/phc2sys.py
phc2sys.py
py
1,846
python
en
code
0
github-code
6
4159403258
import math import random import vector3 from rtweekend import random_double import multiprocessing from multiprocessing import Process, Array from ctypes import c_char_p from color import write_color from vector3 import vec3, random_in_hemisphere from ray import ray import rtweekend from hittable import hit_record f...
mk2510/ray_tracing_project
raytracing_in_a_weekend/main.py
main.py
py
4,391
python
en
code
0
github-code
6
75275385466
from datetime import datetime from time import process_time # file = open(address, mood) # with open('oi.txt', 'r', encoding='utf-8') as file: # content = file.read() # print(content) with open('log.txt', 'w', encoding='utf-8') as file: file.write('Horários de log dos funcionários') # with open('log...
ewertonpereira/python
test/testing.py
testing.py
py
1,302
python
en
code
2
github-code
6
7305140298
#!/usr/bin/python3 #author:@al_vyn #written: 25/06/2018 import csv #Create dictionaries lloyd = { "name": "Lloyd", "homework": [90.0, 97.0, 75.0, 92.0], "quizzes": [88.0, 40.0, 94.0], "tests": [75.0, 90.0] } alice = { "name": "Alice", "homework": [100.0, 92.0, 98.0, 100.0], ...
alvyn96/GradeBook
gradebook.py
gradebook.py
py
3,471
python
en
code
0
github-code
6
27315049620
import facebook from wordcloud import WordCloud, STOPWORDS import matplotlib.pyplot as plt import random token='EAACEdEose0cBAHYBMbXyW9HwyJJIeCFBaWXEcLjsp3N0vB5HZApZCxqm7KQvVxb4fgF2ZA8nh625ZBJR3NzCMGc3ApU1MyZCYBwVF85LWxqdaEdt3cNVaS0y9CYsY4DDUjGcUeDZB0TMZBJwqdEBCZBClU00PeeMqnWmMpZCWCUFGmp12hZBZA3mLilYc45...
aparnamnn/ACM-Project
wordclouds.py
wordclouds.py
py
1,101
python
en
code
0
github-code
6
8947958268
from django.db import models import ast class ListField(models.TextField): __metaclass__ = models.SubfieldBase description = "Stores a python list" def __init__(self, *args, **kwargs): super(ListField, self).__init__(*args, **kwargs) def to_python(self, value): if not value: ...
epkugelmass/USG-srv-dev
tigerapps/wintersession/models.py
models.py
py
3,678
python
en
code
null
github-code
6
39795452637
# coding=utf-8 import requests import re import execjs import json from bs4 import BeautifulSoup import smtplib from email.mime.text import MIMEText from email.utils import formataddr sendAddress = '' emailPsw = '' receiveAddress = '' username = '' psw = '' def loadConfig(): with open('config.json', 'r', encodin...
mawangdan/XMUDaliyReport
src/main.py
main.py
py
6,736
python
en
code
15
github-code
6
8502338250
import torch import torch.nn as nn from Descriptor import Descriptor from Recovery_Submodule import R_t, Pyramid_maxout class TR(nn.Module): # translucency recovery(TR) module def __init__(self, input_channel=3, beta=4, gamma=4): super(TR, self).__init__() self.D_t = Descriptor(input_channel, ...
linYDTHU/DesnowNet_Context-Aware_Deep_Network_for_Snow_Removal
network/DesnowNet.py
DesnowNet.py
py
3,956
python
en
code
15
github-code
6
25414336083
""" 2.12 Vison Local Server Test MIT 2.12 Intro To Robotics 2014 Daniel J. Gonzalez - dgonz@mit.edu """ serverIP = 'localhost' #Use if loopback testing on your own computer #serverIP = '192.168.1.212' #Use if this code is running over a 2.12 Server ################# DO NOT EDIT ANYTHING BELOW ###############...
skyleradams/tim-howard
Vision/testServer.py
testServer.py
py
1,577
python
en
code
5
github-code
6
7422093495
from operator import add from itertools import chain, combinations from functools import reduce import math import numpy as np from scipy import ndimage from tkinter import * class GF2(object): def __init__(self, a=0): self.value = int(a) & 1 def __add__(self, rhs): return GF2(self.val...
ThaumielSparrow/switch-solver
lights_on.py
lights_on.py
py
6,138
python
en
code
0
github-code
6
21253145382
from django.shortcuts import render from django.views.generic import View #导入View from django.http import HttpResponse from django.http import HttpResponseRedirect from wanwenyc.settings import DJANGO_SERVER_YUMING,MEDIA_ROOT from .models import RdmAutoStatic,RdmStatic,RdmConfig # Create your views here. #根据数据库内容自动...
wawj901124/shangbaogongju
apps/reportdatas/views.py
views.py
py
4,480
python
en
code
0
github-code
6
75177516346
from . import appsettings as local_settings from ..models import ProperName from .lexicalsort import lexicalsort from .utilities import json_safe, apostrophe_unmasker from .lemmalookup import lemma_lookup from .lightpospicker import light_pos_picker CORE_WORDS = local_settings.CORE_WORDS CALENDAR = local_settings.CAL...
necrop/wordrobot
apps/tm/lib/token.py
token.py
py
14,303
python
en
code
0
github-code
6
28585741124
import os import math BLOCK_SIZE = 16 UMAX = int(math.pow(256, BLOCK_SIZE)) def remove_line(s): # returns the header line, and the rest of the file return s[:s.index('\n') + 1], s[s.index('\n')+1:] def parse_header_ppm(f): data = f.read() header = "" for i in range(3): header_i, data = remove_line(data) ...
VermillionBird/CTF-Writeups
2019/picoCTF/Cryptography/AES-ABC/deabc.py
deabc.py
py
1,299
python
en
code
8
github-code
6
10423084331
#-*- coding: utf-8 -*- """ Provides a class that tracks the state of a validation process across schema members. @author: Martí Congost @contact: marti.congost@whads.com @organization: Whads/Accent SL @since: June 2008 """ from cocktail.modeling import DictWrapper from cocktail.schema.accessors import get undefin...
marticongost/cocktail
cocktail/schema/validationcontext.py
validationcontext.py
py
4,068
python
en
code
0
github-code
6
73674401786
def registro(bd): nombre = input("Ingrese el nombre de usuario: ") contrasenia = input("Ingrese la contraseña: ") bd[nombre] = contrasenia def leerData(bd): print("La informacion almacenada en la base de datos es: ") for usu, contra in bd.items(): print(f"{usu}: {contra}") def guar...
DanielFranco92/pre-entrega
main.py
main.py
py
1,036
python
es
code
0
github-code
6
73027941309
from google.cloud import storage import os input_folder = "../Crop_Reports/Bengal Gazettes Chunks/" bucket_name = "calcutta-gazette" def explicit(bucket_name, source_name, path): # Explicitly use service account credentials by specifying the private key # file. storage_client = storage.Clie...
jgoman99/British-Bengal-Weekly-Crop-Reports
Python Code/splits_to_cloud.py
splits_to_cloud.py
py
1,067
python
en
code
0
github-code
6
38046769762
#word guessing game in python import random def choose_random_word(): words = ['rainbow', 'computer', 'science', 'programming', 'python', 'mathematics', 'player', 'condition', 'reverse', 'water', 'board', 'geeks'] return random.choice(words) def display_word(word, guesses): ...
akshaybannatti/Word-Guessing-Game-Python
#word guessing game in python.py
#word guessing game in python.py
py
1,372
python
en
code
0
github-code
6
16586269759
from flask import Blueprint, render_template from app.models import Post home = Blueprint('home', __name__) @home.route('/') def index(): posts = Post.query.filter_by(published=True).all() return render_template('home/index.html', posts=posts)
rg3915/flask-masterclass
app/blueprints/home_blueprint.py
home_blueprint.py
py
256
python
en
code
1
github-code
6
11692218331
#1 celegans_phenotypes = ['Emb', 'Him', 'Unc', 'Lon', 'Dpy', 'Sma'] for phenotype in celegans_phenotypes: print(phenotype) #2 half_lives = [87.74, 24110.0, 6537.0, 14.4, 376000.0] for value in half_lives: print(value, end='') #3 more_whales = [5, 4, 7, 3, 2, 3, 2, 6, 4, 2, 1, 7, 1,3] more_whales...
LDavis21/Assignments.github.io
assignment4/PPch9.py
PPch9.py
py
2,541
python
en
code
0
github-code
6
22400150737
from PyQt5.QtWidgets import * from PyQt5.QtCore import pyqtSignal, pyqtSlot, QModelIndex,QItemSelectionModel from diz import * import sys from BD import Orm from dialog import Dialog from dizain1_2 import TwoWindow from dialog2 import Dialog2 bd = Orm() class InputDialog(QtWidgets.QDialog): def __init__(self, ro...
Vorlogg/BD
dizain.py
dizain.py
py
5,829
python
ru
code
0
github-code
6
29579809040
# -*- coding: utf-8 -*- """ Created on Fri Dec 7 11:04:13 2018 @author: Akitaka """ # 1:ライブラリのインポート-------------------------------- import numpy as np #numpyという行列などを扱うライブラリを利用 import pandas as pd #pandasというデータ分析ライブラリを利用 import matplotlib.pyplot as plt #プロット用のライブラリを利用 from sklearn import linear_model, metr...
nakanishi-akitaka/python2018_backup
1207/ml2b.py
ml2b.py
py
3,157
python
ja
code
5
github-code
6
21424331672
''' 1. Парсер однопоточный. 2. Замер времени 3. Multiprocessing Pool 4. Замер времени 5. Экспорт в csv ''' import requests from bs4 import BeautifulSoup from datetime import datetime from multiprocessing import Pool import csv import time def get_html(url): r = requests.get(url) # Response re...
DexterAkaGrich/potential-couscous
first_meet.py
first_meet.py
py
1,849
python
en
code
0
github-code
6
31858846976
#!/bin/python3 import os def isBalanced(brackets): stack = [] for bracket in brackets: if bracket in ['{', '[', '(']: stack.append(bracket) else: if len(stack) == 0: return 'NO' last = stack.pop() isCurly = bracket == '}' and l...
caioportela/code-challenges
hackerrank/problem-solving/balanced-brackets.py
balanced-brackets.py
py
860
python
en
code
0
github-code
6
20656199478
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Create a Milo input file from a frequency calculation. It must be a Gaussian 09 or 16 high-precision frequency calculation. You request this with '# freq=(hpmodes) ... '. """ import argparse import sys from milo_1_0_3 import atom from milo_1_0_3 import containers fr...
DanielEss-lab/milo
milo_1_0_3/tools/parse_frequencies.py
parse_frequencies.py
py
13,885
python
en
code
3
github-code
6
2534129469
# -*- coding: utf-8 -*- """ Geometric transformations on 3D point cloud. Created on Wed Apr 10 11:00:00 2019 Author: Prasun Roy | CVPRU-ISICAL (http://www.isical.ac.in/~cvpr) GitHub: https://github.com/prasunroy/sign-language """ import copy import math import numpy as np class Transforms3D(object): @stat...
prasunroy/sign-language
transforms.py
transforms.py
py
2,810
python
en
code
0
github-code
6
30085050335
from django.shortcuts import render from django.http import JsonResponse from category.models import Category # Create your views here. def jsons(data = None, errorCode = 0, cookies = ''): if data is None: data = [] return JsonResponse({'errorCode': errorCode, 'data': data, 'cookies': cookies}) d...
jeremyytann/BUAA-SE-LetStudy
Code/backend/category/views.py
views.py
py
456
python
en
code
0
github-code
6
40333302045
#import pyperclip import csv import write_cv_main_functions as wc #### grants and awards CV data def compile_teaching(teaching_file, table_spacing,lwidth,rwidth): teaching_txt=wc.header_setup('Teaching Experience', table_spacing,lwidth,rwidth, False) teaching_dict=wc.convert_csv_to_dict(teaching_file,'Sortin...
hdbray/cv_builder
write_cv_teaching.py
write_cv_teaching.py
py
3,742
python
en
code
1
github-code
6
19788096058
from typing import TYPE_CHECKING, Any, Dict, Optional, Tuple from uuid import uuid4 import pygame from .clock import Clock, clock from .keyboard import Keyboard from .screen import Screen from .utils.event_dispatcher import EventDispatcher if TYPE_CHECKING: from .application import Application class Scene(Even...
kdeyev/pgz
pgz/scene.py
scene.py
py
9,429
python
en
code
4
github-code
6
24605950735
import logging from Common import removeLinkID class Group(object): def __init__(self, DB): self.DB = DB def __call__(self, msg): if not msg.isGroup(): msg.Reply("This function only for group.") elif len(msg.args) != 1 or msg.args[0] not in ('this', 'all'): msg.Reply("Invalid arguments.\nUse: /unlink gr...
hans00/MessageBot
Features/Unlink/Group.py
Group.py
py
1,624
python
en
code
0
github-code
6
8629709747
from flask import Flask,request app = Flask(__name__) @app.route('/') def home(): return "Bem-Vindo" @app.route('/calculo') def add(): a = 10 b = 10 return str(a+b) if __name__ == '__main__': app.run()
kaibernu/MLDeploy
API.py
API.py
py
231
python
en
code
2
github-code
6
71361812987
import sys import mysql.connector from awsglue.utils import getResolvedOptions params = [ 'db_host', 'db_port', 'db_user', 'db_password', 'db_database', 'ticket_id_to_be_updated' ] args = getResolvedOptions(sys.argv, params) cnx = mysql.connector.connect( host=args['db_host'], port=ar...
bhavik161/studio
rds/rds_upsert_data.py
rds_upsert_data.py
py
1,200
python
en
code
0
github-code
6
22020962951
from pathlib import Path import matplotlib.pyplot as plt import pandas as pd import rich import seaborn as sns import typer from boiling_learning.app.configuration import configure from boiling_learning.app.datasets.bridged.boiling1d import DEFAULT_BOILING_OUTLIER_FILTER from boiling_learning.app.datasets.preprocesse...
ruancomelli/boiling-learning
boiling_learning/app/studies/data_split.py
data_split.py
py
2,677
python
en
code
7
github-code
6
71365190588
import torch from torchvision import transforms from torch.autograd import Variable from dataset import DatasetFromFolder from model import Generator import utils import argparse import os parser = argparse.ArgumentParser() parser.add_argument('--dataset', required=False, default='facades', help='input dataset') parse...
togheppi/pix2pix
pix2pix_test.py
pix2pix_test.py
py
2,081
python
en
code
46
github-code
6
44938119316
import numpy as np import redis import struct import cv2 import time import curved_paths_coords as pc from threading import Thread r = redis.Redis(host='192.168.0.101', port=6379, db=0) log_sensing_running =\ log_navigation_running =\ log_batterymeter_running =\ log_driving_running =\ log_detect_cam =\ voltages1_and_2...
julianx4/skippycar
test.py
test.py
py
8,784
python
en
code
3
github-code
6
33273926923
from PDBParseBase import PDBParserBase #get_site_header_seq_info import time, os,datetime,logging,gzip,pickle #get_site_header_seq_info def mkdir(path): #Created uncompress path folder isExists=os.path.exists(path) if not isExists: os.makedirs(path) print(path + " Created folder suce...
Rio56/deeplearning
DTP_deeplearning/0618_新数据处理代码及文件/drug_target_data_0617.py
drug_target_data_0617.py
py
15,010
python
en
code
1
github-code
6
22635248553
class Tree: def __init__(self, height): self.height = height self.visible = False def __repr__(self): return str(self.visible) trees = [] with open('8.input') as f: lines = f.readlines() for line in lines: treeline = [] for char in line.strip(): treeline.append(...
mouseboks/AoC2022
8.py
8.py
py
1,346
python
en
code
0
github-code
6
40319402697
from ansible.module_utils.basic import AnsibleModule from ansible_collections.ansibleguy.opnsense.plugins.module_utils.base.api import \ Session from ansible_collections.ansibleguy.opnsense.plugins.module_utils.base.cls import GeneralModule class General(GeneralModule): CMDS = { 'set': 'set', ...
ansibleguy/collection_opnsense
plugins/module_utils/main/frr_bgp_general.py
frr_bgp_general.py
py
1,066
python
en
code
158
github-code
6
20861131743
import requests import os import wget import subprocess def update_mindustry(): global response global be_wrapper global current_build download_url = "https://github.com/Anuken/MindustryBuilds/releases/download/" + str(current_build) download_url = download_url + "/Mindustry-BE-Desktop-" + str(cu...
ILiekMelons/MindustryBELauncher
main.py
main.py
py
1,958
python
en
code
0
github-code
6
1639327865
# coding=utf-8 """ Controller for the pre-processing, and creation of the trainable data sets. """ from sequenceprocessjson import process_json from os.path import join from json import load # File and directory locations. DATA_DIR = "data" VIDEO_FILE = "YoutubeVideos" TRAINING_MODIFIER = "_training" VALIDATION_MODI...
joshbrun/ExerciseDataCollection
Modelling/LSTM/controller.py
controller.py
py
892
python
en
code
2
github-code
6
1478963521
import numpy, math, itertools from hashlib import sha1 from mbfit.exceptions import XYZFormatError, InvalidValueError, InconsistentValueError from .fragment import Fragment class Molecule(object): """ Stores the fragments of a Molecule """ def __init__(self, fragments): """ Creates a...
paesanilab/MB-Fit
mbfit/molecule/molecule.py
molecule.py
py
44,981
python
en
code
14
github-code
6
17870516114
from src.costco.CostcoItem import CostcoItem from src.smartstore.CostcoRegister import SmartStoreItemRegister from src.utills import Utills # 코스트코 아이템을 정보를 읽어와 스마트스토어에 작성하는 실행 로직 def excute(): webDriverPath = '/Users/tak/tak/python/crawling-dev/chromedriver' driver = Utills.getChromeDriver(webDriverPath) ...
geontark/crawling-dev
src/excute/CostcoRegisterExcute.py
CostcoRegisterExcute.py
py
1,129
python
en
code
2
github-code
6
73823061627
class Interval(object): def __init__(self, start, end): self.start = start self.end = end def can_attend_meetings(intervals): intervals.sort(key=lambda i: i.start) for i in range(1, len(intervals)): if intervals[i].start < intervals[i - 1].end: return False return...
jateen67/leetcode
intervals/easy/252_meeting_rooms.py
252_meeting_rooms.py
py
466
python
en
code
0
github-code
6
20677953442
from django.test import TestCase from django.urls import reverse from apps.shop.models import Product from apps.users.models import CustomUser from .models import Order test_order = {"name": "Django Django", "email": "django@django.some", "paid": True} test_product = { "name": "Test Product", "abbr": "TEPR"...
akundev/akundotdev
apps/orders/tests.py
tests.py
py
2,822
python
en
code
0
github-code
6