id
stringlengths
1
265
text
stringlengths
6
5.19M
dataset_id
stringclasses
7 values
3257266
import requests from flask import ( g, Blueprint, render_template, request, flash, abort, redirect, url_for, current_app, ) from sqlalchemy.exc import SQLAlchemyError from flask_login import (current_user, login_required, login_user, logout_user, confirm_login, fresh_login_required)...
StarcoderdataPython
1630914
<reponame>Tknika/iombian-tunnels-handler<gh_stars>0 #!/usr/bin/env python3 import logging import signal from communication_module import CommunicationModule from tunnel_firestore_handler import TunnelFirestoreHandler from tunnel_name_generator import TunnelNameGenerator from tunnels_handler import TunnelsHandler log...
StarcoderdataPython
120882
<reponame>norton-chris/MARS-Net ''' Author: <NAME> 7/28/2020 For segmenting edges to train deep learning segmentation model ''' import matplotlib matplotlib.use('Agg') # Must be before importing matplotlib.pyplot or pylab! import cv2 import numpy as np from skimage import io import matplotlib.pyplot a...
StarcoderdataPython
118358
<gh_stars>0 import subprocess import unittest from unittest.mock import Mock, patch from src.fail2ban_exporter.__main__ import clean_name, \ get_jail_number, get_jail_state, get_jails class TestFail2BanExporter(unittest.TestCase): def test_get_jail_number(self): input = """Status |- ...
StarcoderdataPython
3342149
import random import string key_len = 14 def ensure_perfect_secrecy(data): assert all([len(c) <= key_len for c in data]) def encrypt(word, key): shifts = [ord(k) - ord('a') for k in key] pt = [ord(c) - ord('a') for c in word] return ''.join([chr(((p + shifts[i]) % len(string.ascii_lowercase)) + ord...
StarcoderdataPython
84534
#!/usr/bin/python import sys filename_input = sys.argv[1] + '.txt' filename_output = sys.argv[1] + '-filtering.txt' file_to_write = open(filename_output, 'w+') fields = [] filtering_fields = '' num_of_lines = 0 with open(filename_input, 'r') as file_to_read: while True: lines = file_to_read.readline() ...
StarcoderdataPython
44197
<reponame>dataength/automating-your-data-pipeline-with-apache-airflow import csv import logging from airflow import DAG from airflow.operators.bash import BashOperator from airflow.operators.dummy import DummyOperator from airflow.providers.apache.hive.operators.hive import HiveOperator from airflow.operators.python i...
StarcoderdataPython
4838042
from datetime import datetime class TaskHandlerBase: def __init__(self, logger): self.start_time = datetime.now() self.running_time = 0 self.logger = logger def next_period(self): _current_time = datetime.now() self.running_time = (_current_time - self.start_time).seco...
StarcoderdataPython
19188
<filename>app/cli.py import os import click from app import app from flask.cli import with_appcontext from app.auth.models import Role def register(app): @app.cli.group() def translate(): """Translation and localization commands.""" pass @translate.command() @click.argument('lang') ...
StarcoderdataPython
1612025
<gh_stars>0 #!/usr/bin/env python """ To regenerate that module to contain the latest list of IANA Language Subtag Registry, either call this module directly from the command line (``python regenenerate.py``), or call the ``regenerate`` method. """ import os import re import codecs from urllib.request import urlopen ...
StarcoderdataPython
1662625
<reponame>farinacci/lispers.net<gh_stars>10-100 # ----------------------------------------------------------------------------- # # Copyright 2013-2019 lispers.net - <NAME> <<EMAIL>> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with t...
StarcoderdataPython
1623620
<reponame>Korrbit/pydarkstar<gh_stars>0 from ..darkobject import DarkObject from bs4 import BeautifulSoup import logging import time from urllib.request import urlopen class Scrubber(DarkObject): def __init__(self): super(Scrubber, self).__init__() def scrub(self): """ Get item meta...
StarcoderdataPython
124333
#!/usr/bin/python # -*- coding: utf-8 -*- def read_gowalla_data(file_path): train_file = open(file_path, 'r') x_data = {} for i in open(file_path): line = train_file.readline() # line = line.strip('\n') if len(line) == 0: continue items = line.split("\t") ...
StarcoderdataPython
125551
<reponame>Tree12323/BackTest import numpy as np from Backtest import Backtest class PBO: def __init__(self,paras_list,S): self.paras_list = paras_list self.S = S self.data = None def next_list(self,cur_list): S2 = int(self.S / 2) for i in range(S2 - 1, -1, -1): ...
StarcoderdataPython
119862
<filename>samples/gacha/gacha.py import random N = 44 R = 100 prob = [0.0]*R trial = 10000 for _ in range(trial): a = [] n = 0 for i in range(R): a.append(random.randint(1, N)) if len(set(a)) > n: prob[i] = prob[i] + 1 n = len(set(a)) for i in range(R): s = "{}...
StarcoderdataPython
117926
from django import forms from django.contrib.auth.decorators import login_required from django.core.files.images import get_image_dimensions from django.urls import reverse from regex import regex from .models import UserProfile import json from django.core.mail import send_mail, BadHeaderError from django.http import ...
StarcoderdataPython
88334
<gh_stars>1-10 # -*- coding: utf-8 -*- import pytest from html2ans.parsers.embeds import VineEmbedParser @pytest.mark.parametrize('tag_string,expected_id', [ ('<iframe class="vine-embed" src="https://vine.co/v/' 'M6gbIOedZ5X/embed/postcard?audio=1"></iframe>', "https://vine.co/v/M6gbIOedZ5X/embed/postca...
StarcoderdataPython
1770703
# Generated by Django 2.2.13 on 2020-08-01 22:04 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('true_coders', '0029_auto_20200429_1924'), ] operations = [ migrations.AddField( model_name='coder', name='n_account...
StarcoderdataPython
126015
<filename>main/lib/idds/tests/logs_test.py<gh_stars>0 #!/usr/bin/env python # # 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.0OA # # Authors: # - <NA...
StarcoderdataPython
3240166
<gh_stars>0 #Created: Wed May 29 20:46:29 2019 #By: mach import numpy as np import os os.chdir('..') os.chdir('..') import PyKeller.signal_processing.pycuda_fourier as pyft class Velocity: def __init__(self): self.raw = [] self.turbulence = [] self.wind = [] def add_raw(self,...
StarcoderdataPython
33866
from django.contrib.auth import get_user_model from django.urls import reverse from django.test import TestCase from rest_framework import status from rest_framework.test import APIClient from core.models import Member, Band from rockband.serializers import MemberSerializer MEMBERS_URL = reverse('rockband:member-l...
StarcoderdataPython
3218552
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.core import validators from django.utils.encoding import force_text from django.utils.translation import ungettext_lazy try: from django.utils.deconstruct import deconstructible except ImportError: def deconstructible(x): retu...
StarcoderdataPython
1616491
# Copyright 2021 The TF-Coder 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 required by applicable law or agreed to in...
StarcoderdataPython
3381130
<reponame>batman004/Serverless-Media-Upload-Service from fastapi import Request, HTTPException, status from endpoints.models import Login from .hashing import Hash async def check_user(request: Request, user_to_login: Login): user = await request.app.mongodb["users"].find_one({"username":user_to_login.username}) ...
StarcoderdataPython
1665143
<gh_stars>0 from .stage01_isotopomer_MQResultsTable_postgresql_models import * from SBaaS_LIMS.lims_experiment_postgresql_models import * from SBaaS_LIMS.lims_sample_postgresql_models import * from SBaaS_LIMS.lims_msMethod_postgresql_models import * from SBaaS_base.sbaas_base_query_update import sbaas_base_query_updat...
StarcoderdataPython
3346184
<reponame>noahcb/lit # Copyright 2020 Google LLC # # 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 ag...
StarcoderdataPython
1730943
from typing import Optional class XAutoMLManager: instance: Optional['XAutoML'] = None @classmethod def open(cls, instance: 'XAutoML'): cls.instance = instance @classmethod def get_active(cls): return cls.instance def gcx(): main = XAutoMLManager.get_active() if main is...
StarcoderdataPython
3359639
import requests from bs4 import BeautifulSoup from django.utils.decorators import method_decorator from labs_challenge.models import Club, Tag from django.contrib.auth import get_user_model from django.views.generic import View from django.contrib.auth.decorators import login_required from django.http import HttpRespon...
StarcoderdataPython
123057
<reponame>kmcquade/vulnerabilities import datetime from dateutil.tz import tzutc from vulnerabilities.tools.bandit.parser import BanditParser from utils import check_finding class TestBanditParser: def test_bandit_parser_get_scan_types(self): parser = BanditParser() assert "BANDIT" in parser.get...
StarcoderdataPython
1622065
<reponame>duaneking/pycraft<filename>pycraft/objects/block.py from .object import WorldObject from .textures import tex_coords GRASS = tex_coords((1, 0), (0, 1), (0, 0)) SAND = tex_coords((1, 1), (1, 1), (1, 1)) BRICK = tex_coords((2, 0), (2, 0), (2, 0)) STONE = tex_coords((2, 1), (2, 1), (2, 1)) class Block(WorldOb...
StarcoderdataPython
141559
from pathlib import Path from typing import Dict, Mapping, Any # import opentelemetry as otel from opentelemetry.trace import StatusCode, Status # type: ignore # from pynb_dag_runner.core.dag_runner import task_from_python_function # from pynb_dag_runner.notebooks_helpers import JupytextNotebook, JupyterIpynbNotebo...
StarcoderdataPython
1753165
# -*- coding: utf-8 -*- """ | **@created on:** 17/05/17, | **@author:** <NAME>, | **@version:** v0.0.1 | | **Description:** | DL Module Tests | **Sphinx Documentation Status:** Complete | ..todo:: """ from nose import with_setup # optional import logging from pympler import tracker memory_tracker = tracker.Summary...
StarcoderdataPython
1662510
<gh_stars>1-10 ########## Script 1 ################### import sys from RK_IO_model import RK_IO_methods from Generalized_RK_Framework import generalized_RK_framework import pdb #for debugging import numpy as np import pyomo.environ as pyo from pyomo.opt import SolverFactory from pyomo.opt impor...
StarcoderdataPython
56938
# -*- coding: utf-8 -*- import os from flask import render_template, redirect, request, session from werkzeug.utils import secure_filename from blog import app from blog.link2db import * app.secret_key = os.urandom(24) ALLOWED_EXTENSIONS = set(['png', 'jpg', 'jpeg', 'gif']) def allowed_file(filename): return '...
StarcoderdataPython
3304914
"""Code for CLI get""" import json as jsonlib import logging from typing import List import click from rich.console import Console from housekeeper.store.api import schema from .tables import get_bundles_table, get_files_table, get_tags_table, get_versions_table LOG = logging.getLogger(__name__) @click.group() de...
StarcoderdataPython
1695783
<reponame>alexandersirris/consumerfinance.gov import argparse import json from django.core.management.base import BaseCommand from mega_menu.models import Menu class Command(BaseCommand): help = ( 'Import (and overwrite) language-specific mega menu content as JSON.' ) def add_arguments(self, pa...
StarcoderdataPython
3323056
import pandas as pd f = "E:\thesis\predict8k\data\interim\filings_2018-02_8-K_queryoutput.csv" df = pd.read_csv(f) query_results = df.output dfs = [pd.read_csv(file) for file in query_results] consildated_df = pd.concat(dfs)
StarcoderdataPython
1687351
# -*- coding: utf-8 -*- # Generated by Django 1.10.7 on 2017-06-19 01:02 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Theme'...
StarcoderdataPython
119605
from .exceptions import * import random # Complete with your own, just for fun :) LIST_OF_WORDS = [] """ Mask word""" def _mask_word(word): if word =='': raise InvalidWordException else: mask_word = '*' * len(word) return mask_word """ Uncover word """ def _uncover_word(answer_word, masked_w...
StarcoderdataPython
3264914
<reponame>SimonBoothroyd/descent<gh_stars>1-10 import copy from typing import Tuple import numpy import pytest import torch from openff.toolkit.topology import Molecule from openff.toolkit.typing.engines.smirnoff import ForceField from smirnoffee.geometry.internal import detect_internal_coordinates from descent impor...
StarcoderdataPython
114345
<gh_stars>0 ''' net work util, for sending msg ''' import random def singleton(cls): _instance = {} def inner(): if cls not in _instance: _instance[cls] = cls() return _instance[cls] return inner @singleton class NetworkUtil(): def __init__(self): ''' init c...
StarcoderdataPython
3218356
#!/usr/bin/env python3 # -*- coding:utf-8 -*- ### # File: 11_kapitel_05_repetitionsaufgabe_10_dna_sequence.py # Project: Kapitel_05_Kontrollstrukturen # Created Date: Sunday 24.02.2019, 10:07 # Author: Apop85 # ----- # Last Modified: Sunday 24.02.2019, 10:12 # ----- # Copyright (c) 2019 Apop85 # This software is publis...
StarcoderdataPython
3270944
import json import config import helpers import json import requests import re def lambda_handler(event, context): for record in event['Records']: # We receive a payload from SCUTTLE with a wiki and the most recent slug we have for it. callback_url = record['messageAttributes']['callback_url']['st...
StarcoderdataPython
67444
<reponame>o-andrieiev/Universum #!/usr/bin/env python import os.path from universum.configuration_support import Configuration, Step, get_project_root # # One way to specify path to the script: add full path to the command # script_name = './basic_build_script.sh' script_path = os.path.abspath(os.path.join(get_projec...
StarcoderdataPython
1697280
"""Репозиторий запросов к сервисам информации с валютой. https://www.live-rates.com/rates """ import json import time from collections import defaultdict from typing import Iterable, Dict, Optional import requests from config import LOCAL_TMP_PATH __currencies_info_created: Optional[float] = None # Переменная мо...
StarcoderdataPython
97165
#!/usr/bin/env python3 ############################################################################# # Filename : Softlight.py # Description : Control RGBLED with Potentiometer # Author : www.freenove.com # modification: 2019/12/27 ######################################################################## import...
StarcoderdataPython
108286
<reponame>NSLS-II-SMI/profile_collection def giwaxs_S_edge_wenkai(t=1): dets = [pil300KW] names = [ 'A2', 'A3', 'A4', 'A5', 'A6'] x = [30000, 16000, 0, -15000, -36000] energies = np.arange(2450, 2470, 5).tolist() + np.arange(2470, 2480, 0.25).tolist() + np.arange(2480, 2490, 1).tolist()+ np...
StarcoderdataPython
3306429
#!/usr/bin/env python import optparse import os import random import subprocess import sys import time import traceback from bin.verify_hashes.verify import verify_hash_type from bin.generators import Generators from bin.attacks.bruteforce.bf_attack import ( bruteforce_main, ) from lib.settings import ( LOGGE...
StarcoderdataPython
3318949
<reponame>cipherboy/modern-paste import config class URI: fqdn = config.DOMAIN path = '/' api_endpoint = False def __init__(self): pass @classmethod def uri(cls, **kwargs): embedded_params = set([key for key in kwargs if '<{key}>'.format(key=key) in cls.path]) params ...
StarcoderdataPython
1640428
import json from typing import TypeVar from marshy.marshaller.marshaller_abc import MarshallerABC T = TypeVar('T') class JsonStrMarshaller(MarshallerABC[T]): """ Marshaller for freeform json objects - they are interpreted as strings. (Due to technologies like graphql having a dislike for unstructured da...
StarcoderdataPython
3221554
# -*- coding: utf-8 -*- from flask_sqlalchemy import SQLAlchemy from sqlalchemy import func, desc, asc, distinct, and_, or_ from sqlalchemy.orm import relationship from config import app_active, app_config from model.User import User from model.Category import Category config = app_config[app_active] db = SQLAlchemy(c...
StarcoderdataPython
3295056
<filename>component/scripts/gee_import.py import time from datetime import datetime import ee # initialize earth engine ee.Initialize() def get_alerts_dates(date_range, aoi, asset, band): """return the alerts included between the two dates of date_range "band" must be a date in the proleptic Gregorian calendar ...
StarcoderdataPython
32677
from tensorflow.keras.callbacks import Callback from poem_generator.word_generator import generate_poem class PoemCallback(Callback): def __init__(self, poems, seed_length, dictionary, single=True): super(PoemCallback, self).__init__() self.poems = poems self.dictionary = dictionary ...
StarcoderdataPython
159890
import bpy from . import settings, utils from bpy.props import (StringProperty, BoolProperty, IntProperty, FloatProperty, EnumProperty, PointerProperty, ) from bpy.types import (Pan...
StarcoderdataPython
1759570
# Generated by Django 3.0.3 on 2020-04-15 17:24 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('dashboard', '0007_event'), ('dashboard', '0015_auto_20200415_0845'), ] operations = [ ]
StarcoderdataPython
1698994
<gh_stars>0 from .proto import protoSMOTE from .restricted1 import restrictedSMOTE1 from .restricted2 import restrictedSMOTE2 from .restricted3 import restrictedSMOTE3 __all__ = [ 'protoSMOTE', 'restrictedSMOTE1', 'restrictedSMOTE2', 'restrictedSMOTE3' ]
StarcoderdataPython
76429
import json data = ''' [ { "name":"Sister", "count":95 }, { "name":"Sidharth", "count":94 }, { "name":"Ilona", "count":93 }, { "name":"Ruairidh", "count":93 }, { "name":"Virginie", "count":92 }, { "name":"Alan...
StarcoderdataPython
1659613
# flake8:noqa:F401 from .api import ( BitRateType, EndpointsType, NeteaseEndpoint, RecordPeriodType, SearchType, ) from .constants import NeteaseConstants from .net import NetRequest
StarcoderdataPython
1627125
<reponame>akshat-jjain/leetcode-solutions<filename>Sort Colors.py class Solution: def sortColors(self, nums: List[int]) -> None: nums[:] = sorted(nums)
StarcoderdataPython
3227585
<reponame>JungAh12/GA3C #!/usr/bin/env python # coding: utf-8 # In[1]: from threading import Thread import numpy as np from Config import Config # In[2]: class ThreadTrainer(Thread): def __init__(self, server, id): super(ThreadTrainer, self).__init__() self.setDaemon(True) se...
StarcoderdataPython
3282057
# Copyright 2022 The sunds 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 required by applicable law or agreed to in wr...
StarcoderdataPython
176133
import numpy as np from sklearn.preprocessing import PolynomialFeatures from statsmodels.api import OLS from predictions.utils.future import set_future_series def polynomial_forecast(series, steps_ahead=3, freq='D', series_name='polynomial'): """ Function fits data into OLS. INPUT: :param series: p...
StarcoderdataPython
1650890
<gh_stars>1-10 import mysql.connector as mysql from datetime import datetime import json import os import sys JSON_FILE = 'config.json' TABLE_INSERT = "INSERT INTO {} (PM2_5,AQI2_5,PM10,AQI10,geotag,date)" class mydb(object): def __init__(self, host, name, user, password, port): # connect to MySQL server...
StarcoderdataPython
171767
#!/usr/bin/env python import logging import numpy as np import pandas as pd from library import Imputation as iptt SAMPLING = np.array([2, 4, 4, 4, 5, 5, 7, 9]) BENIGN = np.array([4., 28., 1., 1., 3.]) MALIGNANT = np.array([5., 60., 2., 4., 3.]) BENIGN_COUNT = np.array([1., 1., 1., 1., 1.]) MALIGNANT_COUNT = np....
StarcoderdataPython
1638212
<reponame>ymyzk/python-gyazo __version__ = "2.1.0" # type: str
StarcoderdataPython
1663066
# -*- coding: utf-8 -*- import pytest from mdpants import mdpants import argparse import binascii # Test that parse_args fails when mandatory elements are missing def test_fails_without_arguments(): with pytest.raises(SystemExit): mdpants.parse_args([]) def test_just_random_succesds(): assert mdpants...
StarcoderdataPython
3204409
<reponame>simonRos/PasswordTesting #Accepts information from user to determine password strength #<NAME> #5/25/2017 import os import os.path from StrengthTest import StrengthTest settings = 'settings.txt' def prompt(again=None): yesno = " [Yes/No] " ask = "" if again == None: ask = ...
StarcoderdataPython
99028
<gh_stars>0 import face_recognition import cv2 from tensorflow.keras.preprocessing.image import img_to_array import os import numpy as np from tensorflow.keras.models import model_from_json import pickle from PIL import Image, ImageDraw root_dir = os.getcwd() # Load Face Detection Model face_cascade = cv2.CascadeClass...
StarcoderdataPython
126203
<reponame>pabloEntropia/musicnn-training import argparse import json from collections import defaultdict, namedtuple from pathlib import Path import numpy as np from sklearn.metrics import classification_report import shared Score = namedtuple('Score', ['mean', 'std']) def score_predictions(args): config = jso...
StarcoderdataPython
1619097
# https://in-the-sky.org/data/asteroids.php# ###Website to get the data about the asteroid position import pandas import numpy as np import matplotlib.pyplot as plt ## READING THE FILE data= pandas.read_csv("vesta_data.csv",skiprows=2) #reading the file print(data["AU"]) #printing a list of only the data posit...
StarcoderdataPython
1727504
""" This module is responsible for defining the RTTI types defined in rttidata.h header: // // _RTTIBaseClassDescriptor // typedef const struct _s_RTTIBaseClassDescriptor { #if _RTTI_RELATIVE_TYPEINFO int pTypeDescriptor; // Image relative offset of TypeDescriptor #else T...
StarcoderdataPython
184183
__author__ = 'Dante' import os import math import machines import density_weight as dw from structures.isozyme import BrendaIsozyme as bi from databases import db_queries as dbq from structures import fingerprinter as fptr import numpy as np import routines import pybel CHEMPATH = os.path.join(os.path.di...
StarcoderdataPython
151024
<reponame>abhik-99/ocean.py # # Copyright 2021 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # from ocean_lib.web3_internal.transactions import ( cancel_or_replace_transaction, send_ether, ) def test_chain_id_send_ether(alice_wallet, bob_address): """Tests if the chainId has the right va...
StarcoderdataPython
3324701
from django.core.management.base import NoArgsCommand from django.db import connections, router, transaction, models, DEFAULT_DB_ALIAS import fts class Command(NoArgsCommand): help = 'update FTS indices' def handle_noargs(self, **options): manifest = dict((app.__name__.split('.')[-2], [m for m in mode...
StarcoderdataPython
1785484
# # Taranos Cloud Sonification Framework Tutorial #1: Switched-On Taranos # Copyright (C) 2018 <NAME>, Netrogen Blue LLC (<EMAIL>) # # 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 # # htt...
StarcoderdataPython
3386462
# !/usr/bin/python3 # -*- coding: utf-8 -*- import os import datetime import logging from confapp import conf logger = logging.getLogger(__name__) class SessionBase(object): """ Represents a board running session """ def __init__(self, setup): setup += self self.uuid4 = None # the...
StarcoderdataPython
8117
<filename>plaso/parsers/winreg_plugins/usbstor.py # -*- coding: utf-8 -*- """File containing a Windows Registry plugin to parse the USBStor key.""" from __future__ import unicode_literals from plaso.containers import events from plaso.containers import time_events from plaso.lib import definitions from plaso.parsers ...
StarcoderdataPython
16105
### this works on linux only try: import fcntl import subprocess import signal import os except: session.flash='sorry, only on Unix systems' redirect(URL(request.application,'default','site')) forever=10**8 def kill(): p = cache.ram('gae_upload',lambda:None,forever) if not p or p.poll...
StarcoderdataPython
103082
<gh_stars>1-10 from marshmallow import Schema, fields FIELD_TO_CKAN_TYPE_MAPPING = { fields.String: 'text', fields.Number: 'numeric', fields.Integer: 'numeric', fields.DateTime: 'timestamp', fields.Date: 'date', fields.Float: 'float', fields. Boolean: 'bool' } class BaseSchema(Schema): '''Base sch...
StarcoderdataPython
1774072
<reponame>juushya/Kvasir<gh_stars>0 # -*- coding: utf-8 -*- ##--------------------------------------# ## Kvasir ## ## (c) 2010-2013 Cisco Systems, Inc. ## ## Reporting controller ## ## Author: <NAME> <<EMAIL>> ##--------------------------------------# from skaldship.general import cvss_metrics from skaldship.hosts im...
StarcoderdataPython
187949
<gh_stars>0 from util import Events from trello import trelloclient class Plugin(object): def __init__(self, pm): self.pm = pm self.api_key = self.pm.botPreferences.get_config_value("Trello", "apikey") self.token = self.pm.botPreferences.get_config_value("Trello", "token") self.boa...
StarcoderdataPython
4823093
import cv2 import time import yaml import argparse import logging import pkg_resources from pathlib import Path import os from tqdm import tqdm from moviepy.editor import VideoFileClip import numpy as np import glob from matplotlib import pyplot as plt from src.tracker import Tracker from src.preprocessing import Tim...
StarcoderdataPython
1770535
<filename>mouse_burrows/scripts/get_cropped_movie.py #!/usr/bin/env python2 ''' Created on Sep 21, 2016 @author: <NAME> <<EMAIL>> ''' from __future__ import division import argparse import sys import os # add the root of the video-analysis project to the path script_path = os.path.split(os.path.realpath(__file__))[...
StarcoderdataPython
1661027
<reponame>jacobcheatley/trpg-creator<filename>trpgcreator/ui/dialogs/about.py # -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'ui_files/dialogs/about.ui' # # Created by: PyQt5 UI code generator 5.7 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, Q...
StarcoderdataPython
1607163
<reponame>labd/mach-component-cookiecutter from .order import * # NOQA {% if cookiecutter.use_public_api|int %}from .fastapi import * # NOQA{% endif %}
StarcoderdataPython
83334
<filename>models/baselines_conventional.py # -*- coding: utf-8 -*- ''' Project: Product Aesthetic Design: A Machine Learning Augmentation Authors: <NAME>, Yale University Email: <EMAIL> License: MIT License OSS Code Attribution (see Licensing Inheritance): Port...
StarcoderdataPython
30742
""" Sponge Knowledge Base Remote API security """ def configureAccessService(): # Configure the RoleBasedAccessService. # Simple access configuration: role -> knowledge base names regexps. remoteApiServer.accessService.addRolesToKb({ "ROLE_ADMIN":[".*"], "ROLE_ANONYMOUS":["boot", "python"]}) # Simple...
StarcoderdataPython
1672148
import logging import multiprocessing import os import signal import sys from gromozeka.backends import get_backend_factory from gromozeka.brokers import get_broker_factory from gromozeka.concurrency import Scheduler from gromozeka.config import Config from gromozeka.exceptions import GromozekaException from gromozeka...
StarcoderdataPython
3280022
""" The pycity_scheduling framework Copyright (C) 2022, Institute for Automation of Complex Power Systems (ACS), E.ON Energy Research Center (E.ON ERC), RWTH Aachen University Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Softwa...
StarcoderdataPython
3311347
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union, overload from . import ...
StarcoderdataPython
3337385
#!/usr/bin/env python3 import argparse from datetime import datetime from weather_reporter.WeatherApp import WeatherApp def main(): # create argument parser object parser = argparse.ArgumentParser(description = "Weather Reporter") parser.add_argument("-q", "--query", type = str, nargs = 1, metavar = "...
StarcoderdataPython
3201255
from django.http import HttpResponseRedirect from django.shortcuts import get_object_or_404, redirect, render from django.contrib.auth.models import User from django.views import View from .models import BankAccount, Transaction from .forms import BankAccountForm, RegistrationForm, TransactionForm from django.core.pagi...
StarcoderdataPython
1713746
<gh_stars>0 from PIL import Image img = Image.open("dirtyMap.png") pixels = img.load() # create the pixel maps print pixels[0, 0] for i in range(img.size[0]): # for every pixel: for j in range(img.size[1]): if pixels[i, j] != (0, 0, 0, 255): # if not black: pixels[i, j] = (255, 255, 255, ...
StarcoderdataPython
3219449
<filename>API/server.py<gh_stars>0 import uvicorn from fastapi import FastAPI, File, UploadFile app = FastAPI() @app.post("/files") async def file_upload(image1: UploadFile = File(...), image2: UploadFile = File(...) ): print(image1) print(image2) open("image1.jpg","wb").write(image1.file.rea...
StarcoderdataPython
4831224
# proxy module from __future__ import absolute_import from mayavi.tools.camera import *
StarcoderdataPython
4814
<reponame>mnebelung/OctoPrint-OctoPod # coding=utf-8 from __future__ import absolute_import import datetime import logging import sys import flask import octoprint.plugin from octoprint.events import eventManager, Events from octoprint.server import user_permission from octoprint.util import RepeatedTimer from .bed_...
StarcoderdataPython
3292170
<reponame>hbachchas/dlbasics from keras.models import Sequential from keras.layers.core import Flatten, Dense, Dropout from keras.layers.convolutional import Convolution2D, MaxPooling2D, ZeroPadding2D from keras.optimizers import SGD import cv2, numpy as np def VGG_16(weights_path=None): model = Sequential() m...
StarcoderdataPython
3388579
<reponame>somanyunknowns/KFNet from cnn_wrapper.network import Network import tensorflow as tf # Input BxHxWxN cost volume # Outout BxHxWx3 coordinate map & BxHxWx1 uncertainty map class OFlowNet(Network): def __init__(self, inputs, window_area, is_training, reuse=False): images = inputs['input'] s...
StarcoderdataPython
1685227
"""SSL Tests - compatibility and some security features This module will be completely obsoleted on March 4th 2017 when all sites enable the critical update "Require TLS 1.1 or higher for HTTPS connections" for all organizations uncoditionally. """ import ssl import sys from django.conf import settings from django.tes...
StarcoderdataPython
1600010
# -*- coding:utf-8 -*- # !/usr/bin/env python """ Date: 2021/11/2 17:43 Desc: """ # import time # # import requests # import pandas as pd # import time # from bs4 import BeautifulSoup # # url = "http://stock.finance.sina.com.cn/stock/go.php/vPerformancePrediction/kind/eps/index.phtml" # big_df = pd.DataFrame() # page ...
StarcoderdataPython