id
stringlengths
2
8
text
stringlengths
16
264k
dataset_id
stringclasses
1 value
9786411
<filename>setup.py from setuptools import setup setup( name='bidsio', version='0.1.0', packages=['bidsio'], url='https://github.com/npnl/bidsio', license='Apache 2.0', author='<NAME>', install_requires=[ 'numpy', 'nibabel', 'bids' ], author_email='<EMAIL>', ...
StarcoderdataPython
5095417
<reponame>manzanero/curso-python-auto<filename>testbdd/steps/renfe.py<gh_stars>1-10 import time from behave import * from selenium.webdriver.common.by import By from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.action_chains import ActionChains use_step_matcher("re") @given(u'estoy en e...
StarcoderdataPython
9773353
# Copyright 2017 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import logging import models # About linker maps: # * "Discarded input sections" include symbols merged with other symbols # (aliases), so the informatio...
StarcoderdataPython
3433911
<gh_stars>0 import streamlit as st import numpy as np import pandas as pd import keras from keras.utils.np_utils import to_categorical from keras.models import Sequential, load_model from tensorflow.keras.layers import Conv2D, Flatten, Dense, MaxPool2D from keras import backend as K import time import io from PIL impor...
StarcoderdataPython
4835326
<reponame>RyanJarv/Pacu2 # generated by datamodel-codegen: # filename: openapi.yaml # timestamp: 2021-12-31T02:50:26+00:00 from __future__ import annotations from typing import Annotated, Any, List, Optional from pydantic import BaseModel, Field, SecretStr class ResourceNotFoundException(BaseModel): __roo...
StarcoderdataPython
6406146
<gh_stars>0 # %% import numpy as np import matplotlib.pyplot as plt from scipy.fft import ifft,fft from scipy.fftpack import fftshift from scipy.signal import firwin, filtfilt # %% def LPF(n, fcut): ''' Use Hamming window to design a n-th order LPF Parameters ---------- n: Filter order f...
StarcoderdataPython
288516
<filename>server/gcalendar.py """ Shows basic usage of the Google Calendar API. Creates a Google Calendar API service object and outputs a list of the next 10 events on the user's calendar. """ from googleapiclient import discovery import datetime import json with open("../secrets/keys.json") as f: secrets = json...
StarcoderdataPython
5176261
<reponame>trcooke/57-exercises-python<filename>src/exercises/Ex03_printing_quotes/test_quotes.py import unittest from exercises.Ex03_printing_quotes import quotes class TestQuotes(unittest.TestCase): def test_givenPlainQuote_returnQuotationOutput(self): self.assertEqual(quotes.quotation('<NAME>', 'If in ...
StarcoderdataPython
4903669
<filename>tests/test_wxpython.py import pytest import psidialogs from test_dialogs import check backend = "wxpython" if backend in psidialogs.backends(): if psidialogs.util.check_import("wx"): @pytest.mark.parametrize("dialogtype", psidialogs.dialog_types()) def test_wxpython(dialogtype): ...
StarcoderdataPython
4908818
<reponame>sah-py/exercises<gh_stars>0 # Class with the coordinates of the shapes # Existing shapes: # Cube # Square # Pyramid # Triangular pyramid # Triangular prism class Shapes: def __init__(self, grid): self.grid = grid self.shape = {} def cube(self, x=1, y=1, ln=3)...
StarcoderdataPython
8143511
<gh_stars>0 from . import domain from . import poisson from . import ins from . import imbound from . import quantum from . import io
StarcoderdataPython
11382218
""" Given a word W and a string S, find all starting indices in S which are anagrams of W. For example, given that W is "ab", and S is "abxaba", return 0, 3, and 4 """ MAX = 256 def compare(arr1, arr2): print('arr1 ', arr1) print('arr2 ', arr2) for i in range(MAX): if arr1[i] != arr2[i]: ...
StarcoderdataPython
3450566
<filename>train_utils.py<gh_stars>0 import torch import torch.nn.functional as F import os from metrics_check import check_error_equal_rate, check_error_equal_rate2 def checkpoint_(epoch, model, optimizer, path): """ Read checkpoint example: state = torch.load(filepath) model.load_stat...
StarcoderdataPython
1962050
<gh_stars>0 import torch LOG_NORMAL_ZERO_THRESHOLD = 1e-5 pi_val = torch.acos(torch.zeros(1)).item() * 2
StarcoderdataPython
3382650
<reponame>issca/inferbeddings<gh_stars>10-100 # -*- coding: utf-8 -*- import pytest import inferbeddings.parse.clauses as clauses @pytest.mark.light def test_parse_clauses_one(): clause_str = 'p(x, y) :- p(x, z), q(z, a), r(a, y)' parsed = clauses.grammar.parse(clause_str) clause = clauses.ClauseVisito...
StarcoderdataPython
12811722
from __future__ import print_function, division import sys,os qspin_path = os.path.join(os.getcwd(),"../") sys.path.insert(0,qspin_path) from quspin.basis import spin_basis_1d, boson_basis_1d, spinless_fermion_basis_1d, spinful_fermion_basis_1d from quspin.basis import spin_basis_general, boson_basis_general, spinles...
StarcoderdataPython
379394
<reponame>FurkanOzkaya/ParkApi from gc import get_objects from math import atan2, cos, radians, sin, sqrt from app.models import ParkModel from app.api.serializers import ParkSerializer from rest_framework import status from rest_framework.response import Response from rest_framework.views import APIView R = 6373.0 #...
StarcoderdataPython
5070884
print("Please enter feeding map as a list:") harita = input() h1 = harita.replace("[" , " ") h2 = h1.replace("]" , " ") h3 = h2.strip() h4 = h3.replace("'" , "") h5 = h4.split(" , ") gor1 = h4.replace(" , " , "---") gor2 = gor1.replace(" " , " ") gor3 = gor2.replace("," , "") Show_map = gor3.replace("---" ,...
StarcoderdataPython
5080705
<reponame>SolidStateGroup/Bullet-Train-API # Generated by Django 2.2.25 on 2022-01-14 17:49 from django.db import migrations, models import django.db.models.deletion import django_lifecycle.mixins import environments.api_keys class Migration(migrations.Migration): dependencies = [ ('environments', '0016...
StarcoderdataPython
1602213
<filename>InterviewCake/StockPrice.py class StockPrice: def get_max_profit(self, stock_prices_yesterday): # make sure we have at least 2 prices if len(stock_prices_yesterday) < 2: raise IndexError('Getting a profit requires at least 2 prices') min_price = stock_prices_yesterday...
StarcoderdataPython
5094080
<reponame>parrisma/TicTacToe-DeepLearning import logging import random import numpy as np from reflrn.Interface.ReplayMemory import ReplayMemory from reflrn.Interface.State import State # # Manage the shared replay memory between {n} actors in an Actor/Critic model. # # ToDo: Consider https://github.com/robtandy/ra...
StarcoderdataPython
4926488
data = [ { "img": "https://i.imgur.com/CidvAPT.png", }, { "img": "https://i.imgur.com/oiT1TNx.png", }, { "img": "https://i.imgur.com/W2ox2xI.png", }, { "img": "https://i.imgur.com/WOamDpN.png", }, { "img": "https://i.imgur.com/MSRh0eP.jpg",...
StarcoderdataPython
6415203
#! /usr/bin/env python # -*- coding: utf-8 -*- """ Copyright (C) 2017 IBM 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 ...
StarcoderdataPython
8115124
# BE THE JODI MAKER for _ in range(int(input())): d = {} for i in range(int(input())): A = [a for a in input().split()] d[A[0]] = A[1] if i==0: s = A[0] #print(d) n = i+1 ct = 0 s1 = s f = 1 #print(s1,s,n) while ct<n: if s ...
StarcoderdataPython
12804939
#!/usr/bin/env python from setuptools import find_packages, setup try: import ConfigParser as configparser except ImportError: import configparser with open("README.rst") as f: LONG_DESCRIPTION = f.read() config = configparser.ConfigParser() config.read("setup.cfg") setup( name="gits", version=c...
StarcoderdataPython
1729457
<filename>surprise/genre_similarities.py import numpy as np import pandas as pd import rdkit.Chem as Chem def compute_f_matrix(user_based, trainset, genre_file): """ Compute (n_x)-by-(n_g) matrix of relative frequencies in pd.Data.Frame, where n_x is the size of users if user_based is True; n_x...
StarcoderdataPython
3412251
<filename>run.py import sc2, sys from __init__ import run_ladder_game from sc2 import Race, Difficulty from sc2.player import Bot, Computer, Human import random # Load bot from Overmind import Overmind bot = Bot(Race.Zerg, Overmind()) # Start game if __name__ == '__main__': if "--LadderServer" in sys.argv: ...
StarcoderdataPython
117857
<reponame>cariad/stackwhy<filename>tests/test_cli.py from io import StringIO from mock import Mock from stackwhy.cli import entry valid_arn = "arn:aws:cloudformation:eu-west-2:000000000000:stack/X/00000000-0000-0000-0000-000000000000" def test_help() -> None: writer = StringIO() assert entry([], session=Mo...
StarcoderdataPython
11364759
from flask_sqlalchemy import SQLAlchemy db = SQLAlchemy() # abstract base class for inheritance class Base(db.Model): __abstract__ = True id = db.Column(db.Integer, primary_key=True, autoincrement=True) date_created = db.Column(db.DateTime, default=db.func.current_timestamp()) date_modified = db.Colu...
StarcoderdataPython
1968109
<gh_stars>0 from pymongo import MongoClient import sys solution = { 'coder_id': 123, 'task_id': 12, 'solution': 'def subtract(x, y):\n return x - y\n', 'test_cases': 'assert subtract(5, 3) == 2\nassert subtract(7, 4) == 3\n', 'status': 'edited', 'language': 'Python' } def populate_db(solu...
StarcoderdataPython
9777265
<gh_stars>100-1000 import os import copy import numpy as np import tensorflow as tf from tensorflow.keras.layers import Dense, Flatten, Conv2D, Reshape, Dropout from tensorflow.keras import Model def get_hyperparams(): local_params = { 'training': { 'epochs': 3 } } return...
StarcoderdataPython
269497
#!/usr/bin/python # API Gateway Ansible Modules # # Modules in this project allow management of the AWS API Gateway service. # # Authors: # - <NAME> <github: bjfelton> # # apigw_resource # Manage creation, update, and removal of API Gateway Resource resources # # MIT License # # Copyright (c) 2016 <NAME>, Emerson...
StarcoderdataPython
11246938
<filename>tests/demos/demo_phrase_extractor.py<gh_stars>1000+ # # -*- coding:utf-8 -*- # Author:wancong # Date: 2018-04-30 from pyhanlp import * def demo_phrase_extractor(text): """ 短语提取 >>> text = ''' ... 算法工程师 ... 算法(Algorithm)是一系列解决问题的清晰指令,也就是说,能够对一定规范的输入,在有限时间内获得所要求的输出。 ... 如果一个算法有缺陷,或不适合于...
StarcoderdataPython
6620488
<gh_stars>1-10 import ast import collections import re def read_text_file(filename, encoding='utf-8'): with open(filename, 'r', encoding=encoding) as file: return file.read() def parse_version_requirement(text, expect_major): version = text.split('.') if not all(re.fullmatch(r'[0-9]+...
StarcoderdataPython
12849603
import geoflow1D from geoflow1D.GridModule import * from geoflow1D.FieldsModule import * from geoflow1D.LinearSystemModule import * from geoflow1D.GeoModule import * from geoflow1D.SolverModule import * import numpy as np from matplotlib import pyplot as plt # -------------- PROBLEM ILLUSTRATION ----------------- # ...
StarcoderdataPython
3360171
# This script is used as a bitbake task to create a new python manifest # $ bitbake python -c create_manifest # # Our goal is to keep python-core as small as posible and add other python # packages only when the user needs them, hence why we split upstream python # into several packages. # # In a very simplistic way wh...
StarcoderdataPython
5178443
<reponame>cpezzato/discrete_active_inference #! /usr/bin/env python import sys import copy import rospy import moveit_commander import moveit_msgs.msg import geometry_msgs.msg from math import pi from std_msgs.msg import String from moveit_commander.conversions import pose_to_list from visualization_msgs.msg import Ma...
StarcoderdataPython
3548193
n, t = map(int, input().split()) nums = set(map(int, input().split())) years = set(map(int, input().split())) for i in years: if i in nums: print("Yes") else: print("No")
StarcoderdataPython
158950
<reponame>JojoReikun/ClimbingLizardDLCAnalysis<filename>lizardanalysis/calculations/hip_and_shoulder_angles.py<gh_stars>1-10 def hip_and_shoulder_angles(**kwargs): """ calculates the shoulder and hip angles for every frame. Shoulder angle: angle between shoulder vector (FORE: Shoulder<->Shoulder_foot or ...
StarcoderdataPython
11286236
#%% import numpy as np import pandas as pd import altair as alt import anthro.io # Generate a plot for global atmospheric SF6 concentration from NOAA GML data data = pd.read_csv('../processed/monthly_global_sf6_data_processed.csv') data['date'] = pd.to_datetime(data['year'].astype(str) + data['month'].astype(str),...
StarcoderdataPython
284569
<reponame>david-soto-m/Pycodoc #!/usr/bin/python3 # An installer that will create a dektop file and add it to your apps menu from pathlib import Path from os import geteuid def main(): path1 = str(Path(__file__).parent.resolve()) + '/main.py' path2 = str( Path(__file__).parent.resolve() / 'dat...
StarcoderdataPython
5101727
""" Models of energy storage systems Two types of energy storage systems are supported. 1) Battery energy storage system (BESS) 2) Thermal energy storage system (TESS) """ import configuration.configuration_default_ess as default_parameters BESS =\ { #1) Static information "ID": default_parameters.BESS["AREA"], ...
StarcoderdataPython
3534142
<reponame>mc18g13/teensy-drone import matplotlib.pyplot as plt import numpy as np import csv import sys commandLineArg = sys.argv[1] with open(commandLineArg, newline = '') as motorData: reader = csv.reader(motorData, delimiter=' ') columnCount = len(next(reader)) pairCount = int(columnCount/2) print(pai...
StarcoderdataPython
3558295
#!/usr/bin/env python # -*- coding: utf-8 -*- """The setup script.""" from setuptools import find_packages, setup with open("README.md") as readme_file: readme = readme_file.read() test_requirements = [ "codecov", "flake8", "black", "pytest", "pytest-cov", "pytest-raises", "quilt3==3...
StarcoderdataPython
11360709
from django.conf import settings from django.contrib.auth.models import User from django.contrib.auth.decorators import login_required from django.contrib.postgres.search import SearchQuery from django.contrib.postgres.search import SearchVector from django.core.files.storage import get_storage_class from django.db imp...
StarcoderdataPython
130113
from typing import Any from typing import Dict from typing import Generic from typing import List from typing import Optional from typing import Tuple from typing import Type from typing import TypeVar import attr from xsdata.exceptions import XmlContextError from xsdata.formats.dataclass.compat import ClassType from ...
StarcoderdataPython
3211091
# Importar spacy e criar o objeto nlp do Português import ____ nlp = ____ # Processar o texto doc = ____("Eu gosto de gatos e cachorros.") # Selecionar o primeiro token first_token = doc[____] # Imprimir o texto do primeito token print(first_token.____)
StarcoderdataPython
1821195
<reponame>DunnCreativeSS/cash_carry_leveraged_futures_arbitrageur<gh_stars>1-10 ''' Copyright (C) 2017-2020 <NAME> - <EMAIL> Please see the LICENSE file for the terms and conditions associated with this software. Pair generation code for exchanges ''' import logging import requests from cryptofeed....
StarcoderdataPython
6633389
# -*- coding: utf-8 -*- """ Profile: http://hl7.org/fhir/StructureDefinition/Goal Release: STU3 Version: 3.0.2 Revision: 11917 Last updated: 2019-10-24T11:53:00+11:00 """ import io import json import os import unittest import pytest from .. import goal from ..fhirdate import FHIRDate from .fixtures import force_byte...
StarcoderdataPython
3527185
<filename>dod/__init__.py<gh_stars>1-10 from .character_sheet import CharacterSheet __all__ = ["CharacterSheet"]
StarcoderdataPython
4999532
<filename>EpcisIoT/documentdb.py import logging from pymongo import DESCENDING logging.basicConfig(level=logging.DEBUG) logger = logging.getLogger(__name__) def obtain_time_duration(collection, new_document): """obtain a time duration between the recent events of the same bizLocation :param: colle...
StarcoderdataPython
3426002
password_database = """15-16 l: klfbblslvjclmlnqklvg 6-13 h: pghjchdxhnjhjd 4-13 n: nnznntzznqnzbtzj 10-16 r: nrrrrkrjtxwrrrwx 1-6 t: rttftttttttttmdttttt 4-12 l: zhllfxlmvqtnhx 6-8 d: wxpwgdbjtffddkb 7-9 q: rqcqxjqhsm 6-8 x: xxxfxdxxx 5-9 d: dwnwnbsddfmc 2-6 j: jvdrrjchml 8-10 x: xxxcxxxzxxxxx 15-16 f: ffffffffffffffn...
StarcoderdataPython
9625584
<gh_stars>100-1000 """ Save a bunch of random samples of each of our models to put up on the website while we figure out how to host the actual TensorFlow models. """ import tensorflow as tf from os.path import join import getopt import sys from LSTMModel import LSTMModel from data_reader import DataReader import con...
StarcoderdataPython
1794049
#!/usr/bin/env python3 import argparse def set_input_args(logger): """ Setup Parser Arguments """ parser = argparse.ArgumentParser( usage="python3 run.py --path=/tmp/foo/ --scheme=http --host=127.0.0.1 --port=8000 \ --api_version=1 --api_user=exampleUser --api_password=<PASSWORD>", ...
StarcoderdataPython
1911496
#!/usr/bin/env python3 import base64 import os import io import re import sqlite3 import json import requests import xml.etree.ElementTree as ET from datetime import datetime from collections import deque from urllib.parse import quote_plus, unquote_plus from flask import Flask, request, redirect, url_for, flash, Respo...
StarcoderdataPython
5042746
<reponame>xolynrac/examen_final_4c<filename>src/structurizr/model/perspective.py # Copyright (c) 2020, <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 # # https://www.apache.org/l...
StarcoderdataPython
11484
<reponame>spacerunaway/world_recoder import sys sys.path.append('../utils') from utils import * from doubly_linkedlist import * def link_chords(chordprogression): """ Chord progression is a sequences of chords. A valid linked_chords can be one of the following: 1: the chord name(str) in CHORD dict ...
StarcoderdataPython
6425192
from django.urls import path from . import views from django.contrib.auth import views as auth urlpatterns = [ path('login/', views.mylogin, name="login"), path('register/', views.myregister, name="register"), path('logout/', auth.LogoutView.as_view(next_page="home"), name="logout"), ]
StarcoderdataPython
255667
from splinter import Browser from bs4 import BeautifulSoup as bs import pandas as pd import requests from selenium import webdriver # Initialize browser def init_browser(): # @NOTE: Replace the path with your actual path to the chromedriver executable_path = {"executable_path": "chromedriver"} retu...
StarcoderdataPython
6533989
<filename>dimdrop/layers/__init__.py from .clustering_layer import ClusteringLayer __all__ = [ 'ClusteringLayer' ]
StarcoderdataPython
3324726
__all__ = ["Settings", "AppCommonContainer", "App", "Server", "BasicResponse"]
StarcoderdataPython
3468430
<filename>sdk/bento/example/mountcar.py # # bentobox-sdk # mountain car example simulation # from bento import types from bento.graph.plotter import Plotter from bento.spec.ecs import ComponentDef, EntityDef from bento.example.specs import Velocity, Position from bento.sim import Simulation from bento.spec.sim import...
StarcoderdataPython
1793097
<reponame>WilliamMayor/scytale.xyz<gh_stars>1-10 from scytale.ciphers.base import Cipher from scytale.exceptions import ScytaleError class RailFence(Cipher): name = "RailFence" default = 5 def __init__(self, key=None): self.key = self.validate(key) def validate(self, key): if key is ...
StarcoderdataPython
5069081
#!/usr/bin/env python #coding=utf-8 import os import time from instapush import Instapush, App class InstaPushNotify(): @staticmethod def notify(title, check_num=0, type_info=1): app = App(appid=os.getenv('instapush_id'), secret=os.getenv('instapush_secret')) try: if type_info =...
StarcoderdataPython
6469220
<filename>mamba/sema/types.py class Type(object): def __init__(self, description=None): self._description = description def specialized(self, args: dict): return SpecializedType(type=self, args=args) def equals(self, other, memo: dict = None) -> bool: return self is other def...
StarcoderdataPython
1719107
class dots(object): def get_keyword_names(self): return ['In.name.conflict'] def run_keyword(self, name, args): return '-'.join(args)
StarcoderdataPython
4978213
import unittest from rover import Rover, Move, Turn from rover import Orientation class RoverTests(unittest.TestCase): def test_should_create_new_rover_with_default_coordinates(self): r = Rover() self.assertEquals(r.position, (0, 0)) def test_should_create_new_rover_with_default_direction(...
StarcoderdataPython
8025267
'''Process callbacks from users' interactions with keyboards''' from __future__ import annotations from contextlib import suppress from aiogram.utils.exceptions import MessageNotModified from .markups import sections_kb from typing import TYPE_CHECKING if TYPE_CHECKING: from aiogram import Dispatcher from ai...
StarcoderdataPython
9737282
import time from collections import Iterable import pytest from pydent.base import ModelBase from pydent.browser import Browser from pydent.browser import BrowserException from pydent.exceptions import ForbiddenRequestError NUM_MODELS = 10 def check_model_in_cache(model, cache): """Check if model is in the cac...
StarcoderdataPython
3580394
from __future__ import print_function from __future__ import unicode_literals from future import standard_library standard_library.install_aliases() from builtins import zip from builtins import object from django.core.management.base import BaseCommand, CommandError from django.core.exceptions import ObjectDoesNotExis...
StarcoderdataPython
202814
<gh_stars>0 from selenium import webdriver from selenium.webdriver.chrome.service import Service from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.by import By import time contatos = open("./contatos.txt", 'r', encoding='UTF-8') contatos = contatos.read() contatos = contatos.split('\n') p...
StarcoderdataPython
3353096
"""feusb\feusb_win32.py -- Fascinating Electronics USB CDC Library The feusb libary supports USB CDC devices from Fascinating Electronics, with useful features and error detection for USB device suspend and disconnect. Feusb does not support legacy RS232 devices or modems. This file only contains support for Windows...
StarcoderdataPython
9709154
from .kb4 import KnowBe4
StarcoderdataPython
1946708
class Tracker(): """ Tracker Class ... Attributes ---------- gold : int Hold the gold amount score : int Hold the game score Class Methods ------------- increment_gold(value: int) Increment the gold amount decrement_gold(value: int) Decremen...
StarcoderdataPython
1728897
<gh_stars>1-10 # Usage: python export_weights.py foo.net foo.caffemodel out # Will create layer files out1.h5 out2.h5 ... import sys import h5py import caffe import numpy as np net=caffe.Net(sys.argv[1], sys.argv[2], caffe.TEST) print("blobs {}\nparams {}".format(net.blobs.keys(), net.params.keys())) out=sys.argv[3] ...
StarcoderdataPython
6696029
<reponame>hnthh/foodgram-project-react import pytest from recipes.tests.share import create_recipes pytestmark = [pytest.mark.django_db] URL = '/api/recipes/' PAGINATION_PARAMS = ('count', 'next', 'previous', 'results') RECIPE_PARAMS = ( 'id', 'tags', 'author', 'ingredients', 'is_favorited', ...
StarcoderdataPython
1976770
<gh_stars>1-10 # Licensed under a 3-clause BSD style license - see LICENSE.rst """Estimators.""" from gammapy.utils.registry import Registry from .core import * from .map import * from .points import * from .profile import * ESTIMATOR_REGISTRY = Registry( [ ExcessMapEstimator, TSMapEstimator, ...
StarcoderdataPython
5062642
from hexagonal import app, db from hexagonal.model.user import User from hexagonal.auth import register_account import json app.testing = True test_client = app.test_client() def root_login(): return call('auth.login', ['root', 'toor']) def get_login_pair(): get_login_pair.cnt += 1 return ( 'te...
StarcoderdataPython
3554970
<gh_stars>10-100 import os import toml from app import CONFIG poetry_config = toml.load(f'{CONFIG.PROJECT_PATH}{os.path.sep}pyproject.toml') with open(f'{CONFIG.PROJECT_PATH}{os.path.sep}requirements.txt') as f_stream: requirements = f_stream.readlines() all_dependencies = { **poetry_config['tool']['poetr...
StarcoderdataPython
3284082
#<NAME> 11/04/18 #Iris Data Set Project #Attempts to split up, summarise and plot data set #Uses less code than previous work on the data set and generates histograms with labelled axes and titles import pandas as pd #pandas module imported import numpy as np #numpy module imported import matplotlib.pyplot as plt #mat...
StarcoderdataPython
6675780
from importlib import import_module from django.contrib.auth import SESSION_KEY, BACKEND_SESSION_KEY, HASH_SESSION_KEY def force_login(user, driver, base_url): from django.conf import settings SessionStore = import_module(settings.SESSION_ENGINE).SessionStore selenium_login_start_page = getattr(settings, ...
StarcoderdataPython
1616220
<filename>black ping flood.py #!/usr/bin/python # Simple Network Intrussion Prevention System # Sample Case: Ping Flooding # # Module Requirement: python-pcapy # testing on Ubuntu # # coded by: 5ynL0rd import pcapy import re import binascii import os import json from datetime import datetime class...
StarcoderdataPython
4931393
<reponame>xymy/gethash from typing import Any __all__ = [ "_check_int", "_check_int_opt", "_check_float", "_check_float_opt", "_check_str", "_check_str_opt", "_check_bytes", "_check_bytes_opt", "_check_bytes_w", "_check_bytes_w_opt", "_is_writable_memoryview", ] def _check...
StarcoderdataPython
3228608
<reponame>felipecerinzasick/blog import datetime import time from facebook_business.api import FacebookAdsApi from facebook_business.adobjects.adaccountuser import AdAccountUser from facebook_business.adobjects.adaccount import AdAccount from facebook_business.adobjects.adsinsights import AdsInsights from facebook_bus...
StarcoderdataPython
12835592
<reponame>emilwareus/smaland import os import pyotp def totp(secret): totp = pyotp.TOTP(secret) return totp.now()
StarcoderdataPython
11305881
from django.db import models from django.utils.translation import gettext_lazy as _ from trade_system.users.models import User from trade_system.items.models import Item from trade_system.offers.choises import OrderType class Offer(models.Model): """Request to buy or sell specific stocks""" user = models.Fore...
StarcoderdataPython
1864520
"""Contains a Reader class that can read values from Modbus TCP servers. Uses the following settings from the main settings.py file: LOGGER_ID: Used to create the final sensor_id for each value read from the Modbus server. MODBUS_TARGETS: Lists the Modbus Servers, Devices, and Registers that will be read. See furth...
StarcoderdataPython
47031
<gh_stars>0 import datetime as dt import json from typing import Dict, Optional, cast import dateutil.parser import pytest from packaging import version from great_expectations.data_context.util import file_relative_path @pytest.fixture def release_file() -> str: path: str = file_relative_path(__file__, "../.gi...
StarcoderdataPython
9708121
import numpy as np from topic_model_diversity.rbo import rbo from scipy.spatial import distance from itertools import combinations from topic_model_diversity.word_embeddings_rbo import word_embeddings_rbo def proportion_unique_words(topics, topk=10): """ compute the proportion of unique words Parameters ...
StarcoderdataPython
1636470
<filename>testproject/tests/test_add_mfa.py import pytest from django.contrib.auth import get_user_model from rest_framework.test import APIClient from tests.utils import get_token_from_response, header_template, login from trench.utils import create_otp_code, create_secret User = get_user_model() @pytest.mark....
StarcoderdataPython
5176989
# Copyright 2014-2020 Scalyr Inc. # # 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 in writin...
StarcoderdataPython
229333
#Importing Needed Stuff from pygame import * #framerate clock = time.Clock() FPS = 60 #Variables running = True paddle_width = 20 paddle_height = 80 #Game Window Set Up win_width = 700 win_height = 500 window = display.set_mode((win_width, win_height)) #Classes class GameSprite(sprite.Sprite): ...
StarcoderdataPython
6613866
<gh_stars>0 import sqlite3 fn = 'storychain.db' cnct = sqlite3.connect(fn) cnct.execute('''CREATE TABLE chains (title char(20) NOT NULL, ct INTEGER, main char(400) NOT NULL, userid text, datetime text) ''') cnct.execute('''INSERT INTO chains VALUES ("wolf", 0, "There was once a boy-wolf.", "wwshen", "2015...
StarcoderdataPython
1872661
<reponame>MaoXianXin/oneflow """ Copyright 2020 The OneFlow 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 requ...
StarcoderdataPython
11396131
<gh_stars>0 from axelrod.action import Action from axelrod.player import Player C, D = Action.C, Action.D class Defector(Player): """A player who only ever defects. Names: - Defector: [Axelrod1984]_ - ALLD: [Press2012]_ - Always defect: [Mittal2009]_ """ name = "Defector" classifie...
StarcoderdataPython
8187631
# _*_coding : UTF_8_*_ # Author :<NAME> # CreatTime :2022/1/25 11:07
StarcoderdataPython
8175431
<reponame>TheIdesofMay/lightweight-hangman import random # gets random word from list def pick_random_word(words): random_word = random.choice(words).upper() return random_word def get_input(): # error handling while True: attempt = input("Enter a letter: \n").upper() if attempt.isalpha() and len(atte...
StarcoderdataPython
317235
<reponame>pysalt/freddie<gh_stars>10-100 from typing import Type from factory import Factory from peewee import fn from psycopg2 import connect as pg_connect from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT from pydantic import BaseConfig from pytest import fixture from freddie import Schema def create_sc...
StarcoderdataPython
11234067
# Generated by Django 2.2.10 on 2020-04-07 18:38 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('core', '0002_game_player_point_word'), ] operations = [ migrations.AlterField( model_name='game', name='room', ...
StarcoderdataPython
3572988
import sys import cv2 import math import numpy as np import matplotlib.pyplot as plt from skimage.filter import sobel from sklearn.cluster import KMeans def binarize_img(img): #binarize image with k means (k=2) k = KMeans(n_clusters=2) k.fit(img.reshape((64 * 64, 1))) binarized_img = k.predict(img.r...
StarcoderdataPython