id
stringlengths
1
265
text
stringlengths
6
5.19M
dataset_id
stringclasses
7 values
4807368
<filename>Writeups/Hack The Box/Machine/Previse/3. Exploit/brute.py #!/usr/bin/python3 import requests url = "http://10.10.11.104/download.php?file=" for i in range(50,200): r = requests.get(url + str(i), allow_redirects=False) print("{0} -> {1}".format(i,r.text))
StarcoderdataPython
3208959
<filename>recorder.py import sounddevice as sound from scipy.io.wavfile import write import wavio as wav import sys try: freq = 44100 duration = 1800 #The duration of recording in seconds (It can be changed) #print("recording...") recording = sound.rec(int(duration*fre...
StarcoderdataPython
1728806
from .help import HelpAction from .new_item import NewItemAction from .start import StartAction from .strike_item import StrikeItemAction from .toggle import ToggleAction __all__ = [ StartAction, HelpAction, NewItemAction, StrikeItemAction, ToggleAction, ]
StarcoderdataPython
1674001
#!/usr/bin/env python # # ********* Ping Example ********* # # # Available SCServo model on this example : All models using Protocol SCS # This example is tested with a SCServo(STS/SMS/SCS), and an URT # Be sure that SCServo(STS/SMS/SCS) properties are already set as %% ID : 1 / Baudnum : 6 (Baudrate : ...
StarcoderdataPython
1695827
import datetime import logging import smtplib from celery.task import task from rapidsms.router.api import get_router from django.conf import settings from django.core.mail import send_mail from django.template.loader import render_to_string from django.utils.datastructures import MultiValueDict from .models import...
StarcoderdataPython
3319761
import json import random import re import uuid from flask import Flask, jsonify, redirect, render_template, request, url_for from user_agents import parse # init random number generator random.seed() app = Flask(__name__) # app.logger.error("test") from db_handler import DbHandler db = DbHandler() from input_val...
StarcoderdataPython
138717
import collections import pytest from radon.cli import Config import radon.complexity as cc_mod import radon.cli.harvest as harvest BASE_CONFIG = Config( exclude='test_[^.]+\.py', ignore='tests,docs', ) CC_CONFIG = Config( order=getattr(cc_mod, 'SCORE'), no_assert=False, min='A', max='F', ...
StarcoderdataPython
46598
<filename>flowws_structure_pretraining/analysis/BondDenoisingVisualizer.py import functools import flowws from flowws import Argument as Arg import plato from plato import draw import numpy as np from .internal import GeneratorVisualizer from ..FileLoader import FileLoader @flowws.add_stage_arguments class BondDeno...
StarcoderdataPython
3362860
<filename>action_tracker/test/TestActionTracker3.py ''' Created on Feb 14, 2021 @author: jeff This test generates addAction threads for each line in the input file. The averages are matched to the output file. ''' import simplejson as json import unittest import concurrent.futures from action_tracker.Tracker import Ac...
StarcoderdataPython
114234
<filename>test/test_files/pylops/pylops/basicoperators/LinearRegression.py import logging from pylops.basicoperators import Regression logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.WARNING) def LinearRegression(taxis, dtype='float64'): r"""Linear regression. Creates an operator that ...
StarcoderdataPython
185724
from pydantic import BaseModel from vo.SpiderBaseGetVideoInfoBatchResponseVO import SpiderBaseGetVideoInfoBatchResponseVO from vo.douyin.SpiderDouyinUserInfoVO import SpiderDouyinUserInfoVO class SpiderDouyinVideoUrlByUserResponseVO(BaseModel): user_info: SpiderDouyinUserInfoVO = None video_list: SpiderBaseG...
StarcoderdataPython
92818
<reponame>charithmadhuranga/core<filename>tests/components/webostv/test_media_player.py """The tests for the LG webOS media player platform.""" from homeassistant.components.media_player import DOMAIN as MP_DOMAIN from homeassistant.components.media_player.const import ( ATTR_INPUT_SOURCE, ATTR_MEDIA_VOLUME_MUT...
StarcoderdataPython
100859
# =============================================================================== # Copyright 2013 <NAME> # # 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/...
StarcoderdataPython
1624155
<reponame>DaveMcEwan/dmppl #!/usr/bin/env python3 # lineFilter # <NAME> 2020-10-03 # # Take lines from STDIN, filter out lines, and print remaining lines on STDOUT. # Run like: # cat foo.txt | python lineFilter.py fileOfRegexs > bar.txt # # mypy --ignore-missing-imports lineFilter.py # Standard library import argp...
StarcoderdataPython
1666542
# Copyright 2018 The Bazel Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
StarcoderdataPython
41457
<reponame>joseangelooliveira-br/Python3 from time import sleep n1 = int(input('Primeiro valor:')) n2 = int(input('Segundo valor:')) opcao = 0 while opcao != 5: print(''' [1] somar [2] Multiplicar [3] Maior [4] Novos números [5] Sair do programa.''') opcao = int(input('Qual é a sua opção? '))...
StarcoderdataPython
1619470
<filename>tests/test_core.py import os import rail import pytest import pickle import numpy as np from types import GeneratorType from rail.core.stage import RailStage from rail.core.data import DataStore, DataHandle, TableHandle, Hdf5Handle, PqHandle, QPHandle, ModelHandle, FlowHandle from rail.core.utilStages import ...
StarcoderdataPython
1726583
<filename>scripts/test_microscope.py<gh_stars>10-100 #!/usr/bin/env python3 from time import sleep from argparse import ArgumentParser from temscript import Microscope, NullMicroscope, RemoteMicroscope parser = ArgumentParser() parser.add_argument("--null", action='store_true', default=False, help="Use NullMicroscop...
StarcoderdataPython
3319024
import numpy as np from qubitLib import * class Oracle: def __init__(self): self.qstrings=list() self.score=np.inf def setScore(self,score): self.score=score def initialization(self,n,m): self.stringNum=n self.stringSize=m # create n qubit strings with m qubits each for i in range(0,n): self.q...
StarcoderdataPython
136089
<filename>lib.py from requests import get, post from datetime import datetime from pprint import pprint from time import time from os import environ KEY = environ["MOODLE_API_KEY"] URL = environ["MOODLE_URL"] ENDPOINT = "/webservice/rest/server.php" def rest_api_parameters(in_args, prefix='', out_dict=None): """T...
StarcoderdataPython
145358
from app.sensors.sensor_factory import build_sensors, provide_sensors from app.sensors.sensor_manager import SensorManager from app.sensors.sensor import Sensor
StarcoderdataPython
127941
import os from setuptools import find_packages, setup with open(os.path.join(os.path.dirname(__file__), 'README.md')) as readme: long_description = readme.read() with open(os.path.join(os.path.dirname(__file__), 'requirements.txt')) as f: requirements = f.read().splitlines() # allow setup.py to be run from a...
StarcoderdataPython
1791805
#!/usr/bin/python3 # -*- coding: utf-8 -*- import os import sys import time import codecs from logging import FileHandler import logging.config basedir = os.path.abspath(os.path.dirname(__file__)) logdir = os.path.join(basedir, 'logs') logini_path = os.path.join(basedir, 'log.ini') if not os.path.exists(logdir): ...
StarcoderdataPython
97806
"""Helper function to setup the run from the command line. Adapted from https://github.com/atomistic-machine-learning/schnetpack/blob/dev/src/schnetpack/utils/script_utils/setup.py """ import os import logging from shutil import rmtree from nff.utils.tools import to_json, set_random_seed, read_from_json __all__ = ["...
StarcoderdataPython
151922
<filename>sublimetext/FSharp/project.py import sublime import sublime_plugin from queue import Queue import queue from threading import Thread from zipfile import ZipFile import os from FSharp.lib import const from FSharp.lib.fsac import get_server from FSharp.lib import fs tasks = Queue() task_results = Queue() ...
StarcoderdataPython
3269636
import sys import re with open(sys.argv[1],'r') as test_cases: for test in test_cases: a,b = test.split(':') nums = [x for x in a.split()] elemets = re.findall('\d+',b) for i in xrange(0,len(elemets),2): nums[int(elemets[i])] , nums[int(elemets[i+1])] = nums[int(elemets[i+1])] , nums[int(elemets[i])] prin...
StarcoderdataPython
1647108
<filename>src/compas/viewers/core/__init__.py from .drawing import * from .arrow import * from .axes import * from .camera import * from .grid import * from .mouse import * from .slider import * from .colorbutton import * from .glwidget import * from .controller import * from .textedit import * from .buffers import * ...
StarcoderdataPython
3251808
# Standard Imports from fastapi import APIRouter from fastapi import HTTPException from fastapi import Depends from fastapi import Path, Query # Database Import from app.db.engine import get_db # Typing Imports from sqlalchemy.orm import Session from typing import Optional # Exception Imports from sqlalchemy.exc imp...
StarcoderdataPython
1794839
""" Code illustration: 9.06 Weather reporter Tkinter GUI Application Development Blueprints """ import sys import json import datetime from tkinter import Tk, Canvas, Entry, Button, Frame, Label, StringVar, ALL from tkinter import ttk from tkinter import messagebox import urllib.request import urllib.parse class ...
StarcoderdataPython
146677
<reponame>dials-src/dials from __future__ import annotations from math import pi, sqrt from dials.array_family import flex # noqa: F401; from dials_algorithms_profile_model_ellipsoid_ext import * # noqa: F401, F403; def mosaicity_from_eigen_decomposition(eigen_values): return ( sqrt(eigen_values[0]) *...
StarcoderdataPython
3311013
<filename>facebook/alienDict.py from collections import defaultdict class Solution(object): def alienOrder(self, words): map = {} letters = [0 for i in range(26)] for i in range(len(words)): for j in range(len(words[i])): key=ord(words[i][j])-ord('a') ...
StarcoderdataPython
3216717
# coding: utf-8 """ Xero Payroll UK This is the Xero Payroll API for orgs in the UK region. # noqa: E501 OpenAPI spec version: 2.4.0 Contact: <EMAIL> Generated by: https://openapi-generator.tech """ import re # noqa: F401 from xero_python.models import BaseModel class EmployeeLeaveBalance(...
StarcoderdataPython
1791246
import torch import torch.nn as nn import torch.nn.functional as F from .aspp import ASPP_Module up_kwargs = {'mode': 'bilinear', 'align_corners': False} norm_layer = nn.BatchNorm2d class _ConvBNReLU(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, di...
StarcoderdataPython
104449
<reponame>kuraakhilesh8230/aries-cloudagent-python from asynctest import TestCase as AsyncTestCase from ..indy import V20CredExRecordIndy class TestV20CredExRecordIndy(AsyncTestCase): async def test_record(self): same = [ V20CredExRecordIndy( cred_ex_indy_id="dummy-0", ...
StarcoderdataPython
3236426
# pytorchを使ったVAEの実装 # ae_torchとは使用方法が異なる. その内統一したい # class VAEについて, 余分に思えるメソッドがあるがこれは継承することを考慮して書いている import numpy as np import os import matplotlib.pyplot as plt import json import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.autograd import Variable...
StarcoderdataPython
3322510
<gh_stars>0 """Celery tasks to be spawned.""" import time from flask import current_app from brewpi.extensions import celery from .. import models from ..drivers import save_temp_to_file @celery.task def add(x, y, kettle_id): """Example task.""" # db_sess = db.session current_app.logger.info(f"add {x} ...
StarcoderdataPython
162502
<reponame>to314as/gym-pool<filename>gym_pool/envs/utils.py import functools import operator def prod(l): return functools.reduce(operator.mul, l, 1)
StarcoderdataPython
1604516
<filename>twitter_elections/sentiment_analysis/labeliseurs/labeliser_v2.py # coding: utf-8 import pymongo as pym import re # raw_input est valable uniquement pour Python 2. En Python 3, la fonction équivalente est input() def retrait_doublons(collection): print('Retrait d\'eventuels doublons...') textCleanPip...
StarcoderdataPython
106609
<gh_stars>0 import requests, sys, time, os, argparse import pandas as pd import re from nltk.corpus import stopwords from nltk.stem import WordNetLemmatizer from nltk import pos_tag, word_tokenize from textblob import TextBlob from collections import Counter country_codes ={'US':'USA', 'IN':'India', 'BR':'Brazil', 'GB...
StarcoderdataPython
3387948
import os from algorithms.RNN import RNN from algorithms.LSTM import LSTM from algorithms.GRU import GRU from algorithms.Transformer import Transformer from algorithms.RTransformer import RT from HDF5Dataset import HDF5Dataset import plotting import torch from torch.utils import data from sklearn.preprocessing import M...
StarcoderdataPython
3394772
<filename>genrl/classical/bandit/contextual_policies/__init__.py from genrl.classical.bandit.contextual_policies.bayesian import ( # noqa BayesianUCBCBPolicy, ) from genrl.classical.bandit.contextual_policies.epsgreedy import ( # noqa EpsGreedyCBPolicy, ) from genrl.classical.bandit.contextual_policies.gradie...
StarcoderdataPython
3224436
<reponame>cmbasnett/fake-bpy-module ClothSolverResult.status = None
StarcoderdataPython
67071
if __name__ == "__main__": import argparse from ocr.ocr_document import OCRProcessor parser = argparse.ArgumentParser( description="Python script to detect and extract documents." ) parser.add_argument( "-i", "--input-image", help="Image containing the document", ...
StarcoderdataPython
4806523
<filename>jwtest/spider/pa.py # -*- coding:utf-8 -*- import urllib import urllib2 import cookielib import re import string import types class Term: time = "" id = "" courses_list = [] def __init__(self, id, time, courses_list): self.id = id self.time = time self.courses_list ...
StarcoderdataPython
150004
# Copyright (c) 2011, Found IT A/S and Piped Project Contributors. # See LICENSE for details. import json from StringIO import StringIO from twisted.application import service from twisted.internet import defer, address from twisted.python import filepath, failure from twisted.trial import unittest from twisted.web im...
StarcoderdataPython
1707626
import cv2 import numpy import pyopencl from proc_tex.OpenCLCellNoise2D import OpenCLCellNoise2D import proc_tex.texture_transforms from proc_tex.texture_transforms import tex_scale_to_region, tex_to_dtype if __name__ == '__main__': cl_context = pyopencl.create_some_context() texture = OpenCLCellNoise2D(cl_contex...
StarcoderdataPython
3354664
# O(n) time | O(n) space def runLengthEncoding(string): encodedString = [] currentRun = 1 for i in range(1, len(string)): prevChar = string[i-1] currChar = string[i] if prevChar != currChar or currentRun == 9: encodedString.append(str(currentRun)) encodedStrin...
StarcoderdataPython
3397873
<filename>Python/Christmas -tree.py def input_value(bar): foo = input(bar) foo = check_num(foo, bar) return foo def check_num(foo, bar): try: foo = int(foo) if int(foo) > 0: return foo else: error_msg(foo) foo = input(bar) return ...
StarcoderdataPython
4808371
from pylab import * from PIL import Image import numpy as np from scipy.ndimage import filters, measurements, morphology # standard_deviation越大,越模糊 def gaussian_filter(img_path, standard_deviation): """ 高斯模糊 :param img_path: 原图像路径 :param standard_deviation: 越大越模糊 :return: """ origin_img = ...
StarcoderdataPython
3290448
<reponame>aspose-slides/Aspose.Slides-for-Python-via-.NET import aspose.slides as slides def charts_showing_display_unit_label(): #ExStart:ShowingDisplayUnitLabel outDir = "./examples/out/" with slides.Presentation() as pres: chart = pres.slides[0].shapes.add_chart(slides.charts.ChartType.CLUSTERED_COLUMN, 50, 5...
StarcoderdataPython
1670336
import asyncio import json import logging import signal as signals from hashlib import sha256 import yaml from hbmqtt.client import ClientException, MQTTClient from hbmqtt.mqtt.constants import QOS_1 from jinja2 import Template from .control import Controller _LOG = logging.getLogger(__name__) class Server: de...
StarcoderdataPython
1631358
#!/usr/bin/env python3 # <http://dbpedia.org/resource/Aristotle> <http://xmlns.com/foaf/0.1/name> "Aristotle"@en . import sys for line in sys.stdin: if '/name' in line: first = line.find('"') next = line.find('"', first+1) name = line[first+1:next] if not name: continu...
StarcoderdataPython
187233
<gh_stars>0 import os import zipfile CBZ = '{}_ch{:0>3}.cbz' def make_cbz(imgs, manga, chapter): print(f'-> Creating CBZ of {manga} chapter {chapter}...', flush=True) with zipfile.ZipFile(CBZ.format(manga, chapter), 'w') as zip: for img in imgs: zip.write(img) os.remove(img)
StarcoderdataPython
1630808
<gh_stars>0 prog = 'R3, L2, L2, R4, L1, R2, R3, R4, L2, R4, L2, L5, L1, R5, R2, R2, L1, R4, R1, L5, L3, R4, R3, R1, L1, L5, L4, L2, R5, L3, L4, R3, R1, L3, R1, L3, R3, L4, R2, R5, L190, R2, L3, R47, R4, L3, R78, L1, R3, R190, R4, L3, R4, R2, R5, R3, R4, R3, L1, L4, R3, L4, R1, L4, L5, R3, L3, L4, R1, R2, L4, L3, R3, R3...
StarcoderdataPython
3250185
# -*- coding: utf-8 -*- """ The MIT License (MIT) Copyright (c) 2018 Zuse Institute Berlin, www.zib.de Permissions are granted as stated in the license file you have obtained with this software. If you find the library useful for your purpose, please refer to README.md for how to cite IPET. @author: <NAME> """ impor...
StarcoderdataPython
4825745
<gh_stars>0 import numpy as np class Graph_data_container: def __init__(self, x:np.ndarray, y:np.ndarray, label:str) -> None: self.x = x self.y = y self.label = label @property def xs_lim(self): x_l = np.floor(np.log10 (max(1, min(self.x)) )) x_u = np.ceil(n...
StarcoderdataPython
1756580
# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # from textwrap import dedent from typing import Optional, Sequence import libcst as cst import libcst.matchers as m import libcst.metadata...
StarcoderdataPython
1783002
<filename>src/main.py def main(): import sys, time, random try: import pygame except ImportError as ex: print("Please install pygame - it is a required module!") return from player import Player from banana import Banana from label import Label from projectile import ...
StarcoderdataPython
3291335
import numpy as np pipe = np.zeros((2000, 2000), dtype=np.uint8).astype('?') with open("12.txt") as f: for line in f: a = line.strip().split(' <-> ') i = int(a[0]) b = list(map(int, a[1].split(', '))) for j in b: pipe[i, j] = pipe[j, i] = True def connected(i): retur...
StarcoderdataPython
3248660
<reponame>kberkey/ccal<filename>ccal/update_variant_dict.py from .get_allelic_frequencies import get_allelic_frequencies from .get_genotype import get_genotype from .get_maf_variant_classification import get_maf_variant_classification from .get_population_allelic_frequencies import get_population_allelic_frequencies fr...
StarcoderdataPython
1790405
from conans import ConanFile class RapidJSONConan(ConanFile): name = "RapidJSON" version = "1.0.2" license = "MIT, https://github.com/miloyip/rapidjson/blob/master/license.txt" url = "https://github.com/miloyip/rapidjson/" def source(self): self.output.info("") self.output.info("---------- source ----------"...
StarcoderdataPython
3293669
<gh_stars>1-10 """ 0088. Merge Sorted Array Array Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array. Note: The number of elements initialized in nums1 and nums2 are m and n respectively. You may assume that nums1 has enough space (size that is greater or equal to m + n) to ...
StarcoderdataPython
98110
from .merge_result_infos import merge_result_infos from .field_to_fc import field_to_fc from .html_doc import html_doc from .unitary_field import unitary_field from .extract_field import extract_field from .bind_support import bind_support from .scalars_to_field import scalars_to_field from .change_location impo...
StarcoderdataPython
44625
<gh_stars>0 import os from gtts import gTTS from pathlib import Path def generate_audio_file_from_text( text, file_name, file_type="mp3", language="en", slow=False ): audio = gTTS(text=text, lang=language, slow=slow) file_path = os.path.join( Path().absolute(), "media", "common_responses", f"{f...
StarcoderdataPython
3335352
# *_*coding:utf-8 *_* import os import sys from os import makedirs from os.path import exists, join BASE_DIR = os.path.dirname(os.path.abspath(__file__)) ROOT_DIR = os.path.dirname(BASE_DIR) sys.path.append(BASE_DIR) sys.path.append(os.path.join(ROOT_DIR, 'models')) sys.path.append(os.path.join(ROOT_DIR, 'utils')) from...
StarcoderdataPython
155389
import discord from discord.ext import commands from random import choice as rndchoice from .utils import checks import os class Succ: """Succ command.""" def __init__(self, bot): self.bot = bot @commands.group(pass_context=True, invoke_without_command=True) async def givemethesucc(self, ctx...
StarcoderdataPython
1600018
<reponame>djt5019/episode_renamer<filename>setup.py<gh_stars>0 #!/usr/bin/env python from setuptools import find_packages, setup from eplist import __author__ as author from eplist import __email__ as email from eplist import __version__ as version import sys info = sys.version_info if (info.major, in...
StarcoderdataPython
3258703
<reponame>thumbor/thumbor-aws<gh_stars>1-10 #!/usr/bin/python # -*- coding: utf-8 -*- # thumbor aws extensions # https://github.com/thumbor/thumbor-aws # Licensed under the MIT license: # http://www.opensource.org/licenses/mit-license # Copyright (c) 2021 <NAME> <EMAIL> from uuid import uuid4 import pytest from pre...
StarcoderdataPython
3207379
<reponame>qq4215279/study_python<gh_stars>0 import pickle a1 = "高淇" a2 = 234 a3 = [10,20,30,40] with open("data.dat","wb") as f: pickle.dump(a1,f) pickle.dump(a2,f) pickle.dump(a3,f) with open("data.dat","rb") as f: b1 = pickle.load(f);b2 = pickle.load(f);b3 = pickle.load(f) print(b1);print(b2);p...
StarcoderdataPython
1693583
<reponame>JouleCai/GeoSpaceLab<gh_stars>10-100 class Panel(object): def __init__(self): pass def add_line(self): pass def add_image(self): pass def add_pcolor(self): pass def add_scatter(self): pass
StarcoderdataPython
4810751
<filename>metrician/monitors/__init__.py from .OOD import *
StarcoderdataPython
14633
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ## # # See COPYING file distributed along with the PyMVPA package for the # copyright and license terms. # ### ### ### ### ###...
StarcoderdataPython
1600130
def make_shirt(message, size="M"): """[Exibe uma camisa com tamanho e uma mensagem personalizados] Args: size ([string]): [Tamanho da camisa] message ([string]): [Mensagem personalizada] """ print("Your shirt is ready.") print(f"The size is {size} and the printed message is '{messag...
StarcoderdataPython
3208234
''' Created on 13.01.2016 @author: Asthmet ''' import plot_class import random class Minesweeper: ''' Constructor of the class: start the game for you ''' def __init__( self, lines = 10, cols = 10 ): self._lines = lines self._cols = cols self._map = [ [plot_class.Plot() for i in range...
StarcoderdataPython
1601320
<reponame>SpaceNetChallenge/SpaceNet_Optimized_Routing_Solutions import numpy as np import torch import torch.nn as nn class Accuracy(nn.Module): def __init__(self): super().__init__() def forward(self, logits: torch.Tensor, labels: torch.Tensor) -> float: assert len(logits.size()) == 2 ...
StarcoderdataPython
191807
""" Agent module """ from random import randint, random import numpy as np def q_learning(environment, learning_rate, gamma, total_iteration, show=False): """ Q-learning: An off-policy TD control algorithm as described in Reinforcement Learning: An Introduction" 1998 p158 by <NAME> https://web.stanford...
StarcoderdataPython
4809040
<filename>Python/pascalT.py # Print Pascal's Triangle in Python from math import factorial n = int(input("Enter the no of rows: ")) for i in range(n): for j in range(n-i+1): print(end=" ") for j in range(i+1): # nCr = n!/((n-r)!*r!) print(factorial(i)//(factorial(j)*factorial(i-j)), end=...
StarcoderdataPython
3302508
##@package client #@author <NAME> import asyncio,websockets import traceback from .iginterface import interact as IGInteract from .lgiinterface import interact as LGIInteract from .giinterface import interact as GIInteract from .ggrinterface import interact as GGRInteract from .gdrinterface import interact ...
StarcoderdataPython
137071
<filename>Data/GalZoo2_TFrecords.py import numpy as np import tensorflow as tf from astropy.io import fits import matplotlib.image as mpimg from skimage.transform import rescale from skimage.color import rgb2gray from numpy.random import choice from skimage.exposure import rescale_intensity import sys from multiprocess...
StarcoderdataPython
174892
<filename>component/widget/date_range_slider.py from sepal_ui import sepalwidgets as sw import ipyvuetify as v from component import parameter as cp class DateRangeSlider(sw.SepalWidget, v.Layout): def __init__(self, dates=None, **kwargs): # save the dates values self.dates = dates...
StarcoderdataPython
89942
from model.contact import Contact import re from random import randrange def test_contact_data_for_random_contact(app): if app.contact.count() == 0: app.contact.create(Contact(firstname="John", lastname="Connor", address=("%s, %s %s" % ("Los Angeles", str(randrange(1000)), "Nickel Road")), workphone="w4465...
StarcoderdataPython
1673479
<reponame>yansinan/pycameresp #!/usr/bin/python3 # Distributed under MIT License # Copyright (c) 2021 <NAME> # pylint:disable=multiple-statements # pylint:disable=too-many-lines """ Class defining a VT100 text editor. This editor works directly in the board. This allows you to make quick and easy changes directly on th...
StarcoderdataPython
3309964
"""Routes configuration The more specific and detailed routes should be defined first so they may take precedent over the more generic routes. For more information refer to the routes manual at http://routes.groovie.org/docs/ """ from routes import Mapper def make_map(config): """Create, configure and return the ...
StarcoderdataPython
47332
<reponame>Akash1S/meethub # Generated by Django 2.0.4 on 2018-05-28 20:33 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('events', '0009_auto_20180428_0845'), ] operations = [ migrations.RemoveField( model_name='comment', ...
StarcoderdataPython
3201603
import tensorflow as tf import rlcard from rlcard.agents.dqn_agent import DQNAgent from rlcard.utils.utils import set_global_seed from rlcard.utils.logger import Logger # Make environment # Set the the number of steps for collecting normalization statistics # and intial memory size memory_init_size = 1000 norm_step ...
StarcoderdataPython
3384348
# -*- coding: utf-8 -*- """ Created on Mon Apr 18 11:42:58 2016 @author: utkarsh """ import numpy as np import sys from FingerprintImageEnhancer import FingerprintImageEnhancer import cv2 # if __name__ == '__main__': # image_enhancer = FingerprintImageEnhancer() # Create object called image_enhancer # ...
StarcoderdataPython
3341768
<reponame>mrbot-ai/deep_qa from .babi_instance import BabiInstance, IndexedBabiInstance from .multiple_true_false_instance import MultipleTrueFalseInstance, IndexedMultipleTrueFalseInstance from .multiple_true_false_instance import convert_dataset_to_multiple_true_false from .question_answer_instance import QuestionAns...
StarcoderdataPython
3221901
from setuptools import setup from setuptools.command.install import install import subprocess class NPMInstall(install): """ NPMInstall installs the packages in `package.json` which are `topojson-client` and `topojson-server` used to convert between geojson and topojson """ def run(self): ...
StarcoderdataPython
3235997
<reponame>ubcgif/notebooks<gh_stars>0 import sys sys.path.append("./simpeg") sys.path.append("./simpegdc/") import warnings warnings.filterwarnings('ignore') from SimPEG import Mesh, Maps import numpy as np import simpegDCIP as DC import matplotlib import matplotlib.pyplot as plt import matplotlib.pylab as pylab imp...
StarcoderdataPython
4835408
<gh_stars>1-10 class Vertex: def __init__(self, x): self._val = x def element(self): return self._val def __hash__(self): return hash(id(self)) class Edges: def __init__(self, o, d, x=None): self._ori = o self._des = d self._val = x def startpoint(self): return self._ori def endpoint(self): ...
StarcoderdataPython
1785363
<gh_stars>10-100 import importlib.util import pkg_resources class ModuleChecker: def find_module(self, module): """Search for modules specification.""" try: return importlib.util.find_spec(module) except ImportError: return None def find_distribution(self, di...
StarcoderdataPython
1627494
<reponame>timgates42/ramses<gh_stars>100-1000 import pytest from mock import Mock, patch from ramses import utils class TestUtils(object): def test_contenttypes(self): assert utils.ContentTypes.JSON == 'application/json' assert utils.ContentTypes.TEXT_XML == 'text/xml' assert utils.Conte...
StarcoderdataPython
1615923
<filename>fabfile.py import os import json import subprocess import shlex import time import signal import urllib2 from fabric.api import run, local, settings, cd, sudo, task, output, puts, prefix from fabric.contrib.project import upload_project from fabric.contrib.files import append, upload_template APPS = 'api c...
StarcoderdataPython
91529
import ctypes import functools import random import struct from fcntl import ioctl from trio import socket from wrath.bpf import create_filter IP_VERSION = 4 IP_IHL = 5 IP_DSCP = 0 IP_ECN = 0 IP_TOTAL_LEN = 40 IP_ID = 0x1337 IP_FLAGS = 0x2 # DF IP_FRAGMENT_OFFSET = 0 IP_TTL = 255 IP_PROTOCOL = 6 # TCP IP_CHECKSUM...
StarcoderdataPython
1624434
# Import all libraries we will use import random import numpy as np import cv2 def create_image(p): # let's create a heigth x width matrix with all pixels in black color heigth = 1080 width = 1920 diameter = 50 x_correction = int(0.7 * diameter / 2) y_correction = int(0.7 * diameter / 2) ...
StarcoderdataPython
4831257
<reponame>limn2o4/analytics-zoo # # Copyright 2018 Analytics Zoo Authors. # # 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
1622512
<reponame>igushev/fase_lib """Auto-generated file, do not edit by hand. ER metadata""" from ..phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata PHONE_METADATA_ER = PhoneMetadata(id='ER', country_code=291, international_prefix='00', general_desc=PhoneNumberDesc(national_number_pattern='[178]\\d{6}',...
StarcoderdataPython
3392171
<reponame>Hacker-Davinci/Python_Automate_The_Boring_Stuff_Practice ### this is about the dictionary. #let's practice a small project about storing birthdays. ## dictionary .key(), .value(), .item() birthdays = {'Alice': 'Apr 1', 'Bob': 'Dec 12', 'Carol': 'Mar 4'} while True: print('Enter a name (blank to qui...
StarcoderdataPython
167711
<filename>nets/chimney_cnn.py from __future__ import absolute_import from __future__ import division from __future__ import print_function import math import tensorflow as tf import tensorflow.contrib.slim as slim model_params = { 'basic': ([0, 0, 0, 0], [16, 32, 64, 128]), 'test': ([0, 1, 2, 3, 2], [64, [64,...
StarcoderdataPython
171854
"""The Matrix bot component.""" import asyncio import logging import mimetypes import os import tempfile import aiofiles import aiofiles.os import aiohttp import ffmpeg import homeassistant.components.notify as hanotify import homeassistant.const as haconst import homeassistant.helpers.config_validation as cv import ...
StarcoderdataPython