id
stringlengths
1
7
text
stringlengths
6
1.03M
dataset_id
stringclasses
1 value
8973
from argparse import ArgumentParser import os import numpy as np from joblib import dump from mldftdat.workflow_utils import SAVE_ROOT from mldftdat.models.gp import * from mldftdat.data import load_descriptors, filter_descriptors import yaml def parse_settings(args): fname = args.datasets_list[0] if args.suff...
StarcoderdataPython
1603161
<filename>bot.py import discord from discord.ext import commands import asyncio import mysql.connector import instaloader import datetime import schedule L = instaloader.Instaloader() USER = 'usernamehere' # Your preferred way of logging in: L.load_session_from_file(USER, './session-' + USER) db = mysql.connector.co...
StarcoderdataPython
4812529
<reponame>x0rzkov/imsearch<gh_stars>10-100 import os from pymongo import MongoClient class MongoRepository: def __init__(self, index_name): url = os.environ.get('MONGO_URI') self.db = MongoClient(url).imsearch[index_name] def clean(self): self.db.drop() def insert_one(self, data)...
StarcoderdataPython
1761974
<reponame>pozdnyakov/chromium-crosswalk # Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import copy import os import sys import json_parse import schema_util def DeleteNodes(item, delete_key): """D...
StarcoderdataPython
148424
<reponame>Mahas1/Guren<filename>Guren/gifs.py from discord.ext import commands import utils.json_loader class Eval(commands.Cog): def __init__(self, bot): self.bot = bot @commands.is_owner() @commands.command() async def dump_gif(self, ctx): kiss = "kiss" hug = "hug" ...
StarcoderdataPython
67152
# Copyright (c) 2012-2018 SoftBank Robotics. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the COPYING file. import os import pytest import qisys.archive from qisys.test.conftest import skip_on_win import qitoolchain.qipackage # allow the existing foo/bar/ba...
StarcoderdataPython
1721109
<filename>Algos/Quick_Sort.py<gh_stars>0 def quicksort(x): if len(x) == 1 or len(x) == 0: return x else: pivot = x[0] i = 0 for j in range(len(x)-1): if x[j+1] < pivot: x[j+1],x[i+1] = x[i+1], x[j+1] i += 1 x[0],x[i] = x[i],x[0]...
StarcoderdataPython
144884
<filename>third_party/cargo/crates.bzl """ cargo-raze crate workspace functions DO NOT EDIT! Replaced on runs of cargo-raze """ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") load("@bazel_tools//tools/build_defs/repo:git.bzl", "new_git_repository") def _new_http_archive(name, **kwargs): if n...
StarcoderdataPython
3304648
##================================== ## External imports ##================================== import os import io import flask import urllib import dash_core_components as dcc import dash_html_components as html import dash_bootstrap_components as dbc from dash.dependencies import Input, Output, State from dash.excepti...
StarcoderdataPython
121381
# import XML libraries import xml.etree.ElementTree as ET import xml.dom.minidom as minidom import HTMLParser # Function to create an XML structure def make_problem_XML( problem_title='Missing title', problem_text=False, label_text='Enter your answer below.', description_text=False, answers=[{'corr...
StarcoderdataPython
3684
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Module that contains the command line app. Why does this file exist, and why not put this in __main__? You might be tempted to import things from __main__ later, but that will cause problems: the code will get executed twice: - When you run `python -m nibetaser...
StarcoderdataPython
1688833
<filename>apps/dg_test/img2tensor.py import numpy as np import sys import getopt import os.path import os from PIL import Image def createImagelist(imageDir, imageListDir) : print('') print('Reading png images...') os.system('ls -d '+ imageDir + '/*.png >> ' + imageListDir) print('') print('Reading...
StarcoderdataPython
88849
<reponame>rsketine/neon<gh_stars>1000+ #!/usr/bin/env python # ****************************************************************************** # Copyright 2017-2018 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # Y...
StarcoderdataPython
104689
__author__ = 'Kalyan' notes = ''' nested functions underlie many advanced features of python. So a basic understanding of this feature is essential to mastering python. nested functions are defined in the scope of a function, behave exactly the same except that they have a read only access to variables in the ...
StarcoderdataPython
1614691
<gh_stars>0 def get_formatted_name(first, last): full_name = first + ' ' + last return full_name.title()
StarcoderdataPython
4817730
<filename>Lecture-6/Code/OpenHashing_Lookup.py def lookup(s): j = 0 while t[(h(s) - g(s, j)) mod m] \ is not None: if t[(h(s) - g(s, j)) mod m][0] != s: j += 1 if t[(h(s) - g(s, j)) mod m][0] == s: return t[(h(s) - g(s, j)) mod m] return None
StarcoderdataPython
77296
<filename>code/utilities.py # python imports import sys, signal, math, copy, random, os, re # torch imports import torch import torch.nn as nn # numpy imports import numpy as np # sklearn imports import sklearn.cluster as skcl # graphviz imports from graphviz import Digraph import networkx as nx # natural language impo...
StarcoderdataPython
1738469
#!/usr/bin/python # -*- coding: utf-8 -*- config = { 'LOCALE': 'en', 'LOCALES_DIR': 'static/locales', 'ROOT_PATH': None, 'GOOGLEMAPS_KEY': '<KEY>' }
StarcoderdataPython
3396732
<gh_stars>1-10 from nonebot import on_command, CommandSession from nonebot.permission import PRIVATE from .utils import make_dragon ERROR_MSG = "输入不合规。请重新输入。" @on_command('dragonmaker', aliases=('造龙', '生成龙图'), only_to_me=False, permission=PRIVATE) async def dragonmaker(session: CommandSession): # 从会话状态中获取需要龙化的图...
StarcoderdataPython
150459
<gh_stars>0 MASTER_NAME = 'localhost:9090' MASTER_AUTH = ('<PASSWORD>', 'password') TEST_MONITOR_SVC_URLS = dict( base='http://{0}/nitestmonitor', base_sans_protocol='{0}://{1}/nitestmonitor', can_write='/v2/can-write', query_results='/v1/query-results', query_results_skip_take='/v1/query...
StarcoderdataPython
1613872
<gh_stars>0 from django.urls import path from . import views urlpatterns = [ path('recommend/', views.get_similar_recommendation, name='recommend'), ]
StarcoderdataPython
3388527
#!/usr/bin/env python '''This script is developed to define and load a mission in a fixed wing UAV using the ual_backend_mavros_fw. Firstly, it has to be executed roslaunch ual_backend_mavros_fw simulations.launch''' import rospy, std_msgs, std_srvs from geometry_msgs.msg import PoseStamped, Pose, Point, Quaternion f...
StarcoderdataPython
4830405
# coding=utf8 from . import record_utils as ru EDITABLE_INPUT_CONNECTION_TAG = '[EditableInputConnection]' SPANNER_STRING_BUILDER_TAG = '[SpannerStringBuilder]' TEXT_VIEW_KEY_TAG = '[TextViewKeyboard]' # Keyboard Action def instrument_EditableInputConnection(): hook_code = """ Java.perform(function(){ ...
StarcoderdataPython
93731
<reponame>lucasmello/Driloader # pylint: disable=too-few-public-methods """ driloader.factories.browser_factory Module which abstracts the browser instantiations. """ from driloader.browser.chrome import Chrome from driloader.browser.drivers import Driver from driloader.browser.exceptions import BrowserNotSupporte...
StarcoderdataPython
4833129
<filename>lib/matplotlib/table.py """ Place a table below the x-axis at location loc. The table consists of a grid of cells. The grid need not be rectangular and can have holes. Cells are added by specifying their row and column. For the purposes of positioning the cell at (0, 0) is assumed to be at the top left an...
StarcoderdataPython
107315
import json person = {'name':'John','age':28,'city':'New York','hasChildren':False} personJson = json.dumps(person,indent=4,separators=(':','='),sort_keys=True) print(personJson) with open('res/person.json', 'w') as f: json.dump(person,f,indent=4) person = {'name':'John','age':28,'city':'New York','hasChildren'...
StarcoderdataPython
70802
class NSGA2: def __init__(self, initializer, evaluator, selector, crossover, mutator, stopper): self.initializer = initializer self.evaluator = evaluator self.selector = selector self.crossover = crossover self.mutator = mutator self.stopper = stopper self.po...
StarcoderdataPython
4802878
<gh_stars>1-10 from pl_bolts.models.vision.pixel_cnn import PixelCNN # noqa: F401 from pl_bolts.models.vision.segmentation import SemSegment # noqa: F401 from pl_bolts.models.vision.unet import UNet # noqa: F401
StarcoderdataPython
3263451
import re from django import forms from django.http import Http404 from django.urls import reverse from django.db.models import Q, Case, When, IntegerField, F from django.shortcuts import render, get_object_or_404, redirect from django.db.models.functions import Lower from texts.search_fields import get_search_fields f...
StarcoderdataPython
3376042
from app import db from datetime import datetime from logging import log from time import time class Organisation(db.Model): __tablename__ = 'organisations' id = db.Column(db.Integer, primary_key=True) #user_id = db.Column(db.Integer, db.ForeignKey('users.id', ondelete="CASCADE"), nullable=False) #imag...
StarcoderdataPython
167193
# It must be here to retrieve this information from the dummy core_universal_identifier = 'd9d94986-ea14-11e0-bd1d-00216a5807c8' core_universal_identifier_human = 'Consumer' db_database = "WebLabTests" weblab_db_username = 'weblab' weblab_db_password = '<PASSWORD>' debug_mode = True #########################...
StarcoderdataPython
117882
<filename>micropython/tests/umqtt/robust.py """Fake mqtt interface - this simulates the api provided by micropython. We use paho.mqtt to talk to the broker. """ import paho.mqtt.client class MQTTClient: def __init__(self, name, host, port): self.client = paho.mqtt.client.Client(name) self.host = ho...
StarcoderdataPython
3343497
import os import ffmpeg import numpy as np # from spleeter import * # from spleeter.audio.adapter import get_default_audio_adapter # from spleeter.separator import Separator # from spleeter.utils import * from django.conf import settings from .models import ProcessedTrack class SpleeterSeparator: """Performs sourc...
StarcoderdataPython
43948
# ----------------------------------------------------------------------------- # System Imports # ----------------------------------------------------------------------------- from operator import itemgetter # ----------------------------------------------------------------------------- # Public Imports # ----------...
StarcoderdataPython
156854
<filename>buildchatbot.py # # buildchatbot - Monitors Jenkins builds and sends notifications to a Skype chat # # Copyright (c) 2012 <NAME> - All rights reserved. # Licensed under the BSD 2-clause license; see LICENSE.txt # import platform from time import sleep from urllib import urlopen from Skype4Py import Skype from...
StarcoderdataPython
1758811
from future.utils import with_metaclass as with_metaclass_future from six import with_metaclass as with_metaclass_six __all__ = ["interoperable_with_metaclass_future", "interoperable_with_metaclass_six"] def interoperable_with_metaclass(with_metaclass, metaclass): return type("{0}Wrapper".format(metaclass.__name...
StarcoderdataPython
129651
<reponame>jsheperd/rotate_backup #!/usr/bin/env python import sys import os import glob import time class archive: # The archive class represent an archive media with its age related parameters def __init__(self, path): self.path = path self.time = time.gmtime(os.path.getmtime(path)) se...
StarcoderdataPython
170800
<reponame>damicoedoardo/NNMF #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on 16/09/2017 @author: XXX """ from RecSysFramework.Recommender import Recommender from RecSysFramework.Recommender.KNN import ItemKNNCustomSimilarity from RecSysFramework.Utils import check_matrix from RecSysFramework.Utils impor...
StarcoderdataPython
3288965
<filename>gwrapper/string_filter.py import requests class String_Filter(object): def __init__(self, list, text_list, filter, entity, auth): self.pr_list = list self.text_list = text_list self.filter = filter self.entity = entity self.auth = auth self.response_list =...
StarcoderdataPython
169115
import sys import h5py import numpy as np from pydata.increment import __next_index__ if 'pyslave' in sys.modules : from pyslave import __slave_disp__ as disp else: disp = print class createh5(h5py.File): """Create a new H5 file to save data. Use the append_dataset to add data to the file."""...
StarcoderdataPython
3326833
# Generated by Django 2.0.5 on 2019-03-26 06:41 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('CRYE', '0018_auto_20190326_0006'), ] operations = [ migrations.RemoveField( model_name='tablaamortizacion', name='ba...
StarcoderdataPython
3348206
import asyncio import dataclasses from enum import IntEnum from typing import Any, List from littlelambocoin.protocols.wallet_protocol import CoinStateUpdate, NewPeakWallet from littlelambocoin.server.ws_connection import WSLittlelambocoinConnection from littlelambocoin.types.blockchain_format.sized_bytes import bytes...
StarcoderdataPython
3378782
<reponame>osoco/better-ways-of-thinking-about-software<filename>Part-03-Understanding-Software-Crafting-Your-Own-Tools/models/edx-platform/cms/djangoapps/pipeline_js/utils.py """ Utilities for returning XModule JS (used by requirejs) """ from django.conf import settings from django.contrib.staticfiles.storage import ...
StarcoderdataPython
4828154
# # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not...
StarcoderdataPython
3269052
import pygame import stale from sprajtszit import SpriteSheet class Bullet(pygame.sprite.Sprite): fire_frames_r = [] fire_frames_l = [] def __init__(self,kierunek): super().__init__() self.direction = kierunek sprite_sheet = SpriteSheet("Fiyah.png") pocisk ...
StarcoderdataPython
3261281
def regular_function(s): return s.capitalize() def user_of_function(words, f): for w in words: print(f(w)) data = ['a', 'b', 'c'] # equivalent behavior: user_of_function(data, regular_function) user_of_function(data, lambda w: w.capitalize()) user_of_function(data, lambda w: regular_function(w))
StarcoderdataPython
3226489
<reponame>ambitiouscat/KBE_Ball<filename>Kbe_Svr/server_assets/scripts/common/GameConfigs.py # -*- coding: utf-8 -*- """ """ # ------------------------------------------------------------------------------ # entity state # ------------------------------------------------------------------------------ ENTITY_STATE_UNK...
StarcoderdataPython
93306
import tensorflow as tf import numpy as np ds = tf.contrib.distributions def decode(z, observable_space_dims): with tf.variable_scope('Decoder', [z]): logits = tf.layers.dense(z, 200, activation=tf.nn.tanh) logits = tf.layers.dense(logits, np.prod(observable_space_dims)) p_x_given_z = ds.Ber...
StarcoderdataPython
58387
<reponame>alliance-genome/agr_literature_service<filename>backend/app/literature/models/note_model.py<gh_stars>0 from datetime import datetime from typing import Dict import pytz from sqlalchemy import Column from sqlalchemy import ForeignKey from sqlalchemy import Integer from sqlalchemy import String from sqlalchem...
StarcoderdataPython
181624
#Hacked Path to find package. Would no be needed when package is installed via pip import sys import os sys.path.append(os.path.abspath('../pypedream')) from pypedream import MaterialStream, Flowsheet, ThermodynamicSystem import pypedream.database.purecomponents as pcdb sys= ThermodynamicSystem("Test", "NRTL") sys.add...
StarcoderdataPython
53597
#!/usr/bin/env python # Copyright (c) 2020 - for information on the respective copyright owner # see the NOTICE file and/or the repository # <https://github.com/boschresearch/amira-blender-rendering>. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance w...
StarcoderdataPython
1620175
<gh_stars>10-100 import logging import os import sys from enum import Enum, IntEnum, unique from typing import Tuple @unique class LogFormat(IntEnum): stream = 0 color = 1 json = 2 syslog = 3 plain = 4 journald = 5 rich = 6 rich_tb = 7 @classmethod def choices(cls) -> Tuple[st...
StarcoderdataPython
138532
<reponame>TomasFisica/Redes_Prac_4<filename>tensor.py # -*- coding: utf-8 -*- """ Created on Thu May 21 10:35:58 2020 @author: tomas """ import numpy as np import keras from keras.layers import Dense from keras.models import Sequential import numpy as np import copy from matplotlib import pyplot as plt # ============...
StarcoderdataPython
3395744
"""Collection of utilities to detect properties of the underlying architecture.""" from subprocess import PIPE, Popen import numpy as np import cpuinfo import psutil from devito.logger import warning from devito.tools.memoization import memoized_func __all__ = ['platform_registry', 'INTEL64', 'SNB', 'IVB...
StarcoderdataPython
35588
<reponame>wujingda/Human-in-the-loop-Deep-Reinforcement-Learning-Hug-DRL- ''' This algorithm is a IA-RL implementation on off-policy TD3 algorithm, to check the original IA-RL algorithm you can refer to https://arxiv.org/abs/1811.06187. Since it is a baseline algorithm, the descriptions are mostly omitted, please visit...
StarcoderdataPython
1604870
import matplotlib import scipy __version__="01.00.00" __author__ ="<NAME>" ZRS =(0 , 78) UAS1 =(281,303) UAS2 =(389,411) TATA =(551,557) TSS = 607 ORF =(652,2055) LEXA =(2140,2246) LENGTH=2246 NUCLEOSOME_SIZE =147 NUCLEOSOME_CUTOFF=90 class Configuration: """Configuration is simply a representation of a...
StarcoderdataPython
148706
<filename>p3/p3.py import urllib import xml.dom.minidom from xml.dom.minidom import parse class site: def __init__(self): self.name ="" self.country ="" self.short ="" self.lvl ="Ninguna" self.address ="" self.lat ="" self.lon ="" def setName(self,name)...
StarcoderdataPython
4361
<gh_stars>0 #!/usr/bin/env python3 # -*- coding: utf-8 -*- # # || ____ _ __ # +------+ / __ )(_) /_______________ _____ ___ # | 0xBC | / __ / / __/ ___/ ___/ __ `/_ / / _ \ # +------+ / /_/ / / /_/ /__/ / / /_/ / / /_/ __/ # || || /_____/_/\__/\___/_/ \__,_/ /___/\___/ # # Cop...
StarcoderdataPython
1682625
<gh_stars>0 from django.contrib import admin from core.models import InternetRating, Place, Rating admin.site.register(InternetRating) admin.site.register(Place) admin.site.register(Rating)
StarcoderdataPython
4822119
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding model 'Tidbit' db.create_table('auxiliary_tidbit', ( ('id', self.gf('django.db.models.f...
StarcoderdataPython
3311717
<filename>instructions.py from binaryninja import InstructionTextToken, InstructionTextTokenType import struct # Type 1 instructions are those that take two operands. TYPE1_INSTRUCTIONS = [ 'mov', 'add', 'addc', 'subc', 'sub', 'cmp', 'dadd', 'bit', 'bic', 'bis', 'xor', 'and' ] # Type 2 instructions are those ...
StarcoderdataPython
1786050
import math import emoji #Biblioteca baixada Do Python.org pypi print(emoji.emojize('Olá, mundo :earth_africa:', use_aliases = True)) num = int (input(' digite um numero: ')) raiz = math.sqrt(num) #math.cell = arredonda para baixo #math.floor = ar...
StarcoderdataPython
1601351
<gh_stars>0 # -*- coding: utf-8 -*- from webbrowser import open_new from tkinter import filedialog import tkinter as tk import os import sys import base64 import shutil import subprocess, shlex def display_error_window(error_name, msg): error_window = tk.Tk() error_window.title(error_name) p...
StarcoderdataPython
140800
def config_fgsm(targeted, adv_ys): if targeted: yname = 'y_target' else: yname = 'y' fgsm_params = {yname: adv_ys, 'eps': 0.3, 'clip_min': 0., 'clip_max': 1.} return fgsm_params def config_bim(targeted, adv_ys): if ta...
StarcoderdataPython
1606808
# Third-Party from dry_rest_permissions.generics import DRYPermissionsField from rest_framework_json_api import serializers from django.contrib.auth import get_user_model from django.core.exceptions import ValidationError from django.core.validators import URLValidator from django.core.validators import validate_email...
StarcoderdataPython
3201893
#!/usr/bin/env python # coding: utf-8 r"""pressure.py tests""" from corelib.units.pressure import millibar def test_pressures(): r"""Test expected values""" expected_value = 1e3 atol = 1e-10 assert expected_value - atol <= millibar(bar=1.) <= expected_value + atol
StarcoderdataPython
1621164
<filename>robot_reply/migrations/0001_initial.py # Generated by Django 2.2.6 on 2020-01-31 07:55 from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='WechatRobotLog', ...
StarcoderdataPython
1675148
import functools import math from math import sqrt import torch import torch.nn as nn import torch.nn.functional as F from einops import rearrange from torch import einsum from models.diffusion.unet_diffusion import AttentionBlock from models.gpt_voice.lucidrains_dvae import DiscreteVAE from models.stylegan.stylegan2...
StarcoderdataPython
3290946
<gh_stars>1-10 # testing.py # # Authors: # - <NAME> <<EMAIL>> """Support for no database testing.""" from django.test.runner import DiscoverRunner class DatabaseLessTestRunner(DiscoverRunner): """A test suite runner that does not set up and tear down a database.""" def setup_databases(self, *ar...
StarcoderdataPython
179622
# run_args: -n # statcheck: stats['slowpath_getattr'] <= 10 # statcheck: stats['slowpath_setattr'] <= 10 class C(object): pass def f(obj, name): obj.__name__ = name print obj.__name__ # pass in a class each time for i in xrange(1000): f(C, str(i)) # TODO test guards failing # I think we need to get ...
StarcoderdataPython
4802972
# use hashmap will take O(MxN) time. where MM is a length of the word to find, and NN is the number of words. # Trie could use less space compared to hashmap when storing many keys with the same prefix. # In this case, using trie has only O(MxN) time complexity, where M is the key length, and N is the number of keys....
StarcoderdataPython
1621398
<filename>excel_OpenPyXL.py from openpyxl import load_workbook from random import choice """Importar a base do Excel e Randomizar a escolha das celulas""" wb = load_workbook('database_test.xlsx') plan = wb['dados'] lista = plan['A'] plant = wb['tempo'] listat = plant['A'] print(len(lista)) print(len(listat)) for click...
StarcoderdataPython
4806045
import csv import numpy import time import datetime from decimal import Decimal from operator import itemgetter import math import os ###user input line 107 def interpolate_gps(GPS_selected,target_time_slot,mid_points_time_stamp): coorinates_target_time_slot = [] print('target time',type(target_time_slot[0])) for...
StarcoderdataPython
3394492
<filename>flatland/database/population/decorator/symbol_stack_placement_instances.py """ symbol_stack_placement_instances.py """ population = [ # Double solid arrow {'Position': 1, 'Compound symbol': 'double solid arrow', 'Simple symbol': 'solid arrow', 'Arrange': 'adjacent', 'Offset x': 0, 'Offset y': 0},...
StarcoderdataPython
3214358
<reponame>JayceSYH/FactorKeeper class ServiceDebugger(object): __enable_debug = True @classmethod def set_debug(cls, enable=True): cls.__enable_debug = enable @classmethod def debug(cls, show_form=True, show_param=True, show_response=True, count_time=True, content_limit=100, disable=False)...
StarcoderdataPython
3200171
import unittest import os import sys PYTHON_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)) # add to python system path sys.path.append(PYTHON_PATH) class TestApiEndpoints(unittest.TestCase): def setUp(self): self.testable_endpoints =...
StarcoderdataPython
113812
import os from pytest import yield_fixture from .helpers import setup from ..api import VersionedHDF5File @yield_fixture def h5file(tmp_path, request): file_name = os.path.join(tmp_path, 'file.hdf5') name = None version_name = None m = request.node.get_closest_marker('setup_args') if m is not None...
StarcoderdataPython
1775989
<reponame>dclavijo45/backend-whatsup<filename>routes/login.py from controllers.login import LoginController login_v1 = { "login": "/login/v1/", "login_controller": LoginController.as_view("login_v1"), # ---------------------------------------------------------------- }
StarcoderdataPython
1606084
""" this is just a script that imports pac2 which ultimately imports pac1 """ from pac2.hola import hello_world2 def use_imports(): hello_world2() print('hello world from {}'.format(__file__)) if __name__ == '__main__': use_imports()
StarcoderdataPython
162107
from typing import Any, Dict, List, Text from rasa_sdk import Action, Tracker from rasa_sdk.events import SlotSet from rasa_sdk.executor import CollectingDispatcher from covidflow.constants import CONTINUE_CI_SLOT from covidflow.utils.persistence import cancel_reminder from .lib.log_util import bind_logger ACTION_N...
StarcoderdataPython
62853
<reponame>johnpaulguzman/Algorithm-Analyzer<filename>experiments/Catalan.py def f(n): if n <=0: return 1 res = 0 for i in range(n): res += f(i) * f(n-i-1) return res
StarcoderdataPython
3263034
from .fuzzy_match_spell_check import FuzzyMatchSpellCheck from .google_spell_check import GoogleSpellCheck from .simple_spell_check import SimpleSpellCheck
StarcoderdataPython
75956
<filename>setup.py # # Copyright (c) 2021 Czech Technical University in Prague. # # This file is part of Roadmaptools # (see https://github.com/aicenter/roadmap-processing). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as publish...
StarcoderdataPython
3275646
<reponame>jparkhill/notebook-molecular-visualization<filename>nbmolviz/widgets/symmetry.py from __future__ import print_function, absolute_import, division from future.builtins import * from future import standard_library standard_library.install_aliases() # Copyright 2017 Autodesk Inc. # # Licensed under the Apache Li...
StarcoderdataPython
48010
<gh_stars>0 #!/usr/bin/env python __author__ = "<NAME>" import numpy import pandas import tensorflow as tf from tensorflow import keras from sklearn.model_selection import train_test_split def _n(x): return (x - numpy.mean(x))/numpy.std(x) d = pandas.read_table("../results/smultixcan_wrong.txt") d_ = d.loc[d.n>1...
StarcoderdataPython
1748081
<filename>homeassistant/scripts/influxdb_migrator.py """Script to convert an old-structure influxdb to a new one.""" import argparse import sys from typing import List # Based on code at # http://stackoverflow.com/questions/3173320/text-progress-bar-in-the-console def print_progress(iteration: int, total: int, pref...
StarcoderdataPython
1660393
<reponame>sotheara-leang/xFlask<gh_stars>1-10 from sqlalchemy import * from sqlalchemy.orm import * from flask_sqlalchemy import SQLAlchemy from .decorator import * from .util import * db = SQLAlchemy(session_options={'autocommit': True}) def transactional(subtransactions=True, nested=False): def function(f): ...
StarcoderdataPython
3299459
<reponame>vishalbelsare/cgpm # -*- coding: utf-8 -*- # Copyright (c) 2015-2016 MIT Probabilistic Computing Project # 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/...
StarcoderdataPython
1674233
import json import logging from models.slave import Slave import falcon from mongoengine.errors import NotUniqueError from utils.MongoStorage import MongoStorage class SlaveResource(object): def __init__(self): self.mongo = MongoStorage() @staticmethod def on_post(req, resp): raw_json = r...
StarcoderdataPython
126492
import multiprocessing bind = "0.0.0.0:8000" workers = multiprocessing.cpu_count() * 2 + 1 threads = workers*3 # accesslog = '/tmp/accesslog.txt' # access_log_format = 'Neon (Outbreak News Today) %(h)s %(u)s %(t)s %(m)s Resopnse: %(s)s "%(q)s"'
StarcoderdataPython
64863
from typing import Any, Callable, Dict, List, Optional, Type, TypeVar, Union import attr from ..models.billing_invoice import BillingInvoice from ..types import UNSET, Unset from ..util.serialization import is_not_none T = TypeVar("T", bound="ListAccountBillingInvoicesResponse") @attr.s(auto_attribs=True) class Li...
StarcoderdataPython
6854
import ast import re import sys if sys.version_info < (2, 7): import unittest2 as unittest else: import unittest import astunparse from tests.common import AstunparseCommonTestCase class DumpTestCase(AstunparseCommonTestCase, unittest.TestCase): def assertASTEqual(self, dump1, dump2): # undo the ...
StarcoderdataPython
1646820
import logging import numpy as np from ..Dataset import Dataset def crop(jets, pileup=False): #logging.warning("Cropping...") if pileup: logging.warning("pileup") pt_min, pt_max, m_min, m_max = 300, 365, 150, 220 else: pt_min, pt_max, m_min, m_max = 250, 300, 50, 110 good_jets...
StarcoderdataPython
1600218
<filename>Sleepless/modules/weather_test.py import unittest class TempTrack: """ TemperatureTracker """ def __init__(self): #nessary? self.temps = [0] * 140 self.num_temps = 0 self.min = 140 self.max = -1 self.total = 0 self.mean = None self.max_freq = 0 self.mode = None ...
StarcoderdataPython
1791586
""" Tests stringify functions used in xmodule html """ from lxml import etree from xmodule.stringify import stringify_children def test_stringify(): text = 'Hi <div x="foo">there <span>Bruce</span><b>!</b></div>' html = f'''<html a="b" foo="bar">{text}</html>''' xml = etree.fromstring(html) out = s...
StarcoderdataPython
86419
<reponame>shijiale0609/Python_Data_Analysis import scipy.misc import matplotlib.pyplot as plt # This script demonstrates fancy indexing by setting values # on the diagonals to 0. # Load the Lena array lena = scipy.misc.lena() xmax = lena.shape[0] ymax = lena.shape[1] # Fancy indexing # Set values on diagonal to 0 # ...
StarcoderdataPython
1603951
<reponame>Ark0617/mediator_IL<filename>visualize_result.py from baselines.common import plot_util as pu import matplotlib.pyplot as plt import numpy as np results = pu.load_results('~/logs/NewHopperCmp/') print(len(results)) pu.plot_results(results, average_group=True, split_fn=lambda _: '') #print(np.cumsum(results[0]...
StarcoderdataPython
1730237
# -*- coding: utf-8 -*- import socket import hashlib import base64 import logging GEVENT = None TCP_BUF_SIZE = 8192 WS_MAGIC_STRING = '258EAFA5-E914-47DA-95CA-C5AB0DC85B11' RESPONSE_STRING = 'HTTP/1.1 101 Switching Protocols\r\nUpgrade: websocket\r\n' \ 'Connection: Upgrade\r\nSec-WebSocket-Accept: ...
StarcoderdataPython
1768389
from test_include import * import numpy as np ''' # of queries: 5, number of bins in ISOMER: 7 # of queries: 10, number of bins in ISOMER: 30 # of queries: 15, number of bins in ISOMER: 80 # of queries: 20, number of bins in ISOMER: 203 # of queries: 25, number of bins in ISOMER: 603 # of queries: 30, number of bins i...
StarcoderdataPython
106824
import scraperwiki import lxml.html import urlparse import urllib import json from rdflib import Graph, URIRef from unidecode import unidecode from geopy.geocoders import Nominatim ## Dbpedia for b and d dates artists_url = [url.split('/')[-1] for url in json.load(open("wiki_dump.json")).keys()] def unquote_uni(artist...
StarcoderdataPython