id
stringlengths
1
8
text
stringlengths
6
1.05M
dataset_id
stringclasses
1 value
12861127
<reponame>dingchaofan/AlgorithmSolution # 47. 求1+2+3+...+n # 求1+2+3+...+n,要求不能使用乘除法、for、while、if、else、switch、case等关键字及条件判断语句(A?B:C)。 # -*- coding:utf-8 -*- class Solution: def Sum_Solution(self, n): # write code here res = n if(res): res += self.Sum_Solution(n-1) retur...
StarcoderdataPython
5195772
<reponame>Lenferd/ANSYS-OpenFOAM class Point: def __repr__(self): return "({},{},{})".format(self.x, self.y, self.z) def __init__(self, x: int, y: int, z: int): self.x = int(x) self.y = int(y) self.z = int(z) def get(self): return {self.x, self.y, self.z} def f...
StarcoderdataPython
6687213
<reponame>darius-kia/director4 # Generated by Django 2.2.9 on 2020-02-03 04:05 import django.core.validators from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('sites', '0015_auto_20200201_1554'), ] operations = [ migrations.AlterField( ...
StarcoderdataPython
5187751
from __future__ import print_function import argparse import apache_beam as beam from preprocess.pipeline import create_pipeline_opts, ProcessGithubFiles def parse_arguments(args): parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument('-i', '--input', metava...
StarcoderdataPython
3472096
#coding:utf-8 """ Program: Description: Author: <NAME> - <EMAIL> Date: 2014-04-13 18:44:39 Last modified: 2014-04-14 06:28:29 Python release: 2.7.3 """ ''' Created on 2014��4��5�� @author: cc ''' import traceback try: import logging from storage_manager import SINAWEIBOSEARCH_LOG_TABLE_NAME as sltn, \ ...
StarcoderdataPython
1971461
# -*- coding: utf-8 -*- # @Date : 2014-06-25 15:43:36 # @Author : <EMAIL> <EMAIL> from sqlalchemy.orm import scoped_session, sessionmaker from mod.gpa.gpa_handler import GPAHandler from mod.pe.pedetailHandler import pedetailHandler from mod.srtp.srtp_handler import SRTPHandler from mod.card.handler import CARDHandl...
StarcoderdataPython
11328845
<filename>lab2/yacc/first_follow.py def first_follow(rules): from collections import OrderedDict firsts = [] # Used as temp storage for firsts if needed rules_dict = OrderedDict() # Dictionary to store all the rules in the grammar firsts_dict = OrderedDict() # Dictionary to store all the firsts f...
StarcoderdataPython
6586964
from pathlib import Path import sys project_dir = Path("__file__").resolve().parents[1] from sklearn.preprocessing import MinMaxScaler from temporal_granularity.src.metrics.metrics import Metrics from temporal_granularity.src.models.manipulations.approximations import ApproximateData import logging import pandas as pd...
StarcoderdataPython
1602364
<filename>tensorflow/python/kernel_tests/ackermann_test.py # Copyright 2015 The TensorFlow 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://w...
StarcoderdataPython
4888620
import numpy as np # import keras # from keras.models import Sequential, Model # from keras.layers import Dense, Flatten, Reshape, Input # from keras.layers import LSTM # from keras.initializers import RandomNormal # from keras.callbacks import ModelCheckpoint, EarlyStopping import json import csv import os import torc...
StarcoderdataPython
11368028
import torch.nn as nn import math import torch.utils.model_zoo as model_zoo from core.config import cfg import torch from torch.autograd import Variable class Affinity_Propagate(nn.Module): def __init__(self, spn = False): super(Affinity_Propagate, self).__init__() self.spn = spn ...
StarcoderdataPython
97034
#TODO: #Recurrent neural network
StarcoderdataPython
6494379
r""" Python wrapper around the ``librlscope.so`` ``LD_PRELOAD`` library. We offload most profiling work to the C++ library. In particular: #. Every :py:meth:`rlscope.profiler.profilers.Profiler.operation` calls into :py:func:`push_operation` upon entering the ``with`` block and :py:func:`pop_operation` upon exit...
StarcoderdataPython
1926990
<reponame>sleepstagingrest/rest import glob import shutil import numpy as np import os from tqdm import tqdm np.random.seed(1) PERCENT = 0.02 def main(): data_root_path = '/project/mgh/SHHS/' data_root_subset_path = '/project/mgh/Rahul_shhs_subset/' shhs_edf_path = data_root_path + 'shhs...
StarcoderdataPython
12818900
# %% import numpy as np import matplotlib.pyplot as plt import math from fcutils.maths.geometry import calc_distance_between_points_2d, calc_angle_between_vectors_of_points_2d from fcutils.plotting.colors import colorMap from tqdm import tqdm # %% # ------------------------------- Define funcs ------------------------...
StarcoderdataPython
322997
import numpy as np def median_filter(image, kernel_order = 3): ''' Applies median filter to image Returns: (np.array(dtype: uint8)) filtered image array Parameters: image (np.array(dtype: uint8)) - input grayscale image array kernel_order (uint - must be odd) (Default: 3) - the ...
StarcoderdataPython
6513664
import pytest # Note: these functions are extract from merkle-proofs.md (deprecated), # the tests are temporary to show correctness while the document is still there. def get_power_of_two_ceil(x: int) -> int: if x <= 1: return 1 elif x == 2: return 2 else: return 2 * get_power_of_...
StarcoderdataPython
9739190
import os import pytest import copy from microsim.microsim_model import Microsim from microsim.column_names import ColumnNames from microsim.population_initialisation import PopulationInitialisation import multiprocessing # ******************************************************** # These tests run through a whole dumm...
StarcoderdataPython
1940183
<filename>allogger/writers/filewriter.py import os from time import time as timestamp from multiprocessing import current_process from .abstract_writer import AbstractWriter from .helpers import gen_filename, time, add_value_wrapper from ..helpers import concurrent class FileWriter(AbstractWriter): def __init__(s...
StarcoderdataPython
5144620
<gh_stars>1-10 # -*- coding: utf-8 -*- """ Created on Mon Jul 5 13:43:57 2021 @author: OuYang """ # In[1] # 1 导入库 import numpy as np import pandas as pd import networkx as nx import matplotlib.pyplot as plt import seaborn as sns import os import Models import Utils import Test import Embeddings sns....
StarcoderdataPython
1670723
<gh_stars>1-10 from __future__ import absolute_import from setuptools import find_packages, setup from os.path import dirname, join, realpath HERE = dirname(realpath(__file__)) try: FileNotFoundError except NameError: FileNotFoundError = IOError try: with open(join(HERE, 'traw', 'VERSION'), 'r') as r: ...
StarcoderdataPython
11359134
<reponame>SJTUzjy/IE<filename>CNN_GloVe/dataclean.py<gh_stars>1-10 import csv import jieba FILENAME = 'dataset\long_comments_delete_english.csv' STOPWORD = 'dataset\hit_stopwords.txt' if __name__ == '__main__': # Reading stopwords with open(STOPWORD, 'r', encoding='utf-8') as f: stopwords = f.readline...
StarcoderdataPython
1699163
from django import forms from ecomApp.models import Checkout,MyRating class RatingForm(forms.ModelForm): class Meta: model = MyRating fields=('rating',) class OrderForm(forms.ModelForm): class Meta: model = Checkout fields=('fullname','email','NameOnCard','Address','creditcar...
StarcoderdataPython
1616716
from math import log, exp, sqrt, tanh, sin, cos, tan, atan2, ceil, pi import numpy as np from OpenGL.GL import * from PyEngine3D.Common import logger from PyEngine3D.App import CoreManager from PyEngine3D.OpenGLContext import CreateTexture, Texture2D, Texture2DArray, Texture3D, FrameBuffer from PyEngine3D.Render impo...
StarcoderdataPython
216236
from collections import Iterable from Ruikowa.ObjectRegex.Tokenizer import Tokenizer from Ruikowa.ObjectRegex.Tokenizer import unique_literal_cache_pool from typing import List from ..standard.curry import curry @curry def map_token(mapping: dict, tk: Tokenizer): name, string = mapping[tk.name, tk.string] re...
StarcoderdataPython
54559
<filename>pwdcheck/pwdcheck.py # -*- coding: utf-8 -*- """ pwdcheck.pwdcheck ~~~~~~~~~~~~~~~~~ """ from __future__ import absolute_import from pwdcheck.helpers import Dotdict from .compat import builtin_str from .cxty import Complexity from .exceptions import PolicyError, PolicyParsingError from .extras import Ext...
StarcoderdataPython
1603410
<filename>lol/datatypes/string.py import string # string data types # strings are groups # of characters class String(): def __init__(self, string_object): # the main string self.__string = str(string_object) # get the length of the # string def length(self): r...
StarcoderdataPython
35664
# -*- coding: utf-8 -*- """ Created on Wed Nov 22 21:44:55 2017 @author: Mike """ import numpy as np import cv2 import glob import pickle import matplotlib.pyplot as plt from matplotlib.pyplot import * import os from scipy import stats from moviepy.editor import VideoFileClip from IPython.display im...
StarcoderdataPython
246366
<reponame>AnmolTomer/lynda_programming_foundations # Python returning values def withdraw_money(current_bal, amount): if(current_bal >= amount): current_bal -= amount return current_bal balance = withdraw_money(100, 20) if (balance >= 50): print(f"The balance is {balance}.") else: prin...
StarcoderdataPython
3341306
import pathlib from jinja2 import Environment, FileSystemLoader from sanic import Sanic from sanic.request import Request from sanic.response import json, html import jschon from jschon import create_catalog, JSON, JSONSchema, URI rootdir = pathlib.Path(__file__).parent app = Sanic('jschon.dev') app.static('/static...
StarcoderdataPython
386736
<gh_stars>10-100 from unittest import TestCase, mock import neo4j class ConnectorBasicsTestCase(TestCase): def test_basic_parameters_existence(self): hostname = 'http://domain:7474' connector = neo4j.Connector(hostname) self.assertTrue(connector.endpoint.startswith(hostname)) self....
StarcoderdataPython
283313
# -*- coding: utf-8 -*- # # 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 #...
StarcoderdataPython
1878197
from itertools import groupby from datetime import date, timedelta from operator import itemgetter from sqlalchemy import func from .utm_db import session_utm from .models import PaymentTransaction, BalanceHistory, User from .helpers import get_timestamp_from_date def group_pays_by_date(pays_raw): if not pays_r...
StarcoderdataPython
3287912
<reponame>dmxj/icv from . import http from . import protos
StarcoderdataPython
6462117
<reponame>elias-winberg/PhantomJS from blinker import signal from os import path from urllib.request import Request, urlopen import json import subprocess import threading DRIVER = path.join(path.dirname(path.realpath(__file__)), 'driver.js') class Driver(object): def __init__(self, engine, port): """ ...
StarcoderdataPython
5093809
import unittest from lib import mnemonic from lib import old_mnemonic class Test_NewMnemonic(unittest.TestCase): def test_to_seed(self): seed = mnemonic.Mnemonic.mnemonic_to_seed(mnemonic='foobar', passphrase='<PASSWORD>') self.assertEquals(seed.encode('hex'), '741b72fd15...
StarcoderdataPython
11334621
# -*- coding: utf-8 -*- """ Data types provided by plugin Register data types via the "aiida.data" entry point in setup.json. """ # You can directly use or subclass aiida.orm.data.Data # or any other data type listed under 'verdi data' from __future__ import absolute_import from aiida.orm import Dict from voluptuous ...
StarcoderdataPython
1833093
import random while True: x := random.random() print(x, "\t", "Hi ho, hi ho" if x > 0.5 else "It's off to work we go")
StarcoderdataPython
9715168
from django import forms from .models import Business, Postii, Profile from django.contrib.auth.models import User class UserForm(forms.ModelForm): class Meta: model = User fields = ('username', 'email',) class ProfileForm(forms.ModelForm): class Meta: model = Profile fields = '__all__' ...
StarcoderdataPython
21936
DILAMI_WEEKDAY_NAMES = { 0: "شمبه", 1: "یکشمبه", 2: "دۊشمبه", 3: "سۊشمبه", 4: "چارشمبه", 5: "پئنشمبه", 6: "جۊمه", } DILAMI_MONTH_NAMES = { 0: "پنجيک", 1: "نؤرۊز ما", 2: "کۊرچ ٚ ما", 3: "أرئه ما", 4: "تیر ما", 5: "مۊردال ما", 6: "شریرما", 7: "أمیر ما", 8: ...
StarcoderdataPython
3543323
#!/usr/bin/python ## For use with pool_control_master.py __author__ = '<NAME>' VERSION = "V3.4 (2018-03-16)" # <EMAIL> # This is for use with Atlas Scientific ORP board only. import serial import sys import time from serial import SerialException usbport = '/dev/ORP' try: ser = serial.Serial(usbport, 9600, time...
StarcoderdataPython
4964202
from pymel.core.windows import * class MelToPythonWindow(Window): def __new__(cls, name=None): self = window(title=name or "Mel To Python") return Window.__new__(cls, self) def convert(w): from .. import mel2pyStr if cmds.cmdScrollFieldExecuter(w.mel,q=1,hasSelection=1): ...
StarcoderdataPython
393602
# -*- coding: utf-8 -*- from copy import deepcopy import logging import re from prtg.models import INHERITED_PROPS, LIST_TYPE_PROPS def _subtract_set_from_list(a_list, a_set_of_removals): return list(filter(lambda element: element not in a_set_of_removals, a_list)) def _get_entity_value(entity, prop, parent_v...
StarcoderdataPython
280236
""" Classes from the 'CoreServices' framework. """ try: from rubicon.objc import ObjCClass except ValueError: def ObjCClass(name): return None def _Class(name): try: return ObjCClass(name) except NameError: return None _LSCoreTypesRecordProxy = _Class("_LSCoreTypesRecordPro...
StarcoderdataPython
1794355
<filename>server.py import time from flask import Flask, request app = Flask(__name__) messages = [ {'username': 'jack', 'text': 'Hello', 'time': time.time()}, {'username': 'mary', 'text': 'Hi, jack', 'time': time.time()}, ] users = { # username: password 'jack': '<PASSWORD>', 'mary': '<PASSWORD>...
StarcoderdataPython
1672503
<reponame>DoctorU/core """Platform to retrieve Jewish calendar information for Home Assistant.""" from __future__ import annotations from datetime import datetime import logging import hdate from homeassistant.components.sensor import SensorEntity, SensorEntityDescription from homeassistant.const import DEVICE_CLASS...
StarcoderdataPython
8176322
''' Indexes and values (1) 100xp Using a for loop to iterate over a list only gives you access to every list element in each run, one after the other. If you also want to access the index information, so where the list element you're iterating over is located, you can use enumerate(). As an example, have a look at how...
StarcoderdataPython
8047103
""" Implement methods plotting and drawing figures. @author: <NAME> (y(dot)meng201011(at)gmail(dot)com)) """ from enum import Enum import numpy as np from utils.csv_headers import IdealModelEvalHeaders as headers import os import matplotlib.pyplot as plt from matplotlib.ticker import FormatStrFormatter from utils.confi...
StarcoderdataPython
3369120
#!/usr/bin/env python # coding: utf-8 ''' redis store -------------- ''' import redis # Import third party libs from flask import current_app as app def login(**kwargs): return redis.Redis(**kwargs) def set_service_status(client, data): """Store service status Args: client (Client): client conne...
StarcoderdataPython
3519271
<reponame>hutoTUM/macke-opt-llvm import unittest import os import subprocess class TestPointerlogic(unittest.TestCase): def run_pass_test(self, bitcodefile, new_entrypoint, assertions): self.assertIn("LLVMBIN", os.environ, "Path to llvm-bin not set") self.assertIn("KLEEBIN", os.environ, "Path to ...
StarcoderdataPython
141933
import tensorflow as tf # 1.12 import numpy as np #Factor into config: N_PIXEL = 784 USE_TPU = False PATH_DATA = '/../../../data/' if USE_TPU: _device_update = 'tpu' else: _device_update = 'cpu' IMAGE_SIZE = 28 * 28 NUM_LABELS = 10 OUTDIR = 'trained/mnist_estimator/' lr_inital = 0.001 BATCH_SIZE = 128 EPOCH...
StarcoderdataPython
4973934
<filename>ros/son.py<gh_stars>0 #!/usr/bin/env python import math from math import sin, cos, pi import rospy import tf from nav_msgs.msg import Odometry from geometry_msgs.msg import Point, Pose, Quaternion, Twist, Vector3 rospy.init_node('odometry_publisher') odom_pub = rospy.Publisher("odom", Odometry, queue_size...
StarcoderdataPython
243000
# Copyright 2021 DeepMind Technologies 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 law or agree...
StarcoderdataPython
6544087
<filename>code/tmp_rtrip/test/test_tools/test_i18n.py """Tests to cover the Tools/i18n package""" import os import unittest from test.support.script_helper import assert_python_ok from test.test_tools import skip_if_missing, toolsdir from test.support import temp_cwd skip_if_missing() class Test_pygettext(unittest.Te...
StarcoderdataPython
8187925
# -*- coding: utf-8 -*- # Define here the models for your scraped items from scrapy import Item, Field class WeiboUserItem(Item): uid = Field() nick_name = Field() profile_image = Field() class WeiboStatusItem(Item): publishTime = Field() text = Field() pictures = Field()
StarcoderdataPython
369892
<gh_stars>10-100 """Contants for Hitachi Smart App integration""" DOMAIN = "Hitachi_smart_app" #PLATFORMS = ["humidifier", "sensor", "number", "climate","fan"] PLATFORMS = ["humidifier","sensor","number","fan","climate","switch"] MANUFACTURER = "Hitachi" DEFAULT_NAME = "Hitachi Smart Application" DEVICE_TYPE_AC = 0x0...
StarcoderdataPython
3230268
class Person: def __init__(self,fname,lname): self.fname=fname self.lname=lname self.name=self.fname+self.lname class Student(Person): def __init__(self,fname,lname,RollNO):#We can add properties in child class like this. #Using __init__ inside child will disable the inheri...
StarcoderdataPython
3274236
from codecs import open as codecs_open from setuptools import setup, find_packages # Get the long description from the relevant file with codecs_open('README.md', encoding='utf-8') as f: long_description = f.read() setup( name='n5a', version='0.0.1', description=u"C++, Python JSON serialization code...
StarcoderdataPython
8124419
from setuptools import find_packages, setup def readme(): with open('README.md', encoding='utf-8') as f: content = f.read() return content with open('requirements.txt') as f: required = f.read().splitlines() setup( name='odometry', description='building a training pipeli...
StarcoderdataPython
11209674
<reponame>jdehaan/borg from .datastruct import StableDict from ..constants import * # NOQA # wrapping msgpack --------------------------------------------------------------------------------------------------- # # due to the planned breaking api changes in upstream msgpack, we wrap it the way we need it - # to avoid ...
StarcoderdataPython
1934545
<reponame>WORLDKING2021/bitcoin-abc #!/usr/bin/env python3 # # Copyright (c) 2017-2019 The Bitcoin ABC developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. import json import mock import requests import unittest from urllib....
StarcoderdataPython
5103515
"""This module creates GAN images for a specified category. """ # Copyright 2018 The TensorFlow Hub 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:...
StarcoderdataPython
1954486
<reponame>leobouts/Market_basket_analysis import threading import time import sys from assoc_rules import * from result import * def main(): print(format("*", "*^23s")) print("* Main script started *") print(format("*", "*^23s")) print("") itemsets = {} while True: minimum_confiden...
StarcoderdataPython
9682322
# -*- coding: utf-8 -*- # Copyright 2016 Open Permissions Platform Coalition # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. You may # obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
StarcoderdataPython
11327287
<filename>pwndbg/commands/elf.py #!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals from elftools.elf.elffile import ELFFile import pwndbg.commands @pwndbg.commands.Command...
StarcoderdataPython
5148329
# (c) Copyright 2015 Hewlett Packard Enterprise Development LP # # 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
6473923
<filename>project/server/UsersIndex.py '''from flask import flask from project.server import db from project.server.models import User @app.route('/users/index', methods = ['GET']) def '''
StarcoderdataPython
1980167
import sys import contextlib from typing import Optional @contextlib.contextmanager def open_all(filename: Optional[str] = None, mode: str = 'r', *args, **kwargs): """Open files and i/o streams transparently.""" if filename is None or filename == '-': stream = sys.stdin if 'r' in mode else sys.stdout ...
StarcoderdataPython
3289492
<reponame>abhiagwl4262/big_transfer # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
StarcoderdataPython
11202182
<reponame>symcollab/CryptoSolve<filename>examples/unification/xor_rooted_unif_ex.py from symcollab.algebra import Constant, Variable, Function from symcollab.Unification.xor_rooted_unif import * c = Constant("c") x1 = Variable("x1") x2 = Variable("x2") x3 = Variable("x3") f = Function("f", 1) #Example 1: output fee...
StarcoderdataPython
11266555
<reponame>Outman888/test<gh_stars>0 import numpy as np import matplotlib.pyplot as plt import matplotlib.animation as animation from PIL import Image import math import time import os def pull_screenshot(): os.system('adb shell screencap -p /sdcard/autojump.png') os.system('adb pull /sdcard/autojump.png .')...
StarcoderdataPython
11205398
# 下载网页中的图片 import requests from bs4 import BeautifulSoup import re import os from hashlib import md5 from requests.exceptions import RequestException from multiprocessing import Pool from urllib.parse import urlencode headers = { 'user-agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like...
StarcoderdataPython
8069902
<reponame>bjuvensjo/scripts<gh_stars>1-10 #!/usr/bin/env python3 import argparse from os import walk, rename, makedirs, listdir, rmdir from os.path import join, sep from sys import argv from typing import Iterable, Callable from vang.pio.rsr import _replace_in_file, _in def file_content_replace_function(line: str, o...
StarcoderdataPython
354471
from django.apps import AppConfig class DeferredcountersConfig(AppConfig): name = 'deferredCounters'
StarcoderdataPython
11336630
<gh_stars>0 def move_zeros(array): counter = 0 res = [] for x in array: if type(x) is bool or x != 0: res.append(x) else: counter += 1 for x in range(counter): res.append(0) return res
StarcoderdataPython
3561330
# from search_engine.doc_tfidf_search import doc_vectorizer from numpy.lib.function_base import vectorize from sklearn.feature_extraction.text import TfidfVectorizer import json import pandas as pd import re import numpy as np class HippoChamber: def __init__(self, user_name = "", articut_key = "", loki_key =...
StarcoderdataPython
9755518
from sqlalchemy.orm import load_only from flask import g from flask_babel import gettext as _ from flask_sqlalchemy import SQLAlchemy from appname.error import Error, HttpNotFound db = SQLAlchemy() def _filter_convertor_(type_, s): if type_ == bool: return s == 'true' and True or False if type_ == d...
StarcoderdataPython
8031146
from ne.ne_workflow import ne_workflow from de.de_workflow import de_workflow from mde.mde_workflow import mde_workflow from biotypes.biotype_folders import biotype_folders def workflows(global_variables): print "=====================================" print "===== workflows =====" print ...
StarcoderdataPython
6625743
class Solution: def XXX(self, nums: List[int]) -> bool: l,maxp,end=len(nums),0,0 for i in range(l-1): if maxp>=i: maxp=max(maxp,i+nums[i]) if i==end: end=maxp if maxp>=l-1: return True else: retur...
StarcoderdataPython
4824251
<filename>autogluon/utils/tabular/ml/utils.py import logging import multiprocessing import os from collections import defaultdict from datetime import datetime import numpy as np import pandas as pd from pandas import DataFrame, Series from sklearn.model_selection import KFold, StratifiedKFold, RepeatedKFold, Repeated...
StarcoderdataPython
6436356
<filename>zerver/webhooks/semaphore/view.py # Webhooks for external integrations. from typing import Any, Dict from django.http import HttpRequest, HttpResponse from zerver.decorator import api_key_only_webhook_view from zerver.lib.request import REQ, has_request_variables from zerver.lib.response import json_success...
StarcoderdataPython
296566
"""Define decorators used throughout Celest.""" def set_module(module): """Override the module of a class or function.""" def decorator(func): if module is not None: func.__module__ = module return func return decorator
StarcoderdataPython
1656031
#!/usr/bin/env python """ main.py - application starter """ #import pychecker.checker import sys, os, os.path from qt import QApplication, SIGNAL, SLOT, QPixmap, QWidget, Qt from kuragui.guiconfig import guiConf from kurawindow import KuraWindow if hasattr(sys, 'setappdefaultencoding'): sys.setappdefaultencodin...
StarcoderdataPython
9770001
import sys import numpy as np import torch import cv2 from PIL import Image from torchvision import transforms def save_torch_image(data: np.ndarray, filename: str): img = Image.fromarray(data) img.save(filename) def convert_image_to_torch_tensor(content_image, device): """ Convert object from num...
StarcoderdataPython
9654969
<gh_stars>1-10 # -*- coding: utf-8 -*- from typing import Optional, List from abc import ABCMeta, abstractmethod from datetime import datetime from recc.database.struct.info import Info class DbInfo(metaclass=ABCMeta): """ Database config(info) interface. """ @abstractmethod async def insert_inf...
StarcoderdataPython
6690195
<reponame>apefind/python #!/usr/bin/env python3 import sys import docopt from apefind.util import script from apefind.youtube import cookinginrussia log = script.get_logger() USAGE = """usage: {script_name} download [--flags=<flags>] [--output=<output>] <url>... options: --flags FLAGS comma separated o...
StarcoderdataPython
3261984
<gh_stars>1-10 from .svaec import SVAEC from .vae import VAE from .vaec import VAEC __all__ = ['VAEC', 'SVAEC', 'VAE']
StarcoderdataPython
8159644
<filename>src/pyprocessing/lights.py # ************************ # Lights # ************************ import ctypes from pyglet.gl import * from .globs import * from .constants import * from .colors import _getColor __all__ = ['directionalLight', 'pointLight', 'ambientLight', 'spotLight', 'lightFalloff', 'li...
StarcoderdataPython
8048754
<gh_stars>0 import FWCore.ParameterSet.Config as cms process = cms.Process('HiForest') #parse command line arguments from FWCore.ParameterSet.VarParsing import VarParsing options = VarParsing('analysis') options.parseArguments() ##################################################################################### # ...
StarcoderdataPython
9723836
<gh_stars>0 #!/usr/bin/env python # Software License Agreement (BSD License) # # Copyright (c) 2008, <NAME>, Inc. # All rights reserved. # # Start the emotion server first, and then start this file import rospy import cv2 import socket from sensor_msgs.msg import Image import cv_bridge import numpy display = False HO...
StarcoderdataPython
8134765
import unittest import time import httpretty import mock import re import tingbot.cache as cache import tingbot.graphics as graphics from requests.structures import CaseInsensitiveDict as idict from email.Utils import formatdate class TimeHelper(object): def __init__(self): self.tm = 1000.0 def __call...
StarcoderdataPython
4889386
class Solution: def groupThePeople(self, groupSizes: List[int]) -> List[List[int]]: d = collections.defaultdict(list) for i, v in enumerate(groupSizes): d[v].append(i) ans = [] for k, v in d.items(): for i in range(0, len(v), k): ans.append(v[i:i + k]) return ans
StarcoderdataPython
182559
class Node: def __init__(self,val): self.data = val self.left = None self.right = None from collections import deque class Solution: def getMaxWidth(self, root): outerQueue = deque([root]) innerQueue = deque([]) storedPos = {} maxWid...
StarcoderdataPython
1687488
""" Post-processing of epydoc generated documentation. """ import os import sys from glob import glob # adds MathJax capabilities to documentation injection = """ <script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [['$','$']], displayMath: [['$$','$$']], ...
StarcoderdataPython
3294692
import threading import time def login(name,pwd): if pwd == "<PASSWORD>": for i in range(5): print("-----%s:您好,系统第%d次挣钱-----" %(name,i+1)) time.sleep(1) else: print("%s:您好,密码不对,无法为您挣钱." %name) time.sleep(2) reg_user(name) def reg_user(name): print(...
StarcoderdataPython
9652882
<filename>setup.py #!/usr/bin/env python from distutils.core import setup from catkin_pkg.python_setup import generate_distutils_setup package_info = generate_distutils_setup() package_info['packages'] = ['robot_properties_bolt'] package_info['package_dir'] = {'': 'python'} package_info['install_requires'] = [] packa...
StarcoderdataPython
5104463
<filename>rolling_snapshot_proposal_editor/templatehandler.py class TemplateHandler: """ This class handles template files. localpath = '/path/to/template/folder/'. If None, this will be the package folder. verbal = True if a user wants messages. ##### Usage: 1: Initialization -- t = Templat...
StarcoderdataPython
1888143
import pyautogui as auto import subprocess as sub import time sub.Popen(['C:\\Users\\Public\\Putty.exe']) time.sleep(2) auto.write('192.168.0.51') time.sleep(0.5) auto.press('enter') time.sleep(0.7) auto.write('pi') auto.press('enter') time.sleep(0.5) auto.write('cd /home/pi/Desktop/RaspCode/RaspCode') a...
StarcoderdataPython
1633118
<gh_stars>1-10 # coding=utf-8 # Module wingdings_32 # generated from Wingdings 21.75pt name = "<NAME>" start_char = '!' end_char = chr(255) char_height = 32 space_width = 16 gap_width = 4 bitmaps = ( # @0 '!' (28 pixels wide) 0x00, 0x00, 0x00, 0x00, # 0x00, 0x00, ...
StarcoderdataPython
3501576
<filename>3_LMM.py<gh_stars>1-10 #!/usr/bin/env python # Author: <NAME> ''' Script for performing the maximum restricted likelihood to calculate the likelihood ratio test for the neighborhoods by employing the FaST-LMM-set implemetation obtainable at https://github.com/fastlmm/FaST-LMM/ This script can be used on bot...
StarcoderdataPython