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
42014841225
# power = gamma rate * epsilon rate ( ? ) # gamma = each bit is the most common bit in column of numbers # epsilon: least common rate, or rather the inv of gamma import numpy as np file = 'input' with open(file) as infile: lines = infile.readlines() vals = [[int(v) for v in line.strip()] for line in lines if...
halvarsu/advent-of-code
2021/day3/run.py
run.py
py
1,800
python
en
code
0
github-code
13
14278121916
import bpy from mathutils import * bl_info = { "name": "Tila : Object Duplicate", "author": "Tilapiatsu", "version": (1, 0, 0, 0), "blender": (2, 80, 0), "location": "View3D", "category": "Mesh", } class TILA_ObjectDuplicateOperator(bpy.types.Operator): bl_idname = "object.tila_duplicate" bl_label = "TI...
Tilapiatsu/blender-custom_config
scripts/startup/tila_OP_ObjectDuplicate.py
tila_OP_ObjectDuplicate.py
py
1,317
python
en
code
5
github-code
13
3230536704
def saddle_points(matrix): if len(set([len(i) for i in matrix])) != 1 and len(matrix) != 0: raise ValueError('Irregular matrix given') cols = [i for i in zip(*matrix)] saddles = [] for row_num, row in enumerate(matrix): for col_num, val in enumerate(row): row_check = all(val ...
johncornflake/exercism
python/saddle-points/saddle_points.py
saddle_points.py
py
570
python
en
code
0
github-code
13
42096630478
from sys import stdout n = int(input()) ne = (1, 1) no = (1, 2) def move_ne(b): global ne i, j = ne print(b, i, j) stdout.flush() if i <= n and j + 2 <= n: ne = (i, j + 2) elif i + 1 <= n: if (i + 1) % 2 == 1: ne = (i + 1, 1) else: ne = (i + 1,...
keijak/comp-pub
cf/contest/1503/B/main.py
main.py
py
893
python
en
code
0
github-code
13
37274100892
__author__ = 'DafniAntotsiou' import numpy as np from copy import deepcopy # native functions currently not working on windows def get_joint_qpos(sim, name): addr = sim.model.get_joint_qpos_addr(name) if not isinstance(addr, tuple): return sim.data.qpos[addr] else: start_i, end_i = addr ...
DaphneAntotsiou/Adversarial-Imitation-Learning-with-Trajectorial-Augmentation-and-Correction
cat_dauggi/functions.py
functions.py
py
1,669
python
en
code
1
github-code
13
24534419600
def longestPalindrome(s: str) -> str: def is_palindrome(s): l = 0 r = len(s)-1 while l < r: if s[l] == s[r]: l += 1 r -= 1 else: return False return s if len(s) == 1: return s elif is_palindrome(...
Hintzy/leetcode
Medium/5_longest_palindrome_substring/longest_palindrome_substring.py
longest_palindrome_substring.py
py
1,645
python
en
code
0
github-code
13
2869735068
import numpy as np import pickle import numpy.random as npr import os import sys import argparse import tensorflow as tf import traceback #my imports from pddm.utils.helper_funcs import create_env from pddm.utils.helper_funcs import get_gpu_config from pddm.policies.policy_random import Policy_Random from pddm.utils.l...
google-research/pddm
pddm/scripts/eval_iteration.py
eval_iteration.py
py
6,154
python
en
code
89
github-code
13
22040633583
import sys from awsglue.transforms import * from awsglue.utils import getResolvedOptions from pyspark.context import SparkContext from awsglue.context import GlueContext from awsglue.job import Job import time import pg8000 import boto3 import re from decimal import * import extract_rs_query_logs_functions as functions...
aws-samples/aws-big-data-blog
aws-blog-retain-redshift-stl/scripts/extract_rs_query_logs.py
extract_rs_query_logs.py
py
5,977
python
en
code
895
github-code
13
5416581537
from datetime import timedelta from aiogram import types, F, Router, Dispatcher from aiogram.filters import Command, CommandStart from db import add_new_user, add_message_to_queue, get_last_time, get_timeleft from aiogram.fsm.context import FSMContext from aiogram.fsm.state import State, StatesGroup from aiogram.types ...
Vivatist/SendNewsBot
handlers.py
handlers.py
py
2,260
python
en
code
0
github-code
13
39357266394
from sklearn.ensemble import RandomForestClassifier from sklearn.metrics import confusion_matrix, classification_report from sklearn.metrics import precision_recall_fscore_support as score from sklearn.preprocessing import StandardScaler from sklearn.model_selection import train_test_split, RandomizedSearchCV, cross_va...
ey96/DataScienceBikesharing
nextbike/model/classification/random_forest_class.py
random_forest_class.py
py
7,381
python
en
code
0
github-code
13
32215017700
import json import os from collections import Counter import matplotlib.pyplot as plt import requests from bs4 import BeautifulSoup from scipy.stats import norm url = "https://ctftime.org/event/2040" headers = { "User-Agent": "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) C...
ashiven/enosimulator
util/scoreboard_analysis.py
scoreboard_analysis.py
py
7,718
python
en
code
0
github-code
13
23301915315
""" -------------------------- chipFish, part of chipFish (c) 2008-2019 oAxiom -------------------------- Main app entry NOTES: ------ """ import sys, os, copy, re, shlex import opt, gDraw from glbase_wrapper import glload, location, format, flat_track, genelist, genome_sql from error import * from genome_data ...
oaxiom/chipFish
app.py
app.py
py
7,967
python
en
code
1
github-code
13
24993051153
from math import log2 hexa = "0123456789ABCDEF" def doi_co_so(n, b): step = int(log2(b)) while len(n)%step != 0: n = '0' + n for i in range(0, len(n), step): token = 0 for j in range(i, i+step): if n[j] == '1': token += pow(2, step - j%step - 1) ...
thethanh02/python3
WA/PYKT086.py
PYKT086.py
py
693
python
en
code
1
github-code
13
26883671925
#!/usr/bin/python # -*- coding: utf-8 -*- from datetime import datetime from typing import Union, Generator, AsyncGenerator, Optional, Dict from isodate import parse_duration from dateutil import parser from dtran.argtype import ArgType from dtran.ifunc import IFunc, IFuncType from dtran.dcat.api import DCatAPI from ...
mintproject/MINT-Transformation
funcs/readers/dcat_range_stream.py
dcat_range_stream.py
py
2,513
python
en
code
3
github-code
13
71071866259
from utils.globals import CMR_FILE_URL import re import math from urllib.parse import urlparse import os import sys import itertools def build_version_query_params(version): desired_pad_length = 3 if len(version) > desired_pad_length: print('Version string too long: "{0}"'.format(version)) qui...
stjimreal/Modis_Scrapy
utils/utilities.py
utilities.py
py
4,767
python
en
code
4
github-code
13
4321291461
############################################################################## # Copyright (C) 2018, 2019, 2020 Dominic O'Kane ############################################################################## import sys sys.path.append("..") from financepy.utils.math import ONE_MILLION from financepy.utils.date ...
domokane/FinancePy
tests/test_FinBond.py
test_FinBond.py
py
12,173
python
en
code
1,701
github-code
13
33175519967
# this test programme takes 30 photos and saves them to a folder from picamera import PiCamera # raspberry pi cameraexit from config import * import dropbox # for uploading to dropbox, `pip3 install dropbox` import subprocess from glob import glob # for the file upload process from time import sleep, strftime # t...
llewmihs/sunrise300
Development/take30.py
take30.py
py
1,514
python
en
code
1
github-code
13
36436698425
from .log import die, printi, printw from .input_types import type_check_kle_layout from .lazy_import import LazyImport from .util import dict_union, key_subst, rem, safe_get from .yaml_io import read_yaml from math import cos, radians, sin from types import SimpleNamespace from re import match Matrix:type = LazyImpor...
TheSignPainter98/adjust-keys
adjustkeys/layout.py
layout.py
py
9,837
python
en
code
14
github-code
13
74811481616
""" Functions to load and save data. Some general, some specific to given predictive_network subclasses """ import numpy as np import ntpath import tables import sys import os import pickle as pkl FLOATX = 'float32' RANDOM_SEED = 12345 def load_pickled_data(load_path): load_path = os.path.expanduser(load_path) ...
yossing/distributed_grid_search
data_handling.py
data_handling.py
py
13,605
python
en
code
0
github-code
13
38829313547
#!/usr/bin/env python3 # Standard library imports import random # Remote library imports from faker import Faker from datetime import datetime import re # Local imports from app import app from models import db, User, City, Location,CityNote,LocationNote if __name__ == '__main__': faker = Faker() with app....
jordandc20/Vicariously_DJordan-capstone
server/seed.py
seed.py
py
6,512
python
en
code
0
github-code
13
4692893333
import numpy as np import matplotlib.pyplot as plt from mpl_toolkits import mplot3d data = np.unpackbits(np.load("Earth.npy")).reshape(2160, 4320) def Uniform_draw_Q1(): """Random number generator""" theta = np.random.randint(0, 2159) phi = np.random.randint(0, 4319) return theta, phi ...
Sheldonsu28/PHY407-Computational-Physics
Lab 10/Lab10Q1.py
Lab10Q1.py
py
1,807
python
en
code
0
github-code
13
31941921020
class Node: def __init__(self, x: int, next: 'Node' = None, random: 'Node' = None): self.val = int(x) self.next = next self.random = random class Solution: def copyRandomList(self, head: 'Node') -> 'Node': if not head: return node = head while node:...
wylu/leetcodecn
src/python/offer/35.复杂链表的复制.py
35.复杂链表的复制.py
py
795
python
zh
code
3
github-code
13
31086753879
import logging from twisted.internet import defer, reactor, task from twisted.protocols.basic import LineReceiver from exceptions import TimeoutException logger = logging.getLogger('pymdb') def pretty(data): return ' '.join(["0x%0.2X" % ord(c) for c in data]) def encode(command, data=''): return chr(len(...
aborilov/pymdb
pymdb/protocol/mdb.py
mdb.py
py
3,030
python
en
code
6
github-code
13
70193693457
def sum_divisors(num): divs = [] for x in range(1, (num // 2 + 1)): if num % x == 0: divs.append(x) return sum(divs) def is_abundant(num): if sum_divisors(num) > num: return True else: return False abundants = [] for n in range(1, 28124): if is_abundant(n)...
aryanmalik567/ProjectEuler
Problems 20 - 29/Problem 23.py
Problem 23.py
py
620
python
en
code
0
github-code
13
72147041618
import sys from softlearning.policies.utils import ( get_policy_from_variant, get_policy_from_params, get_policy) from softlearning.models.utils import ( get_reward_classifier_from_variant, get_dynamics_model_from_variant) from softlearning.misc.generate_goal_examples import ( get_goal_example_from_variant,...
abhishekunique/RND-ashwin
examples/classifier_rl/main.py
main.py
py
6,261
python
en
code
0
github-code
13
71545583059
import config import matplotlib.pyplot as plt import torchvision import torch # 加载PGAN预训练模型 model = torch.hub.load("facebookresearch/pytorch_GAN_zoo:hub", "PGAN", model_name="celebAHQ-512", pretrained=True, useGPU=config.USE_GPU) # 样本随机噪声向量 (noise, _) = model.buildNoiseData(config.NUM_IMAGES) # 将采样的噪声向量通过预训练的生成器 wi...
bashendixie/ml_toolset
案例72 基于Torch Hub的渐进式GAN架构/predict.py
predict.py
py
860
python
en
code
9
github-code
13
16031681997
import numpy as np import torch from hypothesis.metric import BaseValueMetric class ExponentialAverageMetric(BaseValueMetric): r"""""" def __init__(self, initial_value=None, decay=.99): super(ExponentialAverageMetric, self).__init__(initial_value) self.decay = decay def update(self, va...
montefiore-ai/hypothesis
hypothesis/metric/exponential_average.py
exponential_average.py
py
591
python
en
code
47
github-code
13
10927700118
import torch from networkx.classes.reportviews import NodeView from torch.nn import Module from typing import Union, Iterator, Callable, Tuple, Optional from .nodes import RateNet, SpikeNet, InstantNode from .edges import RLS, Linear, LinearMasked from .utility import retrieve_from_dict, add_op_name from .observer impo...
pyrates-neuroscience/RectiPy
rectipy/network.py
network.py
py
48,772
python
en
code
3
github-code
13
43114674432
def find_parent(parent, x): if parent[x] != x: parent[x] = find_parent(parent, parent[x]) return parent[x] def union_parent(parent, a, b): a = find_parent(parent, a) b = find_parent(parent, b) if a < b: parent[b] = a else: parent[a] = b n = int(input()) parent = [0] * (n + 1) edges = [] resul...
jinhyungrhee/Problem-Solving
NDB/NDB_1844_행성터널★.py
NDB_1844_행성터널★.py
py
1,298
python
ko
code
0
github-code
13
34649908863
import tkinter as tk #window now has all the properties of tkinter window = tk.Tk() # title of label window.title("My APP") # size of window window.geometry("400x350") # LABELS title = tk.Label(text="Hello world. \nWelcome to my app", font=("Garamond", 20)) title.grid() # Entry field entry_field = tk.Entry() entr...
MarkCrocker/Python
myapp.py
myapp.py
py
566
python
en
code
0
github-code
13
20296453634
""" desitarget.targetmask ===================== This looks more like a script than an actual module. """ import os.path from desiutil.bitmask import BitMask import yaml from pkg_resources import resource_filename def load_mask_bits(prefix=""): """Load bit definitions from yaml file. """ us = "" if le...
desihub/desitarget
py/desitarget/targetmask.py
targetmask.py
py
3,973
python
en
code
17
github-code
13
16809597624
from __future__ import annotations import json import subprocess import textwrap from pathlib import Path from typing import Any import pytest from hypothesistooling.projects.hypothesispython import HYPOTHESIS_PYTHON, PYTHON_SRC from hypothesistooling.scripts import pip_tool, tool_path PYTHON_VERSIONS = ["3.7", "3....
HypothesisWorks/hypothesis
whole-repo-tests/test_pyright.py
test_pyright.py
py
6,659
python
en
code
7,035
github-code
13
73341878416
import os import numpy as np import pandas as pd import simplejson as json import requests import quandl import bokeh from bokeh.embed import components from bokeh.layouts import gridplot from bokeh.plotting import figure, show, output_file,save from flask import Flask,render_template,request, redirect # ------------...
tukichen/stock-price
app.py
app.py
py
4,171
python
en
code
1
github-code
13
72829488979
import bpy from ... base_types import AnimationNode from bpy.props import * from ... events import propertyChanged import pygame.mixer as pgm pgm.init() class AudioPlayNode(bpy.types.Node, AnimationNode): bl_idname = "an_AudioPlayNode" bl_label = "AUDIO Play Music File" bl_width_default = 200 message ...
Clockmender/My-AN-Nodes
nodes/audio/audio-play.py
audio-play.py
py
1,379
python
en
code
16
github-code
13
41759091969
from flask import Flask,jsonify,request app = Flask(__name__) studentdetails = [{'name':"Teja Kishore","email" : "ytkishore7@gmail.com","id" : 1}] @app.route("/",methods = ["GET"]) def home(): return ("Welcome") @app.route("/details", methods = ["GET"]) def readAll(): return jsonify ({"studentdetails"...
teja-kishore/rest_api_python
rest_api_crud.py
rest_api_crud.py
py
1,404
python
en
code
0
github-code
13
39989055832
#script to preprocess the youtube trailer data output from youtube_scraper.py #get Youtube trailer data (release date, views, likes, dislikes) import pandas as pd import numpy as np import pickle #get metadata from the Movie Database df_full = pd.read_csv('data/movies_metadata.csv') #here is a dict to quic...
zhuozhi-ge/Movie-Success-Prediction-with-Trailers
crawlers/youtube_preprocessing.py
youtube_preprocessing.py
py
3,637
python
en
code
1
github-code
13
15628496633
import os from datetime import date, datetime from decimal import Decimal from dotenv import load_dotenv from fastapi import FastAPI from tortoise.contrib.fastapi import register_tortoise from tortoise.transactions import in_transaction from app.tariff.dao import TariffDAO from app.tariff.models import InsuranceCost,...
Yohimbe227/Cargo
main.py
main.py
py
3,646
python
ru
code
0
github-code
13
43262928502
def main(): dp = [[-1] * D for _ in range(K+1)] dp[0][0] = 0 for ai in A: for k in range(K, 0, -1): for d_bfo in range(D): d = (d_bfo + ai) % D if dp[k-1][d_bfo] != -1: dp[k][d] = max(dp[k][d], dp[k-1][d_bfo] + ai) return print(dp[K...
Shirohi-git/AtCoder
abc281-/abc281_d.py
abc281_d.py
py
447
python
en
code
2
github-code
13
4249368827
from typing import Optional, Any, List, Type, TypeVar, Union from app.exceptions import * from ..base import BaseService import app.schemas.models.closecom.contactemail as contactemail_schema from ..models.closecom.contactemail import CloseComContactEmail from aiogoogle import Aiogoogle from app.core.config import sett...
Grinnbob/g_theclone
app/services/closecom/contactemail_service.py
contactemail_service.py
py
2,247
python
en
code
0
github-code
13
7268902086
#!/usr/bin/python3 """Module 0-rotate_2d_matrix """ def rotate_2d_matrix(matrix): """rotate a matrix by 90 deg """ val = len(matrix) temp = create_matrix(val) for row in range(val): for col in range(val): i = val - row - 1 temp[col][i] = matrix[row][col] copy_ma...
kevohm/alx-interview
0x07-rotate_2d_matrix/0-rotate_2d_matrix.py
0-rotate_2d_matrix.py
py
722
python
en
code
0
github-code
13
41171351374
import os from math import log2 class GitIndexEntry(object): def __init__( self, relpath=None, ctime=None, mtime=None, dev=None, ino=None, mode_type=None, mode_perms=None, uid=None, gid=None, fsize=None, sha=None, ...
leepand/mini-mlops
mlopskit/ext/dpipe/io/file_base.py
file_base.py
py
1,948
python
en
code
1
github-code
13
30485761962
import sys, torch sys.path.append('..') import argparse from torch import nn from helper import helper from torchvision import datasets, transforms from torch.utils.data import DataLoader from tqdm import tqdm import matplotlib.pyplot as plt ap = argparse.ArgumentParser() ap.add_argument('--epochs', type=...
kashyap333/Types-of-Autoencoders
Variational_AE/Variational_AE.py
Variational_AE.py
py
3,124
python
en
code
0
github-code
13
27475237896
annual_salary = float(input("Enter your starting annual salary: ")) monthly_salary = annual_salary / 12 portion_saved = float(input("Enter the percent of your salary to save, as a decimal: ")) total_cost = float(input("Enter the cost of your dream home: ")) semi_annual_raise = float(input("Enter the semiannual ra...
BelinusAI/6.100A_Introduction_to_Computer_Science_and_Programming_in_Python
ps1/ps1b.py
ps1b.py
py
748
python
en
code
0
github-code
13
13518320845
from AlgorithmImports import * class BuyAndHold(QCAlgorithm): def Initialize(self): self.SetStartDate(2010, 2, 12) # Set Start Date self.SetEndDate(datetime.now() - timedelta(1)) # Set End Date using relative date self.SetCash(100_000) # Set Strategy Cash self.SetBrokerageModel(...
ilovestocks/Strategies
Buy and Hold/TQQQ_1x.py
TQQQ_1x.py
py
1,148
python
en
code
0
github-code
13
18696283014
class Solution: def maximizeWin(self, A: List[int], k: int) -> int: dp = [0] * (len(A) + 1) res = 0 j = 0 for i, a in enumerate(A): #print(dp) while A[j] < A[i] - k: j += 1 dp[i + 1] = max(dp[i], i - j + 1) re...
mehkey/leetcode
python6/2555. Maximize Win From Two Segments.py
2555. Maximize Win From Two Segments.py
py
845
python
en
code
0
github-code
13
74583827858
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations from django.conf import settings class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('accounts', '0004_account_account_type'), ...
kahihia/hiretech
hiretech/accounts/migrations/0005_auto_20150922_1029.py
0005_auto_20150922_1029.py
py
748
python
en
code
0
github-code
13
7770648869
# Example # Input s = 'abcac' # n = 10 def repeatedString(s, n): full_string = '' s_length = len(s) a_counter = 0 # if s_length < n: # full_string = s length_check = s_length while s_length < n: full_string += s return count_a(full_string) de...
rishells/100daysOfPython
DataStructuresAndAlgos/repeteadStrings.py
repeteadStrings.py
py
570
python
en
code
0
github-code
13
25974928055
import sys import unittest import numpy as np import neurolab as nl sys.path.insert(0, '../Logic') from FuzzyLogic import * class FuzzyAdapt(): def setupNetwork(self,weightSize): networkInputRanges = [] #minimum weight is zero (no effect), max is 100 (randomly picked) weightRange = [0, 100] numN...
IronMage/SeniorDesign
Engine/Adaptation/Adaptation.py
Adaptation.py
py
1,071
python
en
code
0
github-code
13
20654465824
# -*- coding: utf-8 -*- """ This module provides a list of tool functions about date/time. - diff_time - str_to_date Author : Eric OLLIVIER """ import time import datetime as dt # ============================================================================= # str_to_date # =======================...
Eric-Oll/pytools
pytools/time/timetools.py
timetools.py
py
3,135
python
en
code
0
github-code
13
35219441144
from django.db import models from django.contrib.auth.models import AbstractUser from PIL import Image from django.conf import settings from django.contrib.auth.models import User # Create your models here. class Profile(AbstractUser): DesignationChoices = ( ("SSE/C&W/TKD", "SSE/C&W/TKD"), ("JE/C...
vinaykumar1908/082021i
users/models.py
models.py
py
2,204
python
en
code
0
github-code
13
41387877348
# Program to prompt the user to enter two lists of integers and check # (a) Whether lists are of the same length. # (b) Whether the list sums to the same value . # (c) Whether any value occurs in both Lists. # Function to check whether lists are of the same length def equal_or_not(list1,list2): if len(list1) == le...
AdhithyaSomaraj/PYTHON
2.0/program9.py
program9.py
py
1,584
python
en
code
0
github-code
13
7847803344
# -*- coding: utf-8 -*- """ query utilities. """ import typing as T import attr from attrs_mate import AttrsClass @attr.define class Query(AttrsClass): """ Structured query object. :param parts: the parts of query string split by delimiter :param trimmed_parts: similar to parts, but each part is wh...
MacHu-GWU/afwf-project
afwf/query.py
query.py
py
1,170
python
en
code
1
github-code
13
35441244990
# minzhou@bu.edu def computeCommission(salesAmount): balance = commission = 0.0 if salesAmount >= 10000.01: balance = salesAmount - 10000 commission += balance * 0.12 if salesAmount >= 5000.01: balance -= balance - 5000 commission += balance * 0.10 if salesAmount >= ...
minzhou1003/intro-to-programming-using-python
practice7/6_11.py
6_11.py
py
560
python
en
code
0
github-code
13
17228088999
import torch import torch.nn as nn import torch.nn.functional as F class TargetPred(nn.Module): def __init__(self, in_channels, hidden_dim=64, m=50, device=torch.device("cpu")): """""" super(TargetPred, self).__init__() self.in_channels = in_channels self.hidden_dim = hidden_dim ...
ZhoubinXM/AV-EnvModeling-MotionForecasting
model/decoder.py
decoder.py
py
13,567
python
en
code
0
github-code
13
9046506
import urllib2 import bs4 from bs4 import BeautifulSoup import os from NLPCore import NLPCoreClient import operator url = "https://www.google.com" page = urllib2.urlopen(url) soup = bs4.BeautifulSoup(page, 'html.parser') plaintext = soup.get_text() text = ["Bill Gates works at Microsoft.", "Sergei works at Google."] ...
sarinaxie/iter-set-expansion
cleanpagetest.py
cleanpagetest.py
py
3,390
python
en
code
0
github-code
13
17048224924
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * from alipay.aop.api.domain.ReferenceId import ReferenceId class AnttechBlockchainDefinSaasFunditemQueryModel(object): def __init__(self): self._fund_type = None self._out_order_id = Non...
alipay/alipay-sdk-python-all
alipay/aop/api/domain/AnttechBlockchainDefinSaasFunditemQueryModel.py
AnttechBlockchainDefinSaasFunditemQueryModel.py
py
3,354
python
en
code
241
github-code
13
27910614205
class Solution(object): def climbStairs(self, n): """ :type n: int :rtype: int """ cache = {} cache[1], cache[2] = 1, 2 for i in range(3, n+1): cache[i] = cache[i-1] + cache[i-2] return cache[n] def climbStairs_faster(self, n): ...
JinhanM/leetcode-playground
Recursion/climb_stairs.py
climb_stairs.py
py
575
python
en
code
0
github-code
13
37170473833
from itertools import takewhile as lxpDwtEkCfBQUiO lxpDwtEkCfBQUie=float lxpDwtEkCfBQUHi=int lxpDwtEkCfBQUHN=min lxpDwtEkCfBQUHM=len lxpDwtEkCfBQUHo=max lxpDwtEkCfBQUHs=range lxpDwtEkCfBQUHg=enumerate lxpDwtEkCfBQUHj=list from typing import NamedTuple from numpy import average from p2.src.algorithm_api import Algorithm...
KamilPiechowiak/ptsz
p2/src/id136705/algorithm.py
algorithm.py
py
5,076
python
en
code
0
github-code
13
11571167037
import random as r print('数当てゲームを始めます。3桁の数を当ててください!') answer=[r.randint(0,9) for i in range(3)] while True: hit=0 blow=0 for i in range(3): num=int(input(f'{i}桁目の予想を入力(0~9)>>')) for j in range(3): if answer[j]==num: if j==i: hit+=1 ...
nomoto720/PythonTraining
day0209/numhit.py
numhit.py
py
721
python
ja
code
0
github-code
13
25296770900
from django.test import TestCase from occurrence.models import ( SurveyMethod, SamplingSizeUnit, ) from occurrence.factories import SurveyMethodFactory from occurrence.factories import SamplingSizeUnitFactory from species.models import Taxon from species.factories import TaxonRankFactory from django.contrib.a...
kartoza/sawps
django_project/occurrence/test_occurrence_models.py
test_occurrence_models.py
py
3,266
python
en
code
0
github-code
13
31078839903
import os import flask import logging import requests import utils log = logging.getLogger(__name__) app = flask.Flask(__name__) service_b_endpoint = os.environ.get("SERVICE_B_ENDPOINT", None) service_c_endpoint = os.environ.get("SERVICE_C_ENDPOINT", None) if not service_c_endpoint or not service_b_endpoint: rai...
PanGan21/distributed-tracing
serviceA/service_a.py
service_a.py
py
1,738
python
en
code
0
github-code
13
38401237796
# simfin data example 1 # https://simfin.com/data/access/download # output-mixeddet-quarters-gaps-publish-semicolon-wide # SW API key # 6BEqsSZGmXpbrRjS06PoHU8l78R3gBqS # https://github.com/SimFin/api-tutorial # import pandas # location = 'C:/Users/SW/Downloads/output-mixeddet-quarters-gaps-publish-semicolon-wide/'...
sws144/learning-python
simfin.py
simfin.py
py
2,849
python
en
code
0
github-code
13
18864442897
from datetime import datetime import numpy as np import pandas as pd import os import re import json import shutil from mne_bids import BIDSPath from collections import defaultdict # hard-coded stuff DATA_DIR = 'data' OUTPUT_DIR = 'data_bids' def extract_datetime(f): ''' pulls timestamp out of pavlovia filena...
apex-lab/agency-battery-analysis
to_bids.py
to_bids.py
py
7,752
python
en
code
0
github-code
13
3724711322
import math import operator as op import time import sys #resource.setrlimit(resource.RLIMIT_STACK, (2**29,-1)) sys.setrecursionlimit(10**6) # (define fact (lambda (n) (if (<= n 1) 1 (+ n (fact (- n 1)))))) # (define fib (lambda (n) (if (< n 2) n (+ (fib (- n 1)) (fib (- n 2)))))) # (set! adam 'xyz') Symbol = str ...
ChristerNilsson/2023
041-Lisp/lis.py
lis.py
py
3,624
python
en
code
0
github-code
13
3833699258
def get_envelope(inputSignal): # Taking the absolute value absoluteSignal = [] for sample in inputSignal: absoluteSignal.append(abs(sample)) # Peak detection intervalLength = 35 # change this number depending on your Signal frequency content and time scale outputSignal = [] for...
AdriannaZychewicz/mgr
env_fun/env_fun.py
env_fun.py
py
576
python
en
code
0
github-code
13
74403150097
import sys def read_problem(infile): pack= [int(i) for i in infile.next().split(' ')] M = pack[0] N = pack[1] en_x, en_y, ex_x, ex_y = [int(i) for i in infile.next().split(' ')] en = (en_x,en_y) ex = (ex_x, ex_y) matrix = [[int(j) for j in infile.next().split(' ')] for i in range(N)] ret...
litao91/googlecodejam
gchina/roundD/roundD.py
roundD.py
py
2,480
python
en
code
1
github-code
13
12451197754
# -*- coding: utf-8 -*- """ Created on Thu Aug 12 11:06:21 2021 @author: owatson2 """ # import os # print(os.getcwd()) # os.chdir("DF_Python") def clean_csv(filename): #Opening and creating the necessary files excel = open(filename, "r") excel_cleaned = open("csv_cleaned.csv", "w") ...
livwatson/Data_Fellowship
DF_Python/csv_cleaning_stretch.py
csv_cleaning_stretch.py
py
1,506
python
en
code
0
github-code
13
37251413244
t = int(input()) while(t>0): t-=1 x = str(input()) var = 0 for element in x: if(element=='0'): var=var+1 else: var= var-1 var = abs(var) if(len(x)%2==1): print("-1") else: print(int(var/2))
parthsarthiprasad/Competitive_Programming
codechef/december_cook/p3.py
p3.py
py
273
python
en
code
0
github-code
13
26198222072
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Definition of basic score functions that applies to a point prediction or a single prediction interval. Author: Guillaume St-Onge <stongeg1@gmail.com> """ import numpy as np def interval_score(observation, lower, upper, interval_range, specify_range_out=False): ...
gstonge/scorepi
scorepi/score_functions.py
score_functions.py
py
3,235
python
en
code
1
github-code
13
7524505882
import json import re import scipy as sp import humanhash from itertools import chain from listing_scraper import get_search_options, get_coords WEEKS_PER_MONTH = 365/12./7 EARTH_CIRCUMFERENCE = 40075 KM_PER_MILE = 1.609 MEAN_RADIUS_OF_POINT_IN_UNIT_DISC = 2./3. WALKING_SPEED = 5./60.#km per minute MAX_DISTANCE_FROM_S...
andyljones/flat-scraper
listing_transformer.py
listing_transformer.py
py
4,343
python
en
code
0
github-code
13
41667685770
import random import sys value = random.randint(0, 100) lowestNumber = 0 highestNumber = 100 def guessnumber(): global lowestNumber global highestNumber print("Wähle eine Nummer zwischen "+ str(lowestNumber) + " und "+ str(highestNumber)) guess = int(input("")) if value == guess: ...
NotGoodWithNamingStuff/randomNumberGuesser
main.py
main.py
py
1,290
python
de
code
0
github-code
13
25525617268
import numpy as np from ray.rllib.env import PettingZooEnv, ParallelPettingZooEnv from ray.rllib.utils.spaces import space_utils from pettingzoo_env import CustomEnvironment from aec_env import AsyncMapEnv from ray.rllib.policy.policy import Policy from ray.rllib.algorithms.algorithm import Algorithm import imageio.v2...
Langbridge/RL_RAR
policy_eval_aec.py
policy_eval_aec.py
py
6,633
python
en
code
0
github-code
13
22843740959
from utils.data_input_util import * from utils.image_utils import * import logging import os from random import randint from torchinfo import summary import numpy as np import random from PIL import Image import pickle import torch import torchvision import torch.distributed as dist import torch.nn as nn from torch.ut...
cbstars06/EEG
ThoughtViz_py/training/thoughtviz_image_with_eeg.py
thoughtviz_image_with_eeg.py
py
13,288
python
en
code
0
github-code
13
7051517719
import os import sys sys.path.append(os.path.join(os.path.dirname(__file__), '../..')) import util def test(): ret = _recursive_dir('./', 'dir2', 0) return str(ret) def _recursive_dir(parent, dir_name, lv): ret = '' this_path = parent + dir_name if not this_path.endswith('/'): this_path ...
takashiharano/util
python/test/file/test_recursive_dir.py
test_recursive_dir.py
py
798
python
en
code
1
github-code
13
30139031912
from flask import current_app from zou.app.models.project import Project from zou.app.models.entity import Entity from zou.app.services import shots_service from zou.app.blueprints.source.shotgun.base import ( BaseImportShotgunResource, ImportRemoveShotgunBaseResource, ) class ImportShotgunScenesResource(B...
cgwire/zou
zou/app/blueprints/source/shotgun/scene.py
scene.py
py
2,433
python
en
code
152
github-code
13
40571080370
palindromes = [] for n in range(10000, 998001): temp = n rev = 0 while(n>0): dig = n%10 rev = rev*10+dig n = n//10 if (temp==rev): palindromes.append(temp) quotients = [] for i in palindromes: for x in range(900, 999): if i%x==0: quotients.append(...
ayan1995/Thinkful
Bootcamp/Unit_5_Other_Topics/Algorithms and Data Structures/Project Euler/palindrome.py
palindrome.py
py
871
python
en
code
0
github-code
13
10320916812
import os import json import boto3 import tweepy import pytz from tweepy import OAuthHandler from tweepy import StreamingClient from textblob import TextBlob from datetime import datetime import requests from requests_aws4auth import AWS4Auth import pysolr class process_tweet(tweepy.StreamingClient): print("in proce...
vasveena/opensearch-workshop
py-files/fh-solr-to-os.py
fh-solr-to-os.py
py
3,457
python
en
code
1
github-code
13
26889979784
from __future__ import annotations import os import numpy as np import validate from errors import LoadError class GridParameters: """ This class contains all the information pertaining to the grid: dx (x-coordinate of disk centre w.r.t. eclipse centre [t_ecl]) dy (y-coordinate of disk centre...
dmvandam/beyonce
GridParameters.py
GridParameters.py
py
9,318
python
en
code
0
github-code
13
17015630195
""" So turns out I have a real blank spot around indices manipulation like this. Well, that and live interviewing, probably been practicing TDD-like too much. Of course, I can do it, no doubt, but live, nah ------------------------ Given a matrix [ ["a", "b", "c"], ["d", "e", "f"], ["g", "h", "i"], ...
chrisjdavie/interview_practice
my_own/inv_diag_matrix/try_0.py
try_0.py
py
1,248
python
en
code
0
github-code
13
29926871422
class GameData(object): game_name='' game_link='' value=0.0 num_of_reviews=-1 steam_score=-1 def __init__(self, game_name, game_link, value, num_of_reviews=-1, steam_score=-1): self.game_name = game_name self.game_link = game_link self.value = float(value) self.n...
AlexMilman/steamgifts-group-management-tool
Data/GameData.py
GameData.py
py
698
python
en
code
6
github-code
13
4230805241
# 4 # Дама,сдавала в багаж # диван, чемодан, саквояж # картину, корзину, картонку # и маленькую собачонку,, # 4 # 0,0 # 1,2 # 3,1 # 3,0 text = [] lineCount = int(input("Введите количество строк: ")) for i in range(lineCount): line = input().split(",") text.append(line) print(text) wordCount = int(input("Введит...
DOMOKUL/Python
Laba2/16.2.py
16.2.py
py
675
python
ru
code
0
github-code
13
23778723280
# Seeed Grove Ultrasonic Sensor v2 # # https://wiki.seeedstudio.com/Grove-Ultrasonic_Ranger/ # #play-with-raspberry-pi-with-grove-base-hat-for-raspberry-pi import machine import time # blink on-board led to verify operating status led = machine.Pin(25, machine.Pin.OUT) def blink(timer): global led led.toggle...
jckantor/cbe61622
Raspberry_Pi_Pico/demo_ultrasonic_sensor.py
demo_ultrasonic_sensor.py
py
1,256
python
en
code
6
github-code
13
14206562720
def read(): f = open('./problem1.dat', 'r') f.seek(0) whole_file = f.read() lines = whole_file.splitlines() lines = list(filter(len, lines)) width = int(lines.pop(0)) distances = lines[:25] flows = lines[25:] ds = [] for d in distances: dline = [] for dd in...
willlogs/EvolutionaryComputationsExamples
4.QAP(Building Scale)/datfileReader.py
datfileReader.py
py
643
python
en
code
0
github-code
13
18717751902
from igraph import * import psycopg2 from psycopg2.extensions import AsIs from psycopg2.extras import execute_values import sys from config import config import numpy as np import datetime from pprint import pprint def main(argv): if (len(sys.argv) < 3 or len(sys.argv) > 3): print( "Debe ingresar nombre de map...
niclabs/InternetResilience
suurballe.py
suurballe.py
py
16,044
python
en
code
0
github-code
13
40454350515
import os import time import hmac import hashlib import base64 import urllib.parse import requests from config import config class DingTalk(object): SIGN_SECRET = os.environ.get(config.DING_ROBOT_SIGN_SECRET) BASE_URL = os.environ.get(config.DING_ROBOT_URL) TOKEN = os.environ.get(config.DING_TOKEN) @...
cailu/ding-robot
app/dingtalk/dingtalk.py
dingtalk.py
py
1,607
python
en
code
0
github-code
13
16987619138
class Solution: def combine(self, n, k): """ :type n: int :type k: int :rtype: List[List[int]] """ candidates = list(range(1, n+1)) # return list of all possible combinations of #count numbers out of candidates[leftmostIndex:] def combineHelper(leftmos...
HzCeee/Algorithms
LeetCode/DFS/77_Combinations.py
77_Combinations.py
py
700
python
en
code
0
github-code
13
21767143884
import os import re FIXES = [ ('(g|G)ehiilf', '\g<1>ehülf'), ('Herrn\.', 'Herm.'), ('Job\.', 'Joh.'), #(r'£(\d\d+)', '↯\g<1>'), #(r'gasse(\d+)', r'gasse \g<1>'), #(r'Kirclienfeld|Kirchen-\sIfeld', r'Kirchenfeld'), #(r'\\Vildhain' , r'Wildhain'), #(r'^\d+\s+(.+)$' ] def apply_replacem...
brawer/bern-addresses
src/cleanup/apply_replacement.py
apply_replacement.py
py
851
python
en
code
2
github-code
13
12561541646
import threading class ThreadScraper(threading.Thread): process_result = [] def __init__(self, session, offset, people, country, city, datein, dateout, is_detail, parsing_data): threading.Thread.__init__(self) self.session = session self.offset = offset self.people = people se...
HexNio/booking_scraper
booking_scraper/core/ThreadScraper.py
ThreadScraper.py
py
670
python
en
code
27
github-code
13
17144314413
import pandas.io.data as web """ Download prices from an external data source """ class MarketDataSource: def __init__(self): self.event_tick = None self.ticker, self.source = None, None self.start, self.end = None, None self.md = MarketData() def start_market_simulation(self): ...
SFL012/quant
backtests/MarketDataSourceClass.py
MarketDataSourceClass.py
py
626
python
en
code
1
github-code
13
29753979936
s = list(input()) string = 'abcdefghijklmnopqrstuvwxyz' lst = list(string) result = [] for i in range(len(lst)): if s.count(lst[i])>0: result.append(s.index(lst[i])) else: result.append(-1) print(" ".join(map(str, result)))
1000hyehyang/BAEKJOON
5. 문자열/10809.py
10809.py
py
250
python
en
code
0
github-code
13
16587462892
import logging def logged(exception, mode): def decorator(method): def wrapper(*args, **kwargs): try: return method(*args, **kwargs) except exception as ex: if mode == 'console': logging.error(str(ex)) elif mode ==...
unchain3d/python_labs
decorators/decorator.py
decorator.py
py
631
python
uk
code
0
github-code
13
70189820499
from inventory_report.reports.colored_report import ColoredReport from inventory_report.reports.simple_report import SimpleReport products = [ { "id": 1, "nome_do_produto": "Cafe", "nome_da_empresa": "Cafes Nature", "data_de_fabricacao": "2020-07-04", "data_de_validade": "20...
GustavoGracioM/inventory-report
tests/report_decorator/test_report_decorator.py
test_report_decorator.py
py
1,464
python
pt
code
0
github-code
13
22437061571
import turtle import random #_______________________ 1. DRAWING AND PREPARATION ______________________ #black screen + register Pac-Man shapes screen = turtle.Screen() screen.bgcolor("black") screen.register_shape("Pac-Man", ((-9,-2), (-8,-4), (-7,-5), (-6.5,-6.5), (-5,-7), (-4,-8), (-2,-9), (0,-9.5), (2,-9), (4,-8), ...
yaleyang5/Pac-Man-With-Turtle
Pac-Man.py
Pac-Man.py
py
11,176
python
en
code
0
github-code
13
41940971048
from menu import Menu, MenuItem from coffee_maker import CoffeeMaker from money_machine import MoneyMachine coffee_maker = CoffeeMaker() money_machine = MoneyMachine() _menu = Menu() order = "on" while order != 'off': menu = _menu.get_items() order = input(f"What would you like? {menu}:") if order == 'rep...
emmanuelkb/100-days-of-code
oop-coffee-machine-start/main.py
main.py
py
641
python
en
code
0
github-code
13
7836548570
#This code is adapted from #https://dashee87.github.io/football/python/predicting-football-results-with-statistical-modelling/ import pandas as pd import matplotlib.pyplot as plt import numpy as np import seaborn from scipy.stats import poisson,skellam epl = pd.read_csv("http://www.football-data.co.uk/mmz4281/1920/E0...
Friends-of-Tracking-Data-FoTD/SoccermaticsForPython
11SimulateMatches.py
11SimulateMatches.py
py
3,612
python
en
code
360
github-code
13
26869775385
# -*- coding: utf-8 -*- import pandas as pd from time import time from keras.models import Sequential from keras.layers.core import Dense, Activation, Dropout from keras.layers.recurrent import LSTM from matplotlib import pyplot def load_data(file_path): df = pd.read_csv(file_path, delimiter=';', pars...
zydarChen/predict_17
Highways_England/LM326.py
LM326.py
py
4,022
python
en
code
1
github-code
13
35452136903
import random from gevent import monkey from multiprocessing import Process from myexperiements.sockettest.socket_server import HoneyBadgerBFTNode from myexperiements.sockettest.make_key_files import * monkey.patch_all(thread=False) def _test_honeybadger_2(N=4, f=1, seed=None): def run_hbbft_instance(badger: ...
yylluu/dumbo
myexperiements/localtests/my_run_hbbft_socket.py
my_run_hbbft_socket.py
py
1,116
python
en
code
16
github-code
13
17628546505
from selenium import webdriver import time from selenium.webdriver.common.by import By import requests user=input('请输入学号:') xnm=input('请输入学年:') # 创建Edge浏览器的驱动程序对象 driver = webdriver.Edge() # 打开登录页面 driver.get('http://111.75.254.215:9002/jwglxt/xtgl/login_slogin.html') # 执行登录操作,输入用户名和密码 username_input = driver.find_e...
yunigongshang/pyStudy
8月/post.py
post.py
py
1,581
python
en
code
0
github-code
13
73806846737
""" pyexcel.sheets ~~~~~~~~~~~~~~~~~~~ Representation of data sheets :copyright: (c) 2014-2015 by Onni Software Ltd. :license: New BSD License, see LICENSE for more details """ from .nominablesheet import NominableSheet class Sheet(NominableSheet): """Two dimensional data contai...
ayasavolian/derived-attributes
venv/lib/python2.7/site-packages/pyexcel/sheets/sheet.py
sheet.py
py
3,828
python
en
code
0
github-code
13
74812497936
#!/usr/bin/env python import roslib import rospy import tf from tf.msg import tfMessage from geometry_msgs.msg import TransformStamped import tfx import pickle class CTRB: def __init__(self): print("init") def publishLatchTransforms(self): rospy.init_node('ctrb', anonymous=True) self....
yjen/camera_registration
ctrb.py
ctrb.py
py
2,201
python
en
code
0
github-code
13