id
stringlengths
1
265
text
stringlengths
6
5.19M
dataset_id
stringclasses
7 values
3366573
from bokeh.models import NumeralTickFormatter from pyesg.validation.report.analysis_builders.base.martingale_analysis_builder import MartingaleAnalysisBuilder from pyesg.validation.report.charts.line_chart import LineChart class AverageDiscountFactorBuilder(MartingaleAnalysisBuilder): """ Class for building ...
StarcoderdataPython
1781984
#!/usr/bin/env python3 # author @danbros # Pset4 do curso MITx: 6.00.1x (edX) import random from typing import Union, Dict, List, Optional d_si = Dict[str, int] def loadWords() -> List[str]: """Load the file with words. Returns: list: list of valid words """ print("Loading word list fro...
StarcoderdataPython
4807157
from .compute_log_manager import GCSComputeLogManager from .resources import gcs_resource from .system_storage import gcs_intermediate_storage, gcs_plus_default_intermediate_storage_defs
StarcoderdataPython
3249569
__author__ = "<NAME>" __copyright__ = "Carnegie Mellon University" __license__ = "MIT" __maintainer__ = ["<NAME>", "<NAME>"] __credits__ = ["<NAME>", "<NAME>", "<NAME>", "<NAME>", "<NAME>"] __email__ = ["<EMAIL>", "<EMAIL>"] __status__ = "Production" import json import imp import os from os.path import basename from s...
StarcoderdataPython
1727204
<reponame>YouFacai/iWiki<filename>backend/modules/doc/migrations/0012_doc_pv_docversion_pv.py # Generated by Django 4.0.1 on 2022-01-23 12:30 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("doc", "0011_alter_doc_index_together"), ] operations =...
StarcoderdataPython
2567
<reponame>purkhusid/rules_dotnet "Actions for compiling resx files" load( "@io_bazel_rules_dotnet//dotnet/private:providers.bzl", "DotnetResourceInfo", ) def _make_runner_arglist(dotnet, source, output, resgen): args = dotnet.actions.args() if type(source) == "Target": args.add_all(source.fil...
StarcoderdataPython
3349799
from time import sleep from legislative_act import model as dm from lexparency import get_document_history inconsistents = set() for h in dm.Search().filter('term', doc_type='cover').filter('term', abstract__in_force=True).scan(): try: if h.repealed_by: inconsistents.add((h.abstract.domain, h...
StarcoderdataPython
4826072
<reponame>Captricity/cappa from __future__ import print_function, absolute_import from .pip import Pip class Pip3(Pip): def __init__(self, *flags): super(Pip3, self).__init__(*flags) self.name = 'pip3' self.friendly_name = 'pip3'
StarcoderdataPython
3252349
<reponame>michelbeyrouty/aws-python-lambda-with-sns-input-handler from app.controllers import test routes = { "TEST": test } def fetch_controller(snsTopic): controller = routes.get(snsTopic, "notFound") if controller == "notFound": raise TypeError("Controller not found") return controller
StarcoderdataPython
62275
# -*- coding: UTF-8 -*- from itertools import cycle import sklearn from sklearn import linear_model from scipy import interp from sklearn.metrics import accuracy_score import scipy import os import sys import traceback import glob import numpy as np ##from sklearn.externals import joblib import pickle import joblib f...
StarcoderdataPython
174912
<filename>yelp_data_parsing.py import ujson, json import sets import io busdata = [] with open('business.json', 'rb') as bus: for line in bus: business = ujson.loads(line) busdata.append(business) print "Opened Yelp JSON file" citydict = {} citylist = [] for business in busdata: citylist.appe...
StarcoderdataPython
89458
<gh_stars>10-100 #!/usr/bin/env python ## ## Project: Simple4All - November 2013 - www.simple4all.org ## Contact: <NAME> - <EMAIL> import sys import re from configobj import ConfigObj ## History: public HTS -> Junichi's script -> Reima made stream independent -> Oliver ## put in separate script and moved from perl ...
StarcoderdataPython
4841018
<gh_stars>0 import paho.mqtt.client as mqtt # import the client1 def on_message(client, userdata, message): DATA_RECEIVED = str(message.payload.decode("utf-8")) TOPIC_RECEIVED = message.topic OBJ = dict() OBJ['topic'] = TOPIC_RECEIVED OBJ['sms'] = DATA_RECEIVED print(OBJ) IP_BROKER = "192....
StarcoderdataPython
3200453
""" Django settings for intranet project. Generated by 'django-admin startproject' using Django 3.0.3. For more information on this file, see https://docs.djangoproject.com/en/3.0/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/3.0/ref/settings/ """ # Build pat...
StarcoderdataPython
57700
<filename>mongocat/mongocat.py """Main module.""" from pymongo import MongoClient from pymongo.errors import DuplicateKeyError import yaml import json from bson import json_util as bson_ser import sys def get_parser(parser_name): if parser_name == 'yaml': return yaml.safe_load if parser_name == 'json...
StarcoderdataPython
1660417
# Stdlib imports import logging # Django imports from django.db.models import Sum # Pip imports from rest_framework.decorators import api_view from rest_framework.response import Response # App imports from ..models import EthVoter from ..models import VoteLog logger = logging.getLogger(__name__) @api_view(['GET'...
StarcoderdataPython
1775170
<reponame>isl-org/adaptive-surface-reconstruction # # Copyright 2022 Intel (Autonomous Agents Lab) # # 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/LICEN...
StarcoderdataPython
1628485
# Copyright 2022 Accenture Global Solutions Limited # # 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 ...
StarcoderdataPython
4810364
<gh_stars>10-100 """ Testing clustering algorithms in Clusterpy -Helper functions- Tests for one of the core classes in clusterpy. Region Maker. """ from unittest import TestCase, skip from math import pi from clusterpy import importArcData from clusterpy.core.toolboxes.cluster.componentsAlg import AreaManager from cl...
StarcoderdataPython
1614017
<reponame>aNOOBisTheGod/yandex-lyceum-qt import string def totenth(num, base): num = num.upper() for i in num: print(i) if i == '.': continue if i.isalpha(): if string.ascii_uppercase.find(i) + 10 >= base: raise Exception('Invalid number') ...
StarcoderdataPython
3220628
<gh_stars>0 from yeelight import discover_bulbs, Bulb from flask import Flask, render_template, request, redirect, url_for app = Flask(__name__) @app.route('/') def index(): bulbs = discover_bulbs() bulbs = sorted(bulbs, key=lambda k: k["ip"]) return render_template('index.html', bulbs=bulbs) @app.rout...
StarcoderdataPython
142433
# -*- coding: utf-8 -*- """API models package.""" from . import asset_mixin, devices, fields, labels, saved_query, users from .asset_mixin import AssetMixin from .devices import Devices from .fields import Fields from .labels import Labels from .saved_query import SavedQuery from .users import Users __all__ = ( "U...
StarcoderdataPython
3310546
<reponame>jlohmoeller/ngsi-timeseries-api from conftest import QL_URL, crate_translator as translator from datetime import datetime from reporter.tests.utils import insert_test_data import pytest import requests entity_type = 'Room' attr_name = 'temperature' n_days = 6 def query_url(values=False): url = "{qlUrl}...
StarcoderdataPython
3320493
<reponame>tahmidbintaslim/screenlamp # <NAME> 2017 # # screenlamp is a Python toolkit # for hypothesis-driven virtual screening. # # Copyright (C) 2017 Michigan State University # License: Apache v2 # # Software author: <NAME> <http://sebastianraschka.com> # Software author email: <EMAIL> # # Software source repository...
StarcoderdataPython
1797299
<filename>example/dt/7.preprocessor/docker/build/KETI_Preprocessor.py<gh_stars>0 from pyspark import SparkContext, SparkConf, SparkFiles from pyspark.streaming import StreamingContext from pyspark.streaming.kafka import KafkaUtils from msgParser import * import msgParser import json import happybase import sys import ...
StarcoderdataPython
38636
""" A Python module to facilitate JIT-compiled CPU-GPU agnostic compute kernels. Kernel libraries are collections of functions written in C code that can be compiled for CPU execution using a normal C compiler via the CFFI module, or for GPU execution using a CUDA or ROCm compiler via cupy. """ from . import library ...
StarcoderdataPython
19332
<gh_stars>0 """Build rules to create C++ code from an Antlr4 grammar.""" def antlr4_cc_lexer(name, src, namespaces = None, imports = None, deps = None, lib_import = None): """Generates the C++ source corresponding to an antlr4 lexer definition. Args: name: The name of the package to use for the cc_libra...
StarcoderdataPython
1643065
<gh_stars>1-10 from tkinter import * from tkinter.colorchooser import askcolor as askcolour def askBoxColour(focus): focus.chosenBoxColour = askcolour() stringVar = StringVar(focus.chosenBoxColour[1]) focus.selectThemeBoxColourBox.set(stringVar)
StarcoderdataPython
3378115
<filename>access/tests/test_euclidean.py import sys sys.path.append('../..') import math import unittest import numpy as np import pandas as pd import geopandas as gpd from access import access, weights import util as tu class TestEuclidean(unittest.TestCase): def setUp(self): demand_data = pd.DataFram...
StarcoderdataPython
1626384
# -*- coding: utf-8 -*- """Top-level package for vmlib.""" __author__ = """<NAME>""" __email__ = '<EMAIL>' __version__ = '0.3.2' __license__ = 'MIT' __docformat__ = 'reStructuredText' __all__ = ['decorators', 'dirs', 'em', 'ert', 'gis', 'hydrology', 'io', 'math', 'pdf', 'plot', 'project', 'seis', 'stats'...
StarcoderdataPython
146960
<filename>zipline/data/fx/__init__.py<gh_stars>1-10 from .base import FXRateReader, DEFAULT_FX_RATE from .in_memory import InMemoryFXRateReader from .exploding import ExplodingFXRateReader from .hdf5 import HDF5FXRateReader, HDF5FXRateWriter __all__ = [ 'DEFAULT_FX_RATE', 'ExplodingFXRateReader', 'FXRateRe...
StarcoderdataPython
4834651
from django.urls import path from . import views from .views import MyTokenObtainPairView, RegisterView, VerifyEmail from rest_framework_simplejwt.views import ( TokenObtainPairView, TokenRefreshView, ) urlpatterns = [ path('', views.getRoutes), path('token/', MyTokenObtainPairView.as_view(), name='t...
StarcoderdataPython
155787
<reponame>jadkik/emailipy import emailipy src = {} for extension in ["html", "css"]: with open("tests/test.{}".format(extension), "r") as f: src[extension] = f.read() def header(text): print("\n", text, "\n", "=" * len(text)) header("Original CSS") print(src["css"]) header("Original HTML") print(sr...
StarcoderdataPython
116570
<reponame>vonshednob/metaindex import argparse import sys from metaindex import configuration from metaindex import stores from metaindex import indexer from metaindex import indexers from metaindex import logger from metaindex.cache import Cache from metaindex.find import find try: from metaindex.fuse import met...
StarcoderdataPython
4839333
<reponame>mayank0926/pidnn-double-pendulum import torch import yaml import numpy as np import pandas as pd import os import sys from dp_datagen import double_pendulum_data from dp_pidnn import pidnn_driver from dp_dataloader import testloader from dp_ff import ff_driver if len(sys.argv) > 2: config_filename = sys....
StarcoderdataPython
3254522
<gh_stars>1-10 # adapted from http://www.pygame.org/wiki/OBJFileLoader import os import cv2 import numpy as np from visnav.algo import tools def MTL(filename): contents = {} mtl = None for line in open(filename, "r"): if line.startswith('#'): continue values = line.split() if not value...
StarcoderdataPython
52059
import os from SSHLibrary import SSHLibrary from constants import ( HPC_IP, HPC_USERNAME, HPC_KEY_PATH, HPC_HOME_PATH, ) # The Service broker will use the SSHCommunication class # to communicate with the HPC environment # This is just a dummy implementation # TODO: Improve the code and implement app...
StarcoderdataPython
123188
from distutils.core import setup setup( name='gg_group_manager', version='1.0.0', description='AWS Greengrass Group Manager', packages=[ 'gg_manager', 'gg_manager.definitions', 'gg_manager.playbooks', 'gg_manager.utilities' ], install_requires=[ 'fire==0....
StarcoderdataPython
1752056
<gh_stars>0 from spade.message import Message from spade.behaviour import State from agents import FactoryAgent from .metadata import * from copy import deepcopy import random from messages import * from behaviours import WorkingState MAX_TIMES = 4 def parseSets(string): # the format of the string [[[],[], ..], 'bre...
StarcoderdataPython
169259
<gh_stars>0 import warnings import os import re import urllib import requests import itertools import json from tqdm import tqdm from .photomosaic import options PUBLIC_URL = "https://www.flickr.com/photos/" API_URL = 'https://api.flickr.com/services/rest/' PATH = "http://farm{farm}.staticflickr.com/{server}/" NAME =...
StarcoderdataPython
177061
<filename>1. Variables and Data Types/exercises.py """ =========== Exercise 1 ============= Using a list, create a shopping list of 5 items. Then print the whole list, and then each item individually. """ shopping_list = [] # Fill in with some values print(shopping_list) # Print the whole list print() #...
StarcoderdataPython
129017
<gh_stars>1-10 from keras.models import Model from keras.optimizers import SGD, Adam from keras.layers import Input, Dense, Dropout, Flatten, Lambda, Embedding from keras.layers.convolutional import Convolution1D, MaxPooling1D from keras.initializers import RandomNormal def create_model(filter_kernels, dense_outputs,...
StarcoderdataPython
161420
<gh_stars>1-10 # noqa: D100 from dataclasses import dataclass from typing import Iterable, Optional import warnings from .vessel_class import VesselClass from ._internals import contains_caseless @dataclass(eq=False) class VesselClassFilter: """A filter used to find specific vessel classes. Attributes: ...
StarcoderdataPython
1743400
from ....data.pancreas import load_pancreas from ....tools.decorators import dataset from ._utils import generate_synthetic_dataset @dataset("Pancreas (average)") def pancreas_average(test=False): adata = load_pancreas(test=test) adata.obs["label"] = adata.obs["celltype"] adata_spatial = generate_synthet...
StarcoderdataPython
1775378
<reponame>braceal/DeepDriveMD<filename>examples/cvae_dbscan/scripts/cvae.py import os import click import numpy as np from keras.optimizers import RMSprop from molecules.utils import open_h5 from molecules.ml.unsupervised import (VAE, EncoderConvolution2D, DecoderConvolution2D, ...
StarcoderdataPython
3374311
<gh_stars>0 # coding=utf-8 from lxml import etree ''' Super class for csv-files rows. Implemented child classes at the moment are Invoice and InvoiceRow classes. ''' class Row(object): def __init__(self, records, xmlRoot): self._root = xmlRoot self.records = records self.fields = dict() ...
StarcoderdataPython
1747610
from starlette.testclient import TestClient from starlette.status import HTTP_200_OK from mydata.personal_data import app def test_status_should_return_200(): client = TestClient(app) response = client.get("/info") assert response.status_code == HTTP_200_OK def test_retun_data_in_json(): client = Te...
StarcoderdataPython
3241196
from dataclasses import dataclass import json from typing import Union from pathlib import Path import pytest from bitcoin_client.ledger_bitcoin import TransportClient, Client, Chain, createClient from speculos.client import SpeculosClient import os import re import random random.seed(0) # make sure tests are...
StarcoderdataPython
3325852
<reponame>rakhi2001/ecom7<filename>Python3/551.py __________________________________________________________________________________________________ sample 16 ms submission class Solution: def checkRecord(self, s: str) -> bool: s=s.replace('LLL','XX') return s.count('A')<=1 and s.count('XX') == 0 _...
StarcoderdataPython
1750134
import execjs import requests import re import random import time class Reply(object): def __init__(self): self.headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36' ' (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36', ...
StarcoderdataPython
32410
## Built-in packages import getopt import json import os import sys ## Third-party packages from PIL import Image import joblib import numpy as np import tqdm ## Tensorflow from tensorflow.keras.layers import BatchNormalization from tensorflow.keras.layers import Dense from tensorflow.keras.layers import Dropout from...
StarcoderdataPython
3277273
<reponame>mreveil/disaster-monitoring # Generated by Django 3.2.6 on 2021-08-22 00:26 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('app', '0017_auto_20210820_2007'), ] operations = [ migrations.CreateM...
StarcoderdataPython
4817504
<filename>parsers/messenger.py<gh_stars>1-10 #!/usr/bin/env python3 import os import time import random import argparse import pandas as pd from langdetect import * from lxml import etree from parsers import log from parsers import utils, config def parse_arguments(): parser = argparse.ArgumentParser() pars...
StarcoderdataPython
3206386
<gh_stars>0 """ Sum Lists: You have two numbers represented by a linked list, where each node contains a single digit.The digits are stored in reverse order, such that the 1 's digit is at the head of the list. Write a function that adds the two numbers and returns the sum as a linked list. EXAMPLE Input:(7-> 1 -> 6) +...
StarcoderdataPython
126370
from gym_risk.envs.game.ai import AI import random import collections class BetterAI(AI): """ BetterAI: Thinks about what it is doing a little more - picks a priority continent and priorities holding and reinforcing it. """ def start(self): self.area_priority = list(self.world.areas) ...
StarcoderdataPython
181613
<gh_stars>1-10 # Copyright The PyTorch Lightning team. # # 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...
StarcoderdataPython
3238653
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright (c) BaseDetection, Inc. and its affiliates. All Rights Reserved from .base_detection_config import BaseDetectionConfig _config_dict = dict( MODEL=dict( # META_ARCHITECTURE='GeneralizedRCNN', LOAD_PROPOSALS=False, MASK_ON=False, ...
StarcoderdataPython
189036
<reponame>ped998/scripts<filename>python/unprotectPhysicalServer/unprotectPhysicalServer.py #!/usr/bin/env python """unprotect physical servers""" # version 2021-12-03 # import pyhesity wrapper module from pyhesity import * # command line arguments import argparse parser = argparse.ArgumentParser() parser.add_argume...
StarcoderdataPython
4836281
<gh_stars>1-10 from math import sin, cos, ceil from math import radians as rad import pygame import pymunk # CLASS AND FUNCTION IMPORTS from bullet import Bullet from text import text class Tank: """Class for creating a Tank Arguments: pos {tuple} -- Starting position of the Tank. team {str}...
StarcoderdataPython
4816671
#!/usr/bin/env python import numpy as np from pycrazyswarm import * Z = 1.0 def setUp(): crazyflies_yaml = """ crazyflies: - channel: 100 id: 1 initialPosition: [1.0, 0.0, 0.0] """ swarm = Crazyswarm(crazyflies_yaml=crazyflies_yaml, args="--sim --vis null") timeHelper = swarm.time...
StarcoderdataPython
3225565
from django.contrib.auth.models import User from django.db import models from django.urls import reverse from django.utils.text import Truncator class Post(models.Model): """Model for posts in the blog""" title = models.CharField(max_length=254) publ_date = models.DateTimeField(auto_now_add=True) post...
StarcoderdataPython
3208189
import sqlite3 def __sqlite(query: str): con = sqlite3.connect("../resources_manager/ttbm.db") cur = con.cursor() cur.execute(query) result = cur.fetchall() con.commit() con.close() return result def sqlite_3_add_user(name: str, password: str, id: int): __sqlite(f"INSERT INTO user...
StarcoderdataPython
141278
<reponame>bitdotioinc/dagster from .compute_log_manager import S3ComputeLogManager from .file_cache import S3FileCache, s3_file_cache from .file_manager import S3FileHandle, S3FileManager from .intermediate_storage import S3IntermediateStorage from .object_store import S3ObjectStore from .resources import s3_file_manag...
StarcoderdataPython
3267641
<reponame>Bensuperpc/Environment_Installer<gh_stars>0 # # # Qt_installer.py - Commands for KDE env # # Created by Benoît(<EMAIL>) 30, April of 2019 # Updated by X for python 3.X # # Released into the Public domain with MIT licence # https://opensource.org/licenses/MIT # # Written with Sublime text 3 and pytho...
StarcoderdataPython
4823488
<gh_stars>1-10 import requests import datetime import xml.etree.ElementTree as ET class blueGroups(): def addMemberTo(self,group,uid,email,password): """ This method add a new member to your bluegroup previously created. This method requires the next parameters: ...
StarcoderdataPython
126326
<filename>extras/forms.py from django import forms from django.contrib.auth.models import User from django.core.exceptions import ValidationError from requests.exceptions import HTTPError from utils.forms import ( APISelectMultiple, BootstrapMixin, DynamicModelMultipleChoiceField, StaticSelect, add...
StarcoderdataPython
1723189
# -*- coding: utf-8 -*- import base64 import os import time from PIL import Image from hashlib import sha1 import requests params = {"token": "", # github 第三方客户端授权token # 用户 "user": "", # 项目名称 "project": "", # 文件路径 "path": "img", # 提交备注 "...
StarcoderdataPython
1674652
def f ( one, two, three, four, five, six, seven, eight, nine, ten, eleven, twelve ) : pass def g (): return 5 ** 2
StarcoderdataPython
7210
<gh_stars>1-10 from __future__ import annotations from contextlib import contextmanager from contextvars import ContextVar from typing import Optional, Tuple from magicgui.widgets import FunctionGui from pydantic import BaseModel class Source(BaseModel): """An object to store the provenance of a layer. Par...
StarcoderdataPython
1605142
class Request(object): """ A Request is the atomic unit in an Action. It represents a single customer's *request* for a ride """ MAX_PICKUP_DELAY: float = 300.0 MAX_DROPOFF_DELAY: float = 600.0 def __init__(self, request_id: int, source: int, ...
StarcoderdataPython
3217733
from typing import Hashable, Iterable, Union import pandas_flavor as pf import pandas as pd from pandas.api.types import is_list_like import warnings from janitor.utils import check, check_column, deprecated_alias from enum import Enum @pf.register_dataframe_method @deprecated_alias(columns="column_names") def encode...
StarcoderdataPython
1691509
<gh_stars>1-10 import biome from pbrtwriter import PbrtWriter class Foliage: def __init__(self, block): self.block = block def write(self, pbrtwriter: PbrtWriter, face): tex = face["texture"] tint_color = biome.getFoliageColor(self.block.biome_id, 0) pbrtwriter.material("tran...
StarcoderdataPython
3228752
<gh_stars>0 """ "abacabad" c "abacabaabacaba" _ "abcdefghijklmnopqrstuvwxyziflskecznslkjfabe" d "bcccccccccccccyb" y """ def first_not_repeating_char(char_sequence): if __name__ == '__main__': char_sequence = str(raw_input('Escribe una secuencia de caracteres: ')) result = first_not_repeating_char(char...
StarcoderdataPython
1789383
from django.urls import path from django.contrib.auth import views as auth_views from . import views as api_views urlpatterns = [ path('profile/delete/solution/<int:pk>/', api_views.delete_solution, name="delete_solution"), path('profile/delete/problem/<int:pk>/', api_views.delete_problem, name="delete_problem...
StarcoderdataPython
156362
<reponame>ckod3/vfxpipe<gh_stars>10-100 # test_utils.py -- Tests for git test utilities. # Copyright (C) 2010 Google, Inc. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # o...
StarcoderdataPython
1794609
<reponame>Rajatkhatri7/Project-Milap #!/usr/bin/env python3 from stack import Stack def is_balanced(inp_str): s = Stack() index = 0 is_balanced = True while index<len(inp_str) and is_balanced: str_ele = inp_str[index] if str_ele in "({[": s.push(str_ele) else...
StarcoderdataPython
1645440
from . import db, login_manager from datetime import datetime from werkzeug.security import generate_password_hash,check_password_hash from flask_login import UserMixin @login_manager.user_loader def load_user(user_id): return User.query.get(int(user_id)) # """ # Pitch class to define Pitch objects ...
StarcoderdataPython
3322775
import argparse import os import pickle as pk import keras import numpy as np from keras import optimizers from keras.callbacks import CSVLogger, ModelCheckpoint from keras.layers import (ELU, GRU, LSTM, BatchNormalization, Bidirectional, Conv2D, Dense, Dropout, Flatten, Input, MaxPooling2D, ...
StarcoderdataPython
1637815
# Generate Delphi wrapper for HDF5 library. # by <NAME> from __future__ import print_function import sys import os.path import argparse import networkx as nx import datetime import re from collections import * from itertools import * parser = argparse.ArgumentParser(description = 'Generate Delphi wrapp...
StarcoderdataPython
1787002
<reponame>bluseking/-first-agnostic-computer-vision-framework-to-offer-a-curated-collection-with-hundreds-of-high-qualit __all__ = [ "draw_label", "bbox_polygon", "draw_mask", "as_rgb_tuple", "get_default_font", ] from icevision.imports import * from icevision.utils import * from matplotlib import ...
StarcoderdataPython
41669
from ..base import OptionsGroup from ..exceptions import ConfigurationError from ..utils import KeyValue, filter_locals from .subscriptions_algos import * class Subscriptions(OptionsGroup): """ This allows some uWSGI instances to announce their presence to subscriptions managing server, which in its turn ...
StarcoderdataPython
137429
<filename>meshpy/meshpy/image_converter.py """ Classes to convert binary images to extruded meshes Author: <NAME> """ import IPython import logging import numpy as np import os from PIL import Image, ImageDraw import sklearn.decomposition import sys import matplotlib.pyplot as plt import skimage.morphology as morph f...
StarcoderdataPython
135330
# coding: utf-8 import json class StixCyberObservable: def __init__(self, opencti, file): self.opencti = opencti self.file = file self.properties = """ id standard_id entity_type parent_types spec_version created_at ...
StarcoderdataPython
1618273
<reponame>byung-u/HackerRank<gh_stars>0 #!/usr/bin/env python3 import sys from functools import reduce ''' terms 1~9 10~99 100~999 ... 9 180 2700 ... 9 * 1 * 10^0 9 * 2 * 10^1 9 * 3 * 10^2 ... ==> 9 * i * (10 ** (i - 1)) ''' for _ in...
StarcoderdataPython
1753348
from datetime import datetime import requests, time, statistics class BangumiMark(object): def __init__(self, subnumber): self.subnumber = subnumber self.avgmark = 0 self.standard_deviation = 0 self.marklist = [] #set a list to store each score is marked by how many...
StarcoderdataPython
1766935
<filename>config.py import inspect import os from pathlib import Path class MissingConfigError(Exception): pass class Config: RABBIT_QUEUE = os.getenv('RABBIT_QUEUE', 'Action.Printer') RABBIT_EXCHANGE = os.getenv('RABBIT_EXCHANGE', 'action-outbound-exchange') RABBIT_HOST = os.getenv('RABBIT_HOST') ...
StarcoderdataPython
108844
<filename>configure.py from setup import * setup()
StarcoderdataPython
3290737
""" bytechomp.serialization """ import struct from typing import Annotated, get_origin, get_args from dataclasses import is_dataclass, fields from bytechomp.datatypes.lookups import ELEMENTARY_TYPE_LIST, TYPE_TO_TAG, TYPE_TO_PYTYPE from bytechomp.byte_order import ByteOrder def flatten_dataclass(data_object: type) ...
StarcoderdataPython
38930
<reponame>FitchOpenSource/C4D-To-Unity import c4d from c4d import gui, documents #Welcome to the world of Python def findNameMaterial(string, materials, cnt): cnt = cnt + 1 string = string + "_" + str(cnt) if materials.count(string) == 0: return string else: string = findNameMater...
StarcoderdataPython
1789608
<reponame>iflyings/flask-website<gh_stars>0 from . import login_manager @login_manager.user_loader def load_user(user_id): return User.get(user_id)
StarcoderdataPython
5104
# Draw image time series for one or more plots from jicbioimage.core.image import Image import dtoolcore import click from translate_labels import rack_plot_to_image_plot from image_utils import join_horizontally, join_vertically def identifiers_where_match_is_true(dataset, match_function): return [i for i i...
StarcoderdataPython
1708235
<filename>pawpyseed/core/noncollinear.py from pawpyseed.core.wavefunction import * class NCLWavefunction(pawpyc.CNCLWavefunction, Wavefunction): def __init__(self, struct, pwf, cr, dim, symprec=1e-4, setup_projectors=False): """ Arguments: struct (pymatgen.core.Structure): structur...
StarcoderdataPython
3317653
<reponame>Soooyeon-Kim/Data-Analysis import numpy as np import pandas as pd print("Masking & query") df = pd.DataFrame(np.random.rand(5, 2), columns=["A", "B"]) #print(df, "\n") # A컬럼값이 0.5보다 작고 B컬럼 값이 0.3보다 큰값 출력 # 마스킹 연산 활용 print(df[(df['A']<0.5)&(df['B']>0.3)]) # query 함수 활용 print(df.query("A<0.5 ...
StarcoderdataPython
3204968
<filename>core/views.py<gh_stars>0 from django.http import HttpResponse from django.shortcuts import render from django.core.mail import send_mail def about(request): return render(request, 'templatepage.html',{}) def contact(request): if request.method == "POST": name = request.POST.get('full-name') ...
StarcoderdataPython
1645038
from libs.scan.check_line import check_line from libs.scan.verbosity_levels_usage import verbosity_levels_usage def extract_log_metrics(lang_logs_list, matching_files, repo_full_name): found_log_lines = [] files_with_logs_count = 0 for code_file in matching_files: are_there_logs_in_file = False ...
StarcoderdataPython
3344642
from django.db import models from django.core.validators import RegexValidator import re from django.db.models.fields import BooleanField, CharField from django.db.models.signals import post_save from django.db.models.deletion import CASCADE class UserManager(models.Manager): def validate(self, form): erro...
StarcoderdataPython
3361121
from django.contrib.auth.models import Group, User from django.test import TestCase from tally_ho.libs.permissions.groups import create_permission_groups, \ create_demo_users_with_groups class TestGroups(TestCase): number_of_groups = 14 def setUp(self): pass def test_create_permission_group...
StarcoderdataPython
3353871
<reponame>RemiDesgrange/onegeo-api # Copyright (c) 2017-2018 Neogeo-Technologies. # 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...
StarcoderdataPython
43389
<filename>commons.py<gh_stars>0 # -*- coding: utf-8 -*- #burden -> n # нагрузка #bandage -> k # шина import numpy import collections class RepresentationBasic(object): """ Basic Representation of the current solution """ def __init__(self, burdens, bandage_n, zero_assignments=False, ...
StarcoderdataPython
173493
# CRIANDO UMA FUNÇÃO def fahrenheit(x): return (x * (9/5)) + 32 x = float(input('Digite uma temperatura em (C°): ')) print(f'A temperatura digitada em {x}C°, é igual a {fahrenheit(x)}F°')
StarcoderdataPython