id
stringlengths
1
265
text
stringlengths
6
5.19M
dataset_id
stringclasses
7 values
3254302
import requests import json import isodate import datetime from bs4 import BeautifulSoup # This is the URL that we're pulling the video list from. VIDEO_PAGE = "https://labs.metafilter.com/recent-youtube-posts" # Set your Youtube API key here. Get one: https://developers.google.com/youtube/v3/getting-started YT_CREDS...
StarcoderdataPython
1777093
<gh_stars>0 import os.path import yaml from flask import render_template, request, Blueprint, flash, redirect, url_for main = Blueprint('main', __name__) @main.route("/", methods=['GET', 'POST']) @main.route("/home", methods=['GET', 'POST']) def home(): path = os.path.dirname(__file__) filename = os.path.joi...
StarcoderdataPython
3214501
<filename>tests/test_currentthreadscheduler.py from datetime import datetime, timedelta from rx.concurrency import Scheduler, CurrentThreadScheduler def test_currentthread_now(): res = Scheduler.now() - datetime.utcnow() assert res < timedelta(milliseconds=1000) def test_currentthread_scheduleaction(): s...
StarcoderdataPython
1712182
#!/usr/bin/env python2 import re import copy from collections import namedtuple, defaultdict from parsec import * from utils import * import fwsynthesizer ################################################################################ # TYPES Rule = namedtuple('Rule', ['number', 'action', 'protocol', ...
StarcoderdataPython
67267
<reponame>taoyan/python # -*- coding: utf-8 -*- # Generated by Django 1.11.11 on 2019-08-22 10:29 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('videos', '0002_video_content_template'), ] operations = [ ...
StarcoderdataPython
3323860
# -*- coding: utf-8 -*- """ Created on Tue Nov 28 10:15:29 2017 @author: Kjell """ import time import math from AirSimClient import * # connect to the AirSim simulator client = MultirotorClient() client.confirmConnection() client.enableApiControl(True) client.armDisarm(True) def straight(duration, speed): pi...
StarcoderdataPython
1664617
<filename>deepthought/bricks/data_dict.py import logging log = logging.getLogger(__name__) def generate_data_dict(dataset, source, name='dict', verbose=False): import numpy as np import theano dtype = theano.config.floatX # get data into a dict, need to use the full dataset (no subset!) state = d...
StarcoderdataPython
176707
import asyncio import csv import os import time from datetime import datetime, timedelta import aiohttp import psycopg2 from six.moves import urllib_parse CONCURRENCY = 10 HUB_OUTPUT_FILE = "hub_babyswitches.csv" RAPIDPRO_OUTPUT_FILE = "rapidpro_babyswitch_updates.csv" LIMIT = 10_000_000 RAPIDPRO_URL = "https://rapi...
StarcoderdataPython
3316158
<gh_stars>1-10 #!/usr/bin/python # -*- coding: utf-8 -*- from datetime import datetime, timedelta from typing import * from uuid import uuid4 from peewee import ForeignKeyField, DateTimeField, FixedCharField from api.models.base import BaseModel from api.models.user import User class AccessToken(BaseModel): cla...
StarcoderdataPython
3204160
from sys import stdin def primos(p,q): for i in range(p): for j in range(2,q[i]): if q[i]%j==0: print ("No" ) break else: print("Si /n") break def main(): p = int(stdin.readline().strip()) q = list...
StarcoderdataPython
1734568
from year2021.python.day1.day1_func import * debts = [int(debt) for debt in open('../../data/day1_data.txt')] sonarSingle = SonarSingle() singleDebt = sonarSingle.GetDebtCount(debts) print(f"Part 1: {singleDebt}") sonarWindow = SonarWindow() windowDebt = sonarWindow.GetDebtCount(debts) print(f"Part 2: {windowDebt}...
StarcoderdataPython
1710373
<reponame>gurcani/pyhw #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Dec 14 13:40:11 2018 @author: ogurcan """ import numpy as np import h5py as h5 import pyfftw as pyfw import os import subprocess as sbp tmpdir='pyhw_tempdir' eps=1e-20 def get_spec(i,ntav): global fftw_objf,phik0,nk0,kx,ky,k...
StarcoderdataPython
2593
# coding=utf-8 # Copyright 2020 The HuggingFace Team All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless require...
StarcoderdataPython
3318502
<reponame>zhexiao/kweets<filename>tweets/scripts/tw_streaming.py<gh_stars>0 from gevent import monkey; monkey.patch_all() from gevent.pool import Pool from pprint import pprint from TwitterAPI import TwitterAPI from datetime import datetime import gevent, sys, os, redis, MySQLdb import ujson as json from config_import ...
StarcoderdataPython
3220592
<reponame>SBRG/sbaas<filename>sbaas/analysis/analysis_stage01_resequencing/stage01_resequencing_execute.py '''resequencing class''' from sbaas.analysis.analysis_base import * from .stage01_resequencing_query import * from .stage01_resequencing_io import * class stage01_resequencing_execute(): '''class for reseque...
StarcoderdataPython
3226790
from Constant import Constant from Moment import Moment from Team import Team import matplotlib.pyplot as plt from matplotlib import animation from matplotlib.patches import Circle, Rectangle, Arc import numpy as np class Event: """A class for handling and showing events""" def __init__(self, event): ...
StarcoderdataPython
3271836
"""Module score_bars.""" __author__ = '<NAME> (japinol)' from codemaster.utils.colors import Color from codemaster.utils import utils_graphics as libg_jp from codemaster.resources import Resource from codemaster.config.settings import Settings from codemaster.models.actors.actor_types import ActorType class ScoreBa...
StarcoderdataPython
168166
import unittest import numpy as np import torch from torch.autograd import Variable import torch.nn from pyoptmat import ode, models, flowrules, hardening, utility, damage from pyoptmat.temperature import ConstantParameter as CP torch.set_default_tensor_type(torch.DoubleTensor) torch.autograd.set_detect_anomaly(Tru...
StarcoderdataPython
1660579
<reponame>ned21/aquilon<gh_stars>1-10 #!/usr/bin/env python # -*- cpy-indent-level: 4; indent-tabs-mode: nil -*- # ex: set expandtab softtabstop=4 shiftwidth=4: # # Copyright (C) 2009,2010,2011,2012,2013,2015 Contributor # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file ex...
StarcoderdataPython
1640708
<reponame>mabrains/ALIGN-public<filename>tests/gdsconv/test_gds_txt.py<gh_stars>100-1000 import os import sys import filecmp import pathlib import pytest mydir = str(pathlib.Path(__file__).resolve().parent) @pytest.fixture def binary_dir(): return os.path.dirname(sys.executable) def test_gds_txt_roundtrip (binar...
StarcoderdataPython
1676230
# ========================================================================= # Copyright 2012-present Yunify, Inc. # ------------------------------------------------------------------------- # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this work except in compliance with the Licens...
StarcoderdataPython
1643989
<filename>home_taks/home_task4_0.py list_for_chenging = [1, 2, 3, 4, 5, 6, 7, 8] new_list = [i ** i for i in list_for_chenging] print(new_list)
StarcoderdataPython
3289115
<filename>export.py<gh_stars>1-10 #!/usr/bin/python # -*- coding: utf-8 -*- import cgi from modules.gitdox_sql import * from modules.ether import ether_to_sgml, get_socialcalc, build_meta_tag, ether_to_csv from modules.logintools import login import zipfile from StringIO import StringIO from shutil import copyfileobj ...
StarcoderdataPython
1767419
<filename>setup.py<gh_stars>0 # Copyright 2021 NREL # Licensed under the Apache License, Version 2.0 (the "License"); you may not # use this file except in compliance with the License. You may obtain a copy of # the License at http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to...
StarcoderdataPython
1703271
import os.path def write_to_file(filename: str, text: str) -> None: os.chdir("..") dirname = os.path.abspath(os.curdir) save_path = "/output/" complete_name = os.path.join(dirname + save_path, filename + ".tex") file = open(complete_name, "w", encoding="utf-8") file.write(text) file.close(...
StarcoderdataPython
18200
<filename>cracking_the_coding_interview_qs/8.7-8.8/get_all_permutations_of_string_test.py import unittest from get_all_permutations_of_string import get_all_permutations_of_string, get_all_permutations_of_string_with_dups class Test_Case_Get_All_Permutations_Of_String(unittest.TestCase): def test_get_all_permutati...
StarcoderdataPython
1791526
<gh_stars>100-1000 """ Copyright (c) 2022 Intel Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or ...
StarcoderdataPython
1619203
from pincushion import reddit r = reddit.Reddit() r.get_new_saved_posts() r.get_new_upvoted_posts()
StarcoderdataPython
3396524
# -*- coding: utf-8 -*- """ Created on Tue Oct 27 12:59:05 2020 @author: <NAME> Explanation: To change from categorical to ordinal variable """ import pandas as pd df_train = pd.read_csv("train.csv") df_train['Title'] = df_train.Name.str.extract(' ([A-Za-z]+)\.', expand = False) for i in range(...
StarcoderdataPython
3229501
<reponame>charlesfu4/MT import numpy as np import matplotlib.lines as mlines from matplotlib import pyplot as plt def set_size(width, fraction=1): """Set figure dimensions to avoid scaling in LaTeX. Parameters ---------- width: float Document textwidth or columnwidth in pts fraction: f...
StarcoderdataPython
70564
import os import warnings from typing import Optional, Tuple, Union, List import joblib import numpy as np from ConfigSpace import Configuration from sklearn import clone from sklearn.base import is_classifier from sklearn.model_selection import check_cv from sklearn.model_selection._validation import _fit_and_predict...
StarcoderdataPython
1767001
"""Logger module for setting up a logger.""" import logging import logging.handlers def setup_custom_logger(name: str, propagate: bool = False) -> logging.Logger: """Sets up a custom logger. Parameters ---------- name : str Name of the file where this function is called. propagate : bool,...
StarcoderdataPython
3298815
# Generated by Django 3.1.6 on 2021-09-04 06:16 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('jobs', '0023_auto_20210903_0736'), ] operations = [ migrations.RemoveField( model_name='historicaljob', name='alert_on_failu...
StarcoderdataPython
1689609
import cv2 import numpy as np cap=cv2.VideoCapture('data/vtest.avi') ret,frame1=cap.read() ret,frame2=cap.read() while cap.isOpened(): diff=cv2.absdiff(frame1,frame2) gray=cv2.cvtColor(frame1,cv2.COLOR_BGR2GRAY) blur=cv2.GaussianBlur(gray,(5,5),0) _,thresh=cv2.threshold(blur,20,255,cv2.THRESH...
StarcoderdataPython
3306111
import numpy as np import pandas as pd import copy def agent_add_liq(params, substep, state_history, prev_state, policy_input): """ This function updates agent local states when liquidity is added in one asset. If symmetric liquidity add is enabled additional calculations are made. """ asset_id = ...
StarcoderdataPython
8085
import collections import nltk import os from sklearn import ( datasets, model_selection, feature_extraction, linear_model, naive_bayes, ensemble ) def extract_features(corpus): '''Extract TF-IDF features from corpus''' sa_stop_words = nltk.corpus.stopwords.words("english") # words that might in...
StarcoderdataPython
1686037
#!/usr/bin/env python3 """Simple multiprocess HTTP server written using an event loop.""" import argparse import os import socket import signal import time import asyncio import aiohttp import aiohttp.server from aiohttp import websocket ARGS = argparse.ArgumentParser(description="Run simple HTTP server.") ARGS.add_...
StarcoderdataPython
4810303
<reponame>MKLab-ITI/news-popularity-prediction __author__ = '<NAME> (<EMAIL>)' import os from news_popularity_prediction.datautil.common import load_pickle, store_pickle def get_within_dataset_user_anonymization(output_file, document_gen, ...
StarcoderdataPython
1743609
<gh_stars>0 #!/usr/bin/env python # -*- coding:utf-8 -*- """ webcamera server for opencv 3.0 クライアントからデータを受け取る 画像データはAES暗号がかけられている 通信はsslで行う 現状はMySQLに日付と画像を格納 NoSQLを使ってみたいという願望がある settingファイルからポート番号と """ import SocketServer import cv2 import numpy import socket import sys import datetime import ConfigPar...
StarcoderdataPython
161588
<gh_stars>100-1000 import traceback from rdflib.namespace import Namespace from owmeta_core.dataobject import ObjectProperty from owmeta_core.datasource import GenericTranslation from owmeta_core.data_trans.csv_ds import CSVDataSource, CSVDataTranslator from .. import CONTEXT from ..network import Network from ..wor...
StarcoderdataPython
1694657
# Song-to-playlist classifier utils. from __future__ import print_function from __future__ import division from utils.evaluation import compute_metrics, summarize_metrics from sklearn.utils import check_random_state, shuffle from tqdm import tqdm import theano.tensor as T import theano import lasagne as lg import n...
StarcoderdataPython
3295445
<reponame>tanthanadon/senior<filename>src/churn.py from pathlib import Path import os import pandas as pd from tqdm import trange, tqdm import time import matplotlib def saveText(PATH_SAMPLE, PATH_TEXT): #print(PATH_TEXT) for file in PATH_SAMPLE.iterdir(): # Get into the directory of the target project...
StarcoderdataPython
1708658
<gh_stars>1-10 #!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import math import torch GLOBAL_MAXIMIZER = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] GLOBAL_MAXIMUM = 0.8 def cosine8(X): r"""8d Cosine Mixture test function. 8-dimensional function (usually eval...
StarcoderdataPython
77507
<reponame>rgerkin/pyrfume # --- # jupyter: # jupytext: # formats: ipynb,py # text_representation: # extension: .py # format_name: light # format_version: '1.5' # jupytext_version: 1.10.3 # kernelspec: # display_name: Python 3 # language: python # name: python3 # --- impo...
StarcoderdataPython
70242
<gh_stars>0 # coding: utf-8 # # DS3 Data Handling # ## <NAME> # ### NIAID Bioinformatics and Computational Biosciences Branch (BCBB) # --- # # Outline: # - Intro to Python # - Learn python in Y minutes # # - Importing Data # - csv import # - Excel import # - Database import # - Web import # ...
StarcoderdataPython
3290126
<gh_stars>0 # Generated by Django 3.0.7 on 2020-06-23 12:12 import apps.users.models import django.db.models.deletion import easy_thumbnails.fields from django.conf import settings from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('users', '0008_auto_202006...
StarcoderdataPython
4821741
<gh_stars>0 #!/usr/bin/env ipython2 import numpy as np import scipy.special as ss import scipy.interpolate as sint from statepoint import StatePoint from matplotlib import pyplot as plt from uncertainties import ufloat from gen_mgxs import mgxs import pickle from bisect import bisect import os import sys def Pn_solve...
StarcoderdataPython
1789268
import sys import matplotlib.pyplot as plt import numpy PLOT1 = { 'labels': [], 'uncompressed': [], 'gzip': [], 'lz4': [], 'lzma': [], } PLOT2 = { 'labels': [], 'uncompressed': [], 'gzip': [], 'lz4': [], 'lzma': [], } PLOT3 = { 'labels': [], 'uncompressed': [], 'gz...
StarcoderdataPython
1622575
import os, shutil from conans import ConanFile, tools class PcctsConan(ConanFile): name = "pccts" version = "1.33MR33" settings = "os_build", "compiler", "arch_build" generators = "gcc" description = "PCCTS toolkit" license = "public domain" url = "https://github.com/db4/conan-pccts" ...
StarcoderdataPython
53142
<gh_stars>10-100 '''A class for managing 3DNet objects.''' # python import os # scipy from numpy.random import rand, randint class ThreeDNet: def __init__(self): '''TODO''' self.dir = "/home/mgualti/Data/3DNet/Cat10_ModelDatabase" # 3D Net objects all have height of 1m self.classes = ["bottle...
StarcoderdataPython
33746
<gh_stars>0 #!/usr/bin/env python # # Script to generate a cap module and subroutines # from a scheme xml file. # from __future__ import print_function import os import sys import getopt import xml.etree.ElementTree as ET #################### Main program routine def main(): args = parse_args() data = parse_s...
StarcoderdataPython
124901
#!/usr/bin/env python # ***** BEGIN LICENSE BLOCK ***** # Version: MPL 1.1/GPL 2.0/LGPL 2.1 # # The contents of this file are subject to the Mozilla Public License Version # 1.1 (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # http://www.mozil...
StarcoderdataPython
16816
# Created by Hansi at 3/16/2020 import os from algo.data_process.data_preprocessor import data_cleaning_flow from algo.utils.file_utils import delete_create_folder def extract_gt_tokens(text): """ Given GT string, method to extract GT labels. GT string should be formatted as Twitter-Event-Data-2019. ...
StarcoderdataPython
1729390
from contextlib import suppress import json from io import BytesIO import re from sys import argv import appex from bs4 import BeautifulSoup import clipboard import photos import PIL.Image from requests import Session class Page: """An image-containing page of saatchiart.com. Raises: ValueError: If ...
StarcoderdataPython
3325460
<reponame>KamilKamilK/Clothes-sharing # Generated by Django 3.1.1 on 2020-09-06 11:45 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('charity', '0003_auto_20200906_1142'), ] operations = [ migrations.AlterField( model_name='...
StarcoderdataPython
3312044
<reponame>FlaskTeam/FlaskAXF from flask_script import Manager from App import create_app app = create_app() manager = Manager(app) if __name__ == '__nain__': manager.run
StarcoderdataPython
1666993
#!/usr/local/bin/managed_python3 """ CLI Application to streamline the creation of PKGInfo files for printer deployment in Munki. Created by <NAME> for Syracuse University, 2014 - <EMAIL> Bug squashing assistance from <NAME> Much code reused from Printer PKG deploy scripts by: <NAME>, SUNY Purchase, 2010 <NAME>, 2...
StarcoderdataPython
1713623
import fileinput import functools import os import random import re import subprocess import sys import tempfile import time import unittest from distutils.version import LooseVersion from threading import Thread import assertions from cassandra import ConsistencyLevel from cassandra.concurrent import execute_concurre...
StarcoderdataPython
31656
<filename>src/octopus/dispatcher/model/pool.py #################################################################################################### # @file pool.py # @package # @author # @date 2008/10/29 # @version 0.1 # # @mainpage # ############################################################################...
StarcoderdataPython
3374169
import time def main(request, response): use_broken_body = 'use_broken_body' in request.GET response.add_required_headers = False response.writer.write_status(200) response.writer.write_header("Content-type", "text/html; charset=UTF-8") response.writer.write_header("Transfer-encoding", "chunked") ...
StarcoderdataPython
1615704
<gh_stars>1-10 #!/usr/bin/env python3 import sys import boto3 import botocore import subprocess from typing import List, Tuple CONFIG_STR = """upstream {application} {{ {servers} server [::1]:9090 backup; }}""" UPSTREAM_LOCATION = "/etc/sgtcodfish/upstream.conf" def load_bucket_name() -> str: with open("...
StarcoderdataPython
4833036
<reponame>hmn21/positionchange from __future__ import print_function import paramiko from datetime import datetime, timedelta import functools import pandas as pd class AllowAnythingPolicy(paramiko.MissingHostKeyPolicy): def missing_host_key(self, client, hostname, key): return hostname = "192...
StarcoderdataPython
4804523
<reponame>3ll3d00d/pypolarmap from PyQt5.QtWidgets import QDialog, QDialogButtonBox from model.preferences import DISPLAY_DB_RANGE, DISPLAY_COLOUR_MAP, DISPLAY_POLAR_360 from ui.display import Ui_displayControlsDialog class DisplayModel: ''' Parameters to feed into how a chart should be displayed. ''' ...
StarcoderdataPython
1721029
<reponame>melon-yellow/py-misc ########################################################################################################################## # Imports import inspect # Modules from .safe import Safe from .resolvable import Resolvable from .methods import getcallable ####################################...
StarcoderdataPython
70765
# Copyright 2016 United States Government as represented by the Administrator # of the National Aeronautics and Space Administration. All Rights Reserved. # # Portion of this code is Copyright Geoscience Australia, Licensed under the # Apache License, Version 2.0 (the "License"); you may not use this file # except in c...
StarcoderdataPython
3804
<gh_stars>1-10 #!/usr/bin/env python ''' Author : <NAME> Email : <EMAIL> Description : shellfind.py is a Python command line utility which lets you look for shells on a site that the hacker must have uploaded. It considers all the shells available and tries all possibilities via dictionary match. ''' import socket impo...
StarcoderdataPython
1724979
<gh_stars>1-10 from datetime import datetime, timedelta, date from Database import *; from CommonFunctions import *; # Ending semicolons intentionally left out because the sanitize function removes all semicolons SELECT_QUERY = "SELECT %s FROM %s WHERE %s" SELECT_ALL_QUERY = "SELECT %s FROM %s" NEW_EMPLOYEE_INSERT = ...
StarcoderdataPython
1646281
"""Urls for Zinnia random entries""" from django.conf.urls import url from django.conf.urls import patterns from zinnia.views.random import EntryRandom urlpatterns = patterns( '', url(r'^$', EntryRandom.as_view(), name='zinnia_entry_random'), )
StarcoderdataPython
1688076
import re import datetime ET_CHAR = "∧" OR_CHAR = "∨" IF_CHAR = "→" NOT_CHAR = "¬" # First order Logic ALL_CHAR = "∀" EXISTS_CHAR = "∃" # Modal Logic NECESSARY_CHAR = "◻" POSSIBLE_CHAR = "◇" # Results THEOREM_CHAR = "⊢" NOT_THEOREM_CHAR = "⊬" def get_all(l): "Returns all elements in nested lists" o = lis...
StarcoderdataPython
3203569
from math import sqrt, atan2 class Vector2D: def __init__(self, x=0, y=0): self.point = [float(x), float(y)] def __hash__(self): return hash(tuple(self.point)) def __str__(self): return str(self.point) def __repr__(self): return str(self.point) def __eq__(self, ...
StarcoderdataPython
3334732
def creategraph(): # static graph # node structure = Tuple('node_name', 'node_heuristic-value') graph = {('h', 120): [('g', 100), ('s', 70), ('b', 80)], ('s', 70): [('po', 110), ('rs', 20)], ('g', 100): [('rs', 20)], ('b', 80): [('ps', 26)], ('rs', 20): [('u'...
StarcoderdataPython
1759322
from __future__ import annotations from typing import Any, List, Optional from pydantic import BaseModel, HttpUrl from ikea_api.wrappers import types from ikea_api.wrappers._parsers.item_base import ItemCode __all__ = ["main"] class Catalog(BaseModel): name: str url: HttpUrl class CatalogRef(BaseModel):...
StarcoderdataPython
1631496
import discord from discord.ext import commands from discord.utils import get import datetime from discord import Member class Joinlog(commands.Cog): def __init__(self, bot): self.bot = bot @commands.Cog.listener() async def on_member_join(self, member): usedinvite = Noneg ...
StarcoderdataPython
58034
<reponame>bitcraft/pyglet<gh_stars>10-100 import pyglet # Cocoa implementation: if pyglet.options['darwin_cocoa']: from .cocoapy import *
StarcoderdataPython
13591
# extdiff.py - external diff program support for mercurial # # Copyright 2006 <NAME> <<EMAIL>> # # This software may be used and distributed according to the terms of the # GNU General Public License version 2 or any later version. '''command to allow external programs to compare revisions The extdiff Mercurial exten...
StarcoderdataPython
3396569
from django.shortcuts import render from rest_framework import generics, permissions, viewsets, renderers from rest_framework.views import APIView from rest_framework.response import Response from django_filters.rest_framework import DjangoFilterBackend from .service import CleaningFilter from collections import ...
StarcoderdataPython
4800180
<filename>setup.py from setuptools import setup, find_packages import platform from pathlib import Path import subprocess import sys import warnings assert platform.system() == 'Windows', "Sorry, this module is only compatible with Windows so far." archstr = platform.machine() if archstr.endswith('64'): arch = "x...
StarcoderdataPython
1619925
<gh_stars>0 from zufang_flask.models import HouseItem __author__ = 'GavinLiu' __date__ = '2018/7/21 13:05' from flask import Blueprint, jsonify, render_template house = Blueprint('house', __name__) @house.route('/index.html') def index(): return render_template('index.html') @house.route('/get_houselist', me...
StarcoderdataPython
1646069
<gh_stars>100-1000 import mock from couchdbkit import ResourceNotFound def mock_report_configurations(report_configurations_by_id): return mock.patch('corehq.apps.app_manager.models.ReportModule.reports', property( lambda self: [report_configurations_by_id[r.report_id] for r in self....
StarcoderdataPython
3229078
<gh_stars>1-10 #cat alladdress.txt | python3 address_to_hash160.py > alladdress160.txt import sys from bit.base58 import b58decode_check from bit.utils import bytes_to_hex def address_to_hash160(address): address_bytes = b58decode_check(address) address_hash160 = bytes_to_hex(address_bytes)[2:] return add...
StarcoderdataPython
3321792
a,b=map(float,input().split()) print("%.2lf"%(a/b))
StarcoderdataPython
1705894
<filename>run_reg.py """ Author: <NAME> Date: May 2020 调用训练好的模型 """ import argparse import numpy as np import os import torch import logging from tqdm import tqdm import matplotlib from pathlib import Path import sys import importlib import cv2 from openni import openni2 from openni import _openni2 as c_api from displ...
StarcoderdataPython
180490
""" Full CI based on determinants rather than on CSFs. The approach is the one introduced by Olsen J Chem Phys 89 2185 (1988) It is also described in the book Molecular electronic structure theory, by Helgaker, <NAME>. There it is called 'Minimal operator count (MOC) method' written by <NAME> Notation: Book of ...
StarcoderdataPython
3214478
<reponame>gjeunen/reference_database_creator #! /usr/bin/env python3 ## import modules import argparse from Bio import Entrez import time from urllib.error import HTTPError import http.client http.client.HTTPConnection._http_vsn = 10 http.client.HTTPConnection._http_vsn_str = 'HTTP/1.0' import subprocess as sp import ...
StarcoderdataPython
3217002
import numpy as np import glob import shutil import os import cv2 from PIL import Image, ImageOps from matplotlib import pyplot as plt clothes_dir = '/home/ssai1/dhgwag/VITON/VITON-HD/datasets/train/cloth' clothes_mask_dir = '/home/ssai1/dhgwag/VITON/VITON-HD/datasets/train/cloth-mask' image_dir = '/home...
StarcoderdataPython
1671851
<gh_stars>1-10 # # 1438. Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit # # Q: https://leetcode.com/problems/longest-continuous-subarray-with-absolute-diff-less-than-or-equal-to-limit/ # A: https://leetcode.com/problems/longest-continuous-subarray-with-absolute-diff-less-than-or-equal-to-lim...
StarcoderdataPython
3255064
<reponame>andypymont/adventofcode<gh_stars>0 """ 2021 Day 11 https://adventofcode.com/2021/day/11 """ from collections import deque from itertools import count from typing import Dict, Iterator, Set import aocd # type: ignore def read_octopuses(text: str) -> Dict[complex, int]: octopuses: Dict[complex, int] = {...
StarcoderdataPython
108420
import pandas as pd import numpy import matplotlib import sklearn_crfsuite from sklearn import preprocessing from sklearn.preprocessing import LabelEncoder from sklearn_crfsuite import metrics from sklearn.model_selection import train_test_split from sklearn.metrics import make_scorer from sklearn.cross_validation i...
StarcoderdataPython
3220579
<reponame>domdinicola/django-admin-extra-urls # -*- coding: utf-8 -*- import logging from django.contrib.admin import site from admin_extra_urls.extras import reverse from admin_extra_urls.mixins import _confirm_action from demo.models import DemoModel1 logger = logging.getLogger(__name__) def test_confirm(django_...
StarcoderdataPython
1691338
import base64 import json import requests from django.conf import settings from django.contrib.auth import authenticate, login from django.contrib.auth.models import User from django.http import HttpResponse, HttpResponseRedirect def paytm_oauth(request): code = request.GET.get('code', None) url = settings.P...
StarcoderdataPython
1755724
<reponame>hubert-he/FATE<gh_stars>1000+ # # Copyright 2019 The FATE Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/L...
StarcoderdataPython
3366592
<filename>ErrorDistribution/error_distribution.py # coding: utf-8 # In[17]: from train import * import pandas as pd import numpy as np # In[63]: params = PARAMS params['filename'] = "model1.csv" params['max_steps'] = 1000000 params['learning_rate'] = 0.01 params['layers'] = [100, 200, 100] params['dropout'] = 0.0...
StarcoderdataPython
1639413
<reponame>panicmarvin/OpenRAM import design import debug import utils from tech import GDS,layer class replica_bitcell(design.design): """ A single bit cell (6T, 8T, etc.) This module implements the single memory cell used in the design. It is a hand-made cell, so the layout and netlist should be avail...
StarcoderdataPython
1791224
<filename>Python/Exercise/Exercise_2018/Translate/googleTranslate.py #!/usr/bin/env python # -*- coding: utf-8 -*- import requests # pip install requests import json import execjs # pip install PyExecJS import urllib3 # pip install urllib3 ''' author by Benji date at 2018.12.07 实现: 模拟浏览器中Google翻译的url请求 不同于Bai...
StarcoderdataPython
4826252
<gh_stars>1-10 import numpy as np class RidgeRegressor: """ Regression weights of kernel Ridge regression Parameters ---------- kernel : {'gaussian'} Name of the kernel to use. sigma : float, optional Bandwidth parameter for various kernel: standard deviation for Gaussian ker...
StarcoderdataPython
3387752
<gh_stars>1-10 # -*- coding: utf-8 -*- # pylint: disable=line-too-long """HTTP/2 Error Code""" from aenum import IntEnum, extend_enum __all__ = ['ErrorCode'] class ErrorCode(IntEnum): """[ErrorCode] HTTP/2 Error Code""" #: NO_ERROR, Graceful shutdown [RFC-ietf-httpbis-http2bis-07, Section 7] NO_ERROR =...
StarcoderdataPython
48628
<reponame>ATSM-Bot/rickroll-lang from sys import stdout from random import choice # Keywords KW_print = 'i_just_wanna_tell_u_how_im_feeling' KW_if = 'and_if_u_ask_me_how_im_feeling' KW_let = 'give_u_up' KW_import1 = 'we_know_the' KW_import2 = "and_we're_gonna_play_it" K...
StarcoderdataPython
3324155
# %% [231. Power of Two](https://leetcode.com/problems/power-of-two/) class Solution: def isPowerOfTwo(self, n: int) -> bool: return n > 0 and bin(n).count("1") == 1
StarcoderdataPython
23431
""" Name: modules.py Desc: This script defines some base module for building networks. """ from typing import Any import torch import torch.nn as nn import torch.nn.functional as F class UNet_down_block(nn.Module): def __init__(self, input_channel, output_channel, down_size=True): super(UNet_down_block,...
StarcoderdataPython
161306
from django.urls import path from . import views urlpatterns = [ path('', views.index, name='index'), path('send', views.send, name='send'), path('recv', views.recv, name='recv'), path('send_action', views.send_action, name='send_action'), path('recv_action', views.recv_action, name='recv_action')...
StarcoderdataPython