id
stringlengths
1
7
text
stringlengths
6
1.03M
dataset_id
stringclasses
1 value
3291702
import numpy as np import pandas as pd def simple_aggregate(data, drop_duplicates=True, by='AFFINITY', aggregation='mean', weights=None, half_life=None, ): if drop_duplicates: data = ...
StarcoderdataPython
1620536
import Levenshtein, json, logging, sys, traceback, time, copy, jieba #from es_utils import ElasticObj from correct import Corrector from utils import is_name, clean_query from company import is_company def resolve_search(search): res, s = [], 0 if search and search['hits']['hits']: for hit in ...
StarcoderdataPython
1706996
<reponame>cadia-lvl/spjall-post-processing<filename>extract.py<gh_stars>0 # Author: <NAME> import requests import json import argparse import re import os import shutil class Extraction: def __init__(self, urls, token): self.headers = {'Authorization': 'Bearer ' + token['API_TOKEN']} self.urls = ...
StarcoderdataPython
1646228
from decouple import config import sys, os from .analyze.analyzeSignal import calcPowers from .analyze.pereiraChangeOfMean import pereiraLikelihood, getChangePoints, cleanLikelihoods from .websocket import wsManager from . import data as dataHp import json import numpy as np from django.http import JsonResponse de...
StarcoderdataPython
1780215
# MIT License # # Copyright (c) 2022 TrigonDev # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, pu...
StarcoderdataPython
132771
<filename>python/dynamic_graph/sot/torque_control/tests/test_magdwick.py # -*- coding: utf-8 -*- """ Created on Tue Oct 3 14:01:08 2017 @author: adelpret """ from dynamic_graph.sot.torque_control.madgwickahrs import MadgwickAHRS dt = 0.001 imu_filter = MadgwickAHRS('imu_filter') imu_filter.init(dt) imu_filter.setBe...
StarcoderdataPython
1691369
<gh_stars>0 from GameElementBase import GameElementBase from random import randrange class MapArea(GameElementBase): keymap={} def __init__(self,position,row_data): self.position = position self.visitcount=0 self.inv=[] self.nodes=[] self.roomid = row_data["RoomID"] ...
StarcoderdataPython
194093
#!/usr/bin/env python # Copyright (C) 2014 Open Data ("Open Data" refers to # one or more of the following companies: Open Data Partners LLC, # Open Data Research LLC, or Open Data Capital LLC.) # # This file is part of Hadrian. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this...
StarcoderdataPython
28026
"""Constants for the Ridwell integration.""" import logging DOMAIN = "ridwell" LOGGER = logging.getLogger(__package__) DATA_ACCOUNT = "account" DATA_COORDINATOR = "coordinator" SENSOR_TYPE_NEXT_PICKUP = "next_pickup"
StarcoderdataPython
1682122
import os import unittest import cv2 import face_pose_dataset as fpdat from face_pose_dataset.estimation import mtcnn from face_pose_dataset.estimation.base import ddfa as ddfa from face_pose_dataset.estimation.base import fsanet, hopenet # DONE: Use Sandberg MTCNN def _common_estimation(case, image, detector, est...
StarcoderdataPython
1613124
<reponame>RitujaPawas/ivy # global import numpy as np from typing import Optional import numpy.array_api as npa # local import ivy try: from scipy.special import erf as _erf except (ImportError, ModuleNotFoundError): _erf = None def add(x1: np.ndarray, x2: np.ndarray) -> np.ndarray: if not isinstance(x2...
StarcoderdataPython
4818748
from gym.envs.registration import register register( id='CarlaGymEnv-v1', entry_point='carla_gym.envs:CarlaGymEnv_v1') register( id='CarlaGymEnv-v2', entry_point='carla_gym.envs:CarlaGymEnv_v2')
StarcoderdataPython
1628823
# 2.2 Return Kth to Last: # Implement an algorithm to find the kth to last element of a singly linked list
StarcoderdataPython
95827
# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
StarcoderdataPython
3203197
<gh_stars>0 import wx from ...lib import ButtonBase class Button(ButtonBase): def Draw(self, dc): dc.SetFont(self.config.get_font('small')) dc.SetTextForeground(self.config.get_color('text')) dc.SetBackground(wx.Brush(self.config.get_color('button'))) if self._mouseIn: dc.SetBackground(wx.Brush(self.c...
StarcoderdataPython
3394129
<gh_stars>0 from __future__ import absolute_import import json import six import tempfile from datetime import timedelta from django.core import mail from django.core.urlresolvers import reverse from django.utils import timezone from sentry.data_export.base import ExportQueryType, ExportStatus, DEFAULT_EXPIRATION fro...
StarcoderdataPython
195362
# -*- coding: utf-8 -*- """ Created on Wed Dec 18 13:50:29 2019 @author: Joshua """ # Load libraries import pandas as pd pd.__version__ import os import Python.Data_Preprocessing.config.config as cfg import Python.Data_Preprocessing.Stage_4.demographics.session_level_wordcount as slw from tqdm import tqdm def z_...
StarcoderdataPython
3260289
<gh_stars>0 from __future__ import unicode_literals import datetime from django.db import models from carros.users.models import User # Create your models here. class Alert(models.Model): val = "-1" default_year = "0" CHOICES_YEAR_DESDE = ( (default_year, 'Desde'), ("2017",'2017'), ("2016",'2016'), ("2...
StarcoderdataPython
3317526
<reponame>thiagofreitascarneiro/Python-avancado-Geek-University ''' JSON ePickle JSON -> JavaScript Object Notation API ->São meios de comunicação entre os serviços oferecidos por empresas (Twitter, Facebook, Youtube...) e terceiros(nós desenvolvedores). import json ret = json.dumps(['produto', {'Playstation 4': ('...
StarcoderdataPython
3273541
# This is a _very simple_ example of a web service that recognizes faces in uploaded images. # # The result is returned as json. For example: # # $ curl -XPOST -F "file=@obama2.jpg" http://127.0.0.1:5001 # # Returns: # # { # "face_found_in_image": true, # "is_picture_of_obama": true # } # # This example is based on ...
StarcoderdataPython
3345492
<reponame>maciek-slon/DisCODe<gh_stars>1-10 #! /usr/bin/env python # Copyright (c) 2010 Warsaw Univeristy of Technology # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction...
StarcoderdataPython
3350218
<gh_stars>10-100 from .utils import get_test_data_path from ..abbr import findall, expandall, compressall, clean_str from glob import glob from os.path import join import json def test_findall(): data_dir = get_test_data_path() files = glob(join(data_dir, 'raw*.txt')) for f in files: json_file = f...
StarcoderdataPython
3215815
BASE_URL = 'https://nova-dveri.ru/' USER_AGENT = ('Mozilla/5.0 (iPhone; CPU iPhone OS 14_7 like Mac OS X) ' 'AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/92.0.4515.90 ' 'Mobile/15E148 Safari/604.1') HTML_SITE_MAP = 'sitemap2' HEADERS = {'User-Agent': USER_AGENT}
StarcoderdataPython
4822408
<gh_stars>0 # https://github.com/nestordeharo/mysql-python-class/blob/master/mysql_python.py import MySQLdb from config import * from collections import OrderedDict import datetime class MysqlPython(object): """ #https://github.com/nestordeharo/mysql-python-class/blob/master/mysql_python.py Python...
StarcoderdataPython
1776198
import sys from rokuon.application import Application if __name__ == "__main__": app = Application() sys.exit(app.run(sys.argv))
StarcoderdataPython
1656181
import re import glob from json import dumps from os.path import curdir, abspath, join, splitext, isfile from os import walk rfc_2119_keywords_regexes = [ r"MUST", r"REQUIRED", r"SHALL", r"MUST NOT", r"SHALL NOT", r"SHOULD", r"RECOMMENDED", r"SHOULD NOT", r"NOT RECOMMENDED", r"M...
StarcoderdataPython
93758
<gh_stars>1-10 # General Errors NO_ERROR = 0 USER_EXIT = 1 ERR_SUDO_PERMS = 100 ERR_FOUND = 101 ERR_PYTHON_PKG = 154 # Warnings WARN_FILE_PERMS = 115 WARN_LOG_ERRS = 126 WARN_LOG_WARNS = 127 WARN_LARGE_FILES = 151 # Installation Errors ERR_BITS = 102 ERR_OS_VER = 103 ERR_OS = 104 ERR_FINDING_OS = 105 ERR_FREE_SPACE =...
StarcoderdataPython
3302516
<filename>tilty_dashboard/__init__.py # -*- coding: utf-8 -*- """ The main method, handles all initialization """ import logging import os from datetime import datetime, timedelta from flask import Flask, render_template, session from flask_bootstrap import Bootstrap from flask_cors import CORS from flask_socketio imp...
StarcoderdataPython
59961
from django.http import HttpResponse, HttpResponseRedirect from django.urls import reverse from django.db.models import Q from .models import ( Deck, Grave, Hand, Duel, Trigger, Lock, ) from pprint import pprint from .battle_det import battle_det,battle_det_return_org_ai from .duel import DuelOb...
StarcoderdataPython
23541
import tensorflow as tf from os import path import numpy as np from scipy import misc from styx_msgs.msg import TrafficLight import cv2 import rospy import tensorflow as tf class CarlaModel(object): def __init__(self, model_checkpoint): self.sess = None self.checkpoint = model_checkpoint ...
StarcoderdataPython
1620895
#! /usr/bin/env python2 import sys import time import os #---------------------------------------------------------------------- # flow control #---------------------------------------------------------------------- def flow_control(command, hz): import subprocess hz = (hz < 10) and 10 or hz #sys.stdout.write('%d:...
StarcoderdataPython
1618577
<reponame>wmvanvliet/psychic import numpy as np from .basenode import BaseNode from ..dataset import DataSet from .spatialfilter import sym_whitening, cov0 from ..utils import get_samplerate from scipy import signal class SlowSphering(BaseNode): def __init__(self, isi=10, reest=.5): ''' Define a SlowSphering...
StarcoderdataPython
3308747
<reponame>Nub-Team/MLP-Classifier<gh_stars>0 from Network import Network import os import numpy as np Name = '1' if not os.path.exists('out'): os.makedirs('out') Path = os.path.join(os.getcwd(), 'out') Neuron_in_topo = [0,0,0,1] Neuron_in = 1 Neuron_hidden = 4 Learning_r = 0.1 Moment = 0.5 Bias = 1 Epoches = ...
StarcoderdataPython
3273950
from django import forms from .models import * from django.forms import ModelForm from .choices import * class CreateCurriculumForm(forms.ModelForm): CurriculumName = forms.CharField(widget=forms.TextInput(attrs={'class':'form-control'}),label='Curriculum Name:') FacultyName = forms.ChoiceField(widget=fo...
StarcoderdataPython
1770291
from flask import Flask, render_template, request, g, flash, redirect, url_for import openaq from .models import DB, Record from .forms import SelectCityForm def create_app(): """Create and configure an instance of the Flask application.""" app = Flask(__name__) app.secret_key = 'super secret key' app...
StarcoderdataPython
16199
<filename>python/cython_build.py from distutils.core import setup from distutils.extension import Extension from Cython.Build import cythonize import sys python_version = sys.version_info[0] setup( name='batch_jaro_winkler', ext_modules=cythonize([Extension('batch_jaro_winkler', ['cbatch_jaro_winkler.pyx'])], l...
StarcoderdataPython
1656763
<filename>wordservice/tests/wordservice/test_wordservice.py # -*- coding: utf-8 -*- __author__ = "<NAME>" __copyright__ = "<NAME>" __license__ = "mit" import os from unittest import TestCase, mock from wordservice import WordService class TrieTest(TestCase): _resources_dir = os.path.normpath(os.path.join(os.pa...
StarcoderdataPython
117843
import logging import numpy as np import pandas import constants import pygeoutil.util as util from preprocess_IAM import IAM class GCAM(IAM): """ Class for GCAM """ def __init__(self, path_nc): IAM.__init__(self, 'GCAM', path_nc) self.land_var = 'landcoverpercentage' # Inpu...
StarcoderdataPython
159055
import abc from contextlib import contextmanager import datetime from sqlalchemy.ext.declarative import declarative_base from sqlalchemy import Column, String, ForeignKey, Float, Integer, DateTime, Enum from . import requests from . import storage RequestsBase = declarative_base() class SQLAlchemyStorage(abc.ABC):...
StarcoderdataPython
4829208
t = int(input()) for _ in range(t): x, y, z = map(int, input().split(' ')) print(['Cat A','Cat B', 'Mouse C'][0 if abs(x-z) < abs(y-z) else 1 if abs(x-z) > abs(y-z) else 2])
StarcoderdataPython
3299462
# Copyright 2021 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 applicable law or agreed to in writi...
StarcoderdataPython
65056
""" Google Cloud Emulators ====================== Allows to spin up google cloud emulators, such as PubSub. """ from .pubsub import PubSubContainer # noqa
StarcoderdataPython
1668847
#!/usr/bin/env python """ ############################ Incident Package Data Module ############################ """ # -*- coding: utf-8 -*- # # rtk.incident.Incident.py is part of The RTK Project # # All rights reserved. # Copyright 2007 - 2017 <NAME> <EMAIL>rew.rowland <AT> reliaqual <DOT> com # # Redistributi...
StarcoderdataPython
1627577
<filename>tests/tests.py<gh_stars>1-10 import os import pandas import pytest import pygeneactiv import simplejson as json __DIR__ = os.path.dirname(__file__) def test_headers(): geneactiv_file = os.path.join(__DIR__, 'right_wrist.csv') headers_file = os.path.join(__DIR__, 'headers.json') ds = pygeneactiv....
StarcoderdataPython
96695
<filename>ssm/init_state_distns.py from functools import partial from warnings import warn import autograd.numpy as np import autograd.numpy.random as npr from autograd.scipy.special import logsumexp from autograd.misc.optimizers import sgd, adam from autograd import grad from ssm.util import ensure_args_are_lists c...
StarcoderdataPython
3327087
from simglucose.simulation.user_interface import simulate from simglucose.controller.base import Controller, Action class MyController(Controller): def __init__(self, init_state): self.init_state = init_state self.state = init_state def policy(self, observation, reward, done, **info): ...
StarcoderdataPython
4812985
<gh_stars>0 __author__ = '10bestman'
StarcoderdataPython
177611
<filename>guidance_and_support/models.py """Model definitions for the guidance_and_support app.""" from django.db import models from wagtail.admin.edit_handlers import FieldPanel from wagtail.core.fields import StreamField, RichTextField from wagtail.core.models import Page from wagtail.images.edit_handlers import Im...
StarcoderdataPython
24329
from dataclasses import dataclass, field from typing import Dict import perde import pytest from util import FORMATS, FORMATS_EXCEPT """rust #[derive(Serialize, Debug, new)] struct Plain { a: String, b: String, c: u64, } add!(Plain {"xxx".into(), "yyy".into(), 3}); """ @pytest.mark.parametrize("m", FORMATS) d...
StarcoderdataPython
991
<gh_stars>0 import urllib2 import json import time from core.helpers.decorator import Cached from core.helpers.config import config from core.helpers.logger import log, LogLevel @Cached def __request(request): log('Send Fanart Request: ' + request.replace(config.fanart.api_key, 'XXX'), 'DEBUG') headers = {'A...
StarcoderdataPython
4833606
<filename>util.py<gh_stars>0 import os, struct, math import numpy as np import torch from glob import glob import data_util import shlex import subprocess import torch.nn.functional as F def backproject(ux, uy, depth, intrinsic): '''Given a point in pixel coordinates plus depth gives the coordinates of the image...
StarcoderdataPython
3265122
# # Copyright (C) 2007 <NAME> (fire at downgra dot de) # # 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 # of the License, or (at your option) any later version. # # This progr...
StarcoderdataPython
120510
from PyQt5.QtGui import QPixmap from PyQt5.QtWidgets import QLabel from Constants import * class Bullet(QLabel): def __init__(self, offset_x, offset_y, parent, enemy=False): QLabel.__init__(self, parent) if enemy: self.setPixmap(QPixmap("images/bullet/enemy_bullet.png")) else:...
StarcoderdataPython
1735417
''' all-table virtual column related code ''' import pandas as pd from bsbetl.alltable_calcs import at_columns from bsbetl.alltable_calcs.at_virtual_cols import Virtual_Column class at_virtual_MovingAverage(Virtual_Column): """ represents and can creates a column in an all-table dataframe containing moving avera...
StarcoderdataPython
1649285
from .cbl_type import CBLType, CBLTypeInstance, CBLTypeMeta from .containers import Temporary from .function_type import InstanceFunctionType import cmd_ir.instructions as i class StructTypeInstance(CBLTypeInstance): def __init__(self, compiler, this, var_members, func_members, func_properties): super()....
StarcoderdataPython
3215582
<gh_stars>0 # Copyright (c) The Libra Core Contributors # SPDX-License-Identifier: Apache-2.0 from jwcrypto.common import base64url_encode from cryptography.exceptions import InvalidSignature from jwcrypto import jwk, jws import json class OffChainInvalidSignature(Exception): pass class IncorrectInputExceptio...
StarcoderdataPython
4823393
import os # f = open("E:\\My Codes\\Python Codes\\April 2021\\30-04-2021\\file2.txt", "a") # Counts the number of letters in the string # count = f.write("<NAME>\n") # print(count) # To read and write both at the same time print(os.getcwd()) f = open("E:\\My Codes\\Python Codes\\April 2021\\30-04-2021\\file2.txt", "r+...
StarcoderdataPython
3222208
from typing import Counter class Node: '''' THis the class is responsiple to create the Nodes ''' def __init__(self, value=""): self.value = value self.next = None def __add__(self, other): return Node(self.value + other.value) # def __str__(self,value) -> str: # return value def...
StarcoderdataPython
3224371
from asyncio import gather from datetime import datetime, timezone from sanic import Blueprint from sanic.request import Request from sanic.response import HTTPResponse, json from vxwhatsapp import config from vxwhatsapp.auth import validate_hmac from vxwhatsapp.claims import store_conversation_claim from vxwhatsapp....
StarcoderdataPython
1713296
<filename>test/programytest/oob/test_default.py import unittest from programy.oob.default import DefaultOutOfBandProcessor import xml.etree.ElementTree as ET from programy.context import ClientContext from programytest.aiml_tests.client import TestClient class DefaultOutOfBandProcessorTests(unittest.TestCase): ...
StarcoderdataPython
3329857
# Credit to GPFlow. import tensorflow as tf import numpy as np class Gaussian(object): def logdensity(self, x, mu, var): return -0.5 * (np.log(2 * np.pi) + tf.log(var) + tf.square(mu-x) / var) def __init__(self, variance=1.0, **kwargs): self.variance = tf.exp(tf.Variable(np.log(variance), dty...
StarcoderdataPython
1792721
<filename>byte_api/client.py from .api import Api from .types import * class Client(object): """ Initializes the API for the client :param token: Authorization token :type token: str :param headers: Additional headers **except Authorization** :type headers: dict """ def __init__(sel...
StarcoderdataPython
103222
#!/usr/bin/env python3 import argparse import tempfile import logging import difflib import glob import json import sys import os import re from pprint import pformat from .counter import PapersForCount, SenateCounter from .aecdata import CandidateList, SenateATL, SenateBTL, FormalPreferences from .common import logge...
StarcoderdataPython
68650
<gh_stars>0 # Define a Product class. Objects should have 3 variables for price, code, and quantity class Product: def __init__(self, price=0.00, code='aaaa', quantity=0): self.price = price self.code = code self.quantity = quantity def __repr__(self): return f'Product...
StarcoderdataPython
4826403
# # Copyright 2016 The BigDL 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
1755316
from os import path import glob from updater import get_updater from filter import get_filter from cache import get_cache from merge import (FileHunk, MemoryHunk, apply_filters, merge, make_url, merge_filters) __all__ = ('Bundle', 'BundleError',) class BundleError(Exception): pass class Bui...
StarcoderdataPython
3302603
import random # MOVIES = ['Titanic', # 'Docker: Unleashed', # 'Julia: Elegant and Hip', # 'Python : The Slow Snake', # 'C: Kids these days dont know how to compile code', # '<NAME>'] class RecommenderClass: """Class for grouping all my functions""" def __in...
StarcoderdataPython
1751025
""" PLease set following environment variables for this script to work properly export DAPP_INSTANCES=<some integer> default value=1 export WEB3J_ETHCLIENT_HOST=<ip address> default value=None export WEB3J_ETHCLIENT_PROTOCOL=<> default value=http export WEB3J_ETHCLIENT_PORT=<> default value=8545 export SHARE_C...
StarcoderdataPython
1789762
import re data = [line.strip() for line in open('final_project/poi_names.txt')] valid_data = [] for l in data: if re.search('\(.\)', l): valid_data.append(l) print valid_data poi_names = 0 for l in valid_data: if re.search('\(y\)',l): poi_names += 1 print "# of POI names :", len(valid_data)
StarcoderdataPython
23584
from pandas.core.algorithms import mode import torch import torch.nn as nn from albumentations import Compose,Resize,Normalize from albumentations.pytorch import ToTensorV2 import wandb import time import torchvision import torch.nn.functional as F import torch.optim as optim from torch.cuda.amp import autocast,GradSc...
StarcoderdataPython
3341308
<filename>dashboard/src/commands/data.py<gh_stars>1-10 import click import pandas as pd from flask.cli import AppGroup from src.database import db def get_states(csv_path): ''' Read the relevant state columns from specified CSV file ''' df = pd.read_csv(csv_path, delimiter=';', encoding='ISO-8859-1', ...
StarcoderdataPython
3317947
from ..flags import * if BACKEND_FLAGS.HAS_PROTO: from . import ChainProto def get_protobuf_numbering_scheme(numbering_scheme): """ Returns ChainProto field value of a given numbering scheme Args: numbering_scheme: Returns: """ if numbering_scheme == NUMBERING_FLAGS.KABAT: ...
StarcoderdataPython
1645845
#!/usr/bin/env python3 import os import argparse import shutil from collections import namedtuple class BalanceSource(): def __init__(self, path, free_bytes, total_bytes, used_bytes): self.path = path self.free_bytes = free_bytes self.total_bytes = total_bytes self.used_bytes = us...
StarcoderdataPython
88071
import numpy as np from scipy.interpolate import LinearNDInterpolator, interp1d from astropy import table from astropy.table import Table, Column import warnings def get_track_meta(track, key="FeH"): """ get meta info from a track """ assert key in track.meta.keys() return track.meta[key] def find_ran...
StarcoderdataPython
1605587
#!/usr/bin/env python3 """ Contains a class to use an atlas to look up your location inside a brain. Created 2/8/2021 by <NAME>. """ from pathlib import Path from typing import Dict, Tuple import templateflow.api import pandas import nibabel import numpy from functools import cached_property from dataclasses import d...
StarcoderdataPython
3231311
<filename>setup.py import os from setuptools import setup, find_packages root_dir_path = os.path.dirname(os.path.abspath(__file__)) long_description = open(os.path.join(root_dir_path, "README.md")).read() version = open(os.path.join(root_dir_path, "version.txt")).read() requirements_path = os.path.join(root_dir_path...
StarcoderdataPython
1705266
import sys, os import streamlit as st sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from next_word_prediction import GPT2 @st.cache(hash_funcs={GPT2: lambda _: None}) def load_model(): return GPT2() def app(): gpt2 = load_model() st.title("Next Word Prediction Using GPT...
StarcoderdataPython
3282453
from whitenoise import WhiteNoise from app import app application = WhiteNoise(app) application.add_files('static/', prefix='static/')
StarcoderdataPython
3292457
#!/usr/bin/env python import os import setuptools CLASSIFIERS = [ 'Development Status :: 5 - Production/Stable', 'Intended Audience :: Developers', 'License :: OSI Approved :: MIT License', 'Operating System :: Microsoft :: Windows', 'Programming Language :: Python', 'Topic :: Software Develo...
StarcoderdataPython
3327354
<gh_stars>1-10 import hashlib import os import random import string from datetime import date import mechanicalsoup import pytest import requests from mechanicalsoup import StatefulBrowser from igem_wikisync.browser import check_login, iGEM_login, iGEM_upload_file, iGEM_upload_page from igem_wikisync.files import HTM...
StarcoderdataPython
57179
# coding: utf-8 """ Utilities to handle mongoengine classes and connections. """ import contextlib from pymatgen.util.serialization import pmg_serialize from monty.json import MSONable from mongoengine import connect from mongoengine.context_managers import switch_collection from mongoengine.connection import DEFAULT_...
StarcoderdataPython
3369999
__all__ = ["graphic", "play", "sound"] from . import graphic from . import play from . import sound
StarcoderdataPython
1708510
<filename>encore/events/tests/test_event_manager.py # # (C) Copyright 2011 Enthought, Inc., Austin, TX # All right reserved. # # This file is open source software distributed according to the terms in LICENSE.txt # # Standard library imports. import unittest import mock import weakref import threading # Local imports...
StarcoderdataPython
3296894
<filename>utils/confmodif.py import os def conf_file_modify(pop): config_file = open(os.path.join("utils", "config-feedforward.txt"), "w") config_file.write("[NEAT]\n") config_file.write("fitness_criterion = max\n") config_file.write("fitness_threshold = 50\n") config_file.write("pop_size ...
StarcoderdataPython
4832477
<reponame>sm2774us/amazon_interview_prep_2021<filename>solutions/python3/738.py<gh_stars>10-100 class Solution: def monotoneIncreasingDigits(self, N): """ :type N: int :rtype: int """ n, pos = str(N), 0 for i, char in enumerate(n): if i>0 and int(n[i])<int...
StarcoderdataPython
1721554
<filename>wagtail/contrib/simple_translation/tests/test_forms.py from django.forms import CheckboxInput, HiddenInput from django.test import TestCase, override_settings from wagtail.contrib.simple_translation.forms import SubmitTranslationForm from wagtail.core.models import Locale, Page from wagtail.tests.i18n.models...
StarcoderdataPython
108256
import numpy as np import random import time from sudoku.node import Node class Sudoku(): def __init__(self, size=9, custom=None, verbose=False, debug=False): # assume size is perfect square (TODO: assert square) # size is defined as the length of one side """ Custom s...
StarcoderdataPython
3289813
from pyokofen.utils import ( OkofenDefinition, OkofenDefinitionHelperMixin, temperature_format, ) class Sk(OkofenDefinitionHelperMixin, OkofenDefinition): def __init__(self, data): """solar circuit data""" cls = super() cls.__init__("sk") cls.set("L_koll_temp", temperat...
StarcoderdataPython
3331129
<filename>scale/queue/migrations/0004_remove_queue_is_job_type_paused.py # -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('queue', '0003_auto_20151023_1104'), ] operations = [ ...
StarcoderdataPython
3314157
"""/** * @author [<NAME>] * @email [<EMAIL>] * @create date 2020-08-13 13:31:28 * @modify date 2020-08-13 13:31:36 * @desc [ Contains: - logger - log decorator - log_all function Logger level is accessed through Lambda environment variable: log_level Logger levels described below: 50 Critical 40 Error ...
StarcoderdataPython
3287547
<reponame>DrewLazzeriKitware/trame import venv from trame import update_state, change from trame.html import vuetify, paraview from trame.layouts import SinglePage from paraview import simple # ----------------------------------------------------------------------------- # ParaView code # ----------------------------...
StarcoderdataPython
3248618
import doctest import functools import numpy import tensorflow as tf def static_shape(tensor): """Get a static shape of a Tensor. Args: tensor: Tensor object. Return: List of int. """ return tf.convert_to_tensor(tensor).get_shape().as_list() def static_shapes(*tensors): """Get static shapes ...
StarcoderdataPython
3344817
import os from setuptools import find_packages, setup with open('README.rst') as fh: readme = fh.read() description = 'Girder Worker tasks for Large Image.' long_description = readme def prerelease_local_scheme(version): """ Return local scheme version unless building on master in CircleCI. This f...
StarcoderdataPython
3264039
<reponame>lari/VWsFriend import logging from sqlalchemy import and_ from sqlalchemy.exc import IntegrityError from vwsfriend.model.climatization import Climatization from weconnect.addressable import AddressableLeaf LOG = logging.getLogger("VWsFriend") class ClimatizationAgent(): def __init__(self, session, ve...
StarcoderdataPython
1642450
from drf_spectacular.types import OpenApiTypes from urllib.parse import unquote import requests from requests.models import HTTPBasicAuth from rest_framework.views import APIView from rest_framework.generics import ListAPIView, ListCreateAPIView, RetrieveDestroyAPIView, get_object_or_404 from rest_framework.response im...
StarcoderdataPython
42514
# 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
1765003
<reponame>awilkins/CSC18 # Import arcpy module so we can use ArcGIS geoprocessing tools import arcpy import sys, os #--------------------------------------------------------------------------------------------- # 1. Get parameters from the toolbox using 'GetParametersAsText' method # --> check ArcGIS help for info h...
StarcoderdataPython
136194
import logging from typing import Any, Dict, Callable _log = logging.getLogger(__name__) __all__ = ("EventMixin",) class EventMixin: events: Dict[str, Callable] = {} def dispatch(self, event_name: str, *args: Any, **kwargs: Any) -> Any: event = self.events.get(event_name) if not event: ...
StarcoderdataPython
98238
<filename>crear_base.py from sqlalchemy import create_engine # se genera en enlace al gestor de base de # datos # para el ejemplo se usa la base de datos # sqlite engine = create_engine('sqlite:///demobase.db') from sqlalchemy.ext.declarative import declarative_base Base = declarative_base() from sqlalchemy import ...
StarcoderdataPython
3330406
from PIL import Image import numpy as np import matplotlib.pyplot as plt import time import cv2 as cv from Model import Model import argparse def get_opt(): parser = argparse.ArgumentParser() parser.add_argument('--jpp', type=str, default='checkpoints/jpp.pb', help='model checkpoint for JPPNet') ...
StarcoderdataPython