code stringlengths 1 1.05M | repo_name stringlengths 6 83 | path stringlengths 3 242 | language stringclasses 222
values | license stringclasses 20
values | size int64 1 1.05M |
|---|---|---|---|---|---|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
</body>
<script>
//编写一个reverse()函数,该函数的参数是一个数组,
//在函数中会对数组中的元素顺序进行反转,并返回反转后的数组。
function reverse(arr) {
... | 2302_79957586/JavaScript | 3.html | HTML | unknown | 880 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
</body>
<script>
//编写一个isLeapYear()函数,该函数的参数是一个年份数字,
//利用isLeapYear()函数判断年份是否为闰年,
//如果年份是闰年,则返回值为true,否则返... | 2302_79957586/JavaScript | 4.html | HTML | unknown | 707 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
</body>
<script>
//编写一个fn()函数,该函数调用后会弹出一个输入框,
//要求用户输入一个年份数字,当用户输入年份数字后,
//程序会提示用户该年份的2月份天数(闰年29天,平年28天)
... | 2302_79957586/JavaScript | 5.html | HTML | unknown | 746 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
</body>
<script>
//编写一个函数用于判断用户输入的n个值的最大值,
//Ps:每个用户输入的个数可能不一致。在做比较前需要用户确定输入几个值。
function findMaxOfUserIn... | 2302_79957586/JavaScript | 6.html | HTML | unknown | 1,661 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<p class="box1">飞流直下<strong>三千尺</strong></p>
<p class="box2">疑是银河落九天</p>
<div class="box3">蒹葭苍苍 白露为霜 <br>
... | 2302_79957586/JavaScript | DOMDemo02.html | HTML | unknown | 964 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<style>
.box{
color: aqua;
font-weight: 80px;
}
</style>
<body>
<a href="#" class="lj" data-index="1... | 2302_79957586/JavaScript | DOMDemo03.html | HTML | unknown | 1,452 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<!-- DOM:文档对象模型 -->
<!-- 准备标签 -->
<div class="box">hello</div>
<div class="box1">world</div>
<div cl... | 2302_79957586/JavaScript | DOMdemo01.html | HTML | unknown | 1,498 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
</body>
<script>
//函数的定义
function say(){
//函数体
alert('hello js!');
}
//函数调用;可以调用多次... | 2302_79957586/JavaScript | MethodDemo.html | HTML | unknown | 1,957 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
</body>
<script>
//转字符型:数值、布尔、null、未定义
let num1 = 123,flag1 = true, flag2 = false,num2 = null,num3;
//Str... | 2302_79957586/JavaScript | ToString.html | HTML | unknown | 922 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
</body>
<script>
// day9.30
//数组名【索引】:索引从0开始
// let arr = [12,4,'dgf',false,null,34,,,,,124.54332];
... | 2302_79957586/JavaScript | arrDemo.html | HTML | unknown | 1,490 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
</body>
<script>
for(let i=0;i<10;i++){
if(i%2==0){
continue; //继续:结束当前循环,直接进行下一次循环
... | 2302_79957586/JavaScript | breDemo.html | HTML | unknown | 1,586 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
</body>
<script>
letn1, n2 = 123, n3 = null, n4 = true, n5 = 'hello', n6 = '', n7 = 0;
console.log(Boolean(n1)... | 2302_79957586/JavaScript | changedemo.html | HTML | unknown | 1,033 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
</body>
<script>
for(let i = 0;i<10;i++){
console.log(i);
}
//计算1~100的和并打印结果
let sum=0;
... | 2302_79957586/JavaScript | forDemo.html | HTML | unknown | 1,239 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
</body>
<script>
/*
三元运算符
条件表达式?条件为真的代码块:条件为假的代码块
找两个数中的最大值
*/
// let a,b,max;
// a = ... | 2302_79957586/JavaScript | getMax.html | HTML | unknown | 761 |
console.log('这是外部的js代码') | 2302_79957586/JavaScript | helllo.js | JavaScript | unknown | 38 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
</body>
<script>
alert('hello javascript!');
console.log('succed!')
</script>
</html> | 2302_79957586/JavaScript | hello.html | HTML | unknown | 297 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
</body>
<!-- <script src="hello3.js"></script> -->
<script>
let num1=100;
let str1,str2 = 'hello' ;
cons... | 2302_79957586/JavaScript | hello3.html | HTML | unknown | 369 |
alert('hello'); | 2302_79957586/JavaScript | hello3.js | JavaScript | unknown | 15 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
</body>
<script>
//流程:顺序、分支
//判断:if,if...else...,if...else... if...else...
//比较两个数大小,大小相等的情况打印num1和num2相等... | 2302_79957586/JavaScript | ifDemo.html | HTML | unknown | 1,695 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
</body>
<script>
let str='';
for(let i=1;i<=9;i++){
for(let j=1;j<=i;j++){
str+= j +'x'+... | 2302_79957586/JavaScript | jiujiu.html | HTML | unknown | 421 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
</body>
<script>
//函数声明、参数(形参、实参)(arguments)、返回值return
//函数表达式、匿名函数、立即执行函数
//回调函数、递归函数
//函数可以作为其他函数的... | 2302_79957586/JavaScript | met2Demo.html | HTML | unknown | 2,473 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<!-- 点击按钮弹出警告‘你别点我’ -->
<input type="button" value="click" onclick="(function(userName){alert(userName+'你别点我');})('阿黎'... | 2302_79957586/JavaScript | metDemo.html | HTML | unknown | 2,597 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
</body>
<script>
//console.log(Math.random()*45);
// function getRandomIntInclusive(min,max){
// co... | 2302_79957586/JavaScript | obj2Demo.html | HTML | unknown | 1,253 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
</body>
<script>
//对象:应该具体的事物,一种复杂的数据,包括属性和方法
//属性:对象的特征,用变量描述
//方法:对象的行为(功能),用函数(方法)描述
//创建对象:用字面量创... | 2302_79957586/JavaScript | objDemo.html | HTML | unknown | 3,045 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
</body>
<script>
//算术运算符:
//自增x++:x=x+1; 自减x--:x=x-1;
let x = 1,y = 10,result;
result = ++x+(++y)+y... | 2302_79957586/JavaScript | optDemo.html | HTML | unknown | 1,059 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
</body>
<script>
//冒泡排序
let arr=[1,3,2,6,5,4];
let temp;
//两层循环
for(let i=1;i<arr.length;i++){
... | 2302_79957586/JavaScript | sortDemo.html | HTML | unknown | 866 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
</body>
<script>
// let num;
// num = 10;
// console.log(num);
// let str;
// console.log(str);... | 2302_79957586/JavaScript | varDemo.html | HTML | unknown | 1,469 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<!-- 行内式 -->
<input type="button" value="点我一下" onclick="alert('这是点击后的效果')"/>
</body>
<!-- 如何在HTML中引入JavaScript代码
... | 2302_79957586/JavaScript | yrDemo.html | HTML | unknown | 757 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
</body>
<script>
//作用域链
//执行上下文:执行JS代码环境
let a = 10; //全局变量
function fn1(){
let b = 'hell... | 2302_79957586/JavaScript | 作用域链.html | HTML | unknown | 611 |
#include <bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--)
{
int a[114514];
memset(a,0,sizeof(a));
int n;
bool f=true;
cin>>n;
// vector<int> a(n+1);
for(int i=1;i<=n;i++)
{
int tmp;
cin>>tmp;
a[tmp]++;
}
int ans=0;
for(int i=1;i<=1e6;i+... | 2301_81652413/wqyhh | untitled1.cpp | C++ | unknown | 464 |
#include <bits/stdc++.h>
#include <bits/extc++.h>
#define int long long
#define Genshin return
#define Impact 0
using namespace __gnu_pbds;
using namespace std;
int n,m,fang[4][2]={{1,0},{0,1},{-1,0},{0,-1}},prx,pry,book[110][110],flag=0;
char a[110][110];
void bfs(int prx,int pry)
{
queue<pair<int,int> > q... | 2301_81652413/wqyhh | untitled2.cpp | C++ | unknown | 1,542 |
#include <bits/stdc++.h>
using namespace std;
int vis(int n){
int flag=1;
while(n){
int t=n%10;
if(flag%2==0){
if(t%2==1){
return 1;
}
}else{
if(t%2==0){
return 1;
}
}
n/=10;
flag++;
}
return 1;
}
int main(){
int n,z=0;
cin>>n;
for(int i=1;i<=n;i++){
i... | 2301_81652413/wqyhh | 好数.cpp | C++ | unknown | 379 |
VERSION = "5.0.0-dev"
PROJECT_NAME = "frappe-bench"
FRAPPE_VERSION = None
current_path = None
updated_path = None
LOG_BUFFER = []
def set_frappe_version(bench_path="."):
from .utils.app import get_current_frappe_version
global FRAPPE_VERSION
if not FRAPPE_VERSION:
FRAPPE_VERSION = get_current_frappe_version(ben... | 2302_79757062/bench | bench/__init__.py | Python | agpl-3.0 | 340 |
# imports - standard imports
import json
import logging
import os
import re
import shutil
import subprocess
import sys
import uuid
import tarfile
import typing
from collections import OrderedDict
from datetime import date
from functools import lru_cache
from pathlib import Path
from typing import Optional
from urllib.p... | 2302_79757062/bench | bench/app.py | Python | agpl-3.0 | 30,393 |
# imports - standard imports
import subprocess
from functools import lru_cache
import os
import shutil
import json
import sys
import logging
from typing import List, MutableSequence, TYPE_CHECKING, Union
# imports - module imports
import bench
from bench.exceptions import AppNotInstalledError, InvalidRemoteException, ... | 2302_79757062/bench | bench/bench.py | Python | agpl-3.0 | 13,559 |
# imports - standard imports
import atexit
from contextlib import contextmanager
from logging import Logger
import os
import pwd
import sys
# imports - third party imports
import click
# imports - module imports
import bench
from bench.bench import Bench
from bench.commands import bench_command
from bench.config.comm... | 2302_79757062/bench | bench/cli.py | Python | agpl-3.0 | 6,483 |
# imports - third party imports
import click
# imports - module imports
from bench.utils.cli import (
MultiCommandGroup,
print_bench_version,
use_experimental_feature,
setup_verbosity,
)
@click.group(cls=MultiCommandGroup)
@click.option(
"--version",
is_flag=True,
is_eager=True,
callback=print_bench_version,... | 2302_79757062/bench | bench/commands/__init__.py | Python | agpl-3.0 | 3,033 |
# imports - module imports
from bench.config.common_site_config import update_config, put_config
# imports - third party imports
import click
@click.group(help="Change bench configuration")
def config():
pass
@click.command(
"restart_supervisor_on_update",
help="Enable/Disable auto restart of supervisor process... | 2302_79757062/bench | bench/commands/config.py | Python | agpl-3.0 | 2,838 |
# imports - standard imports
import os
import subprocess
# imports - module imports
from bench.bench import Bench
from bench.app import get_repo_dir
from bench.utils import set_git_remote_url
from bench.utils.app import get_remote
# imports - third party imports
import click
@click.command('remote-set-url', help="S... | 2302_79757062/bench | bench/commands/git.py | Python | agpl-3.0 | 1,009 |
# imports - module imports
from bench.utils import run_playbook
from bench.utils.system import setup_sudoers
# imports - third party imports
import click
extra_vars = {"production": True}
@click.group(help="Install system dependencies for setting up Frappe environment")
def install():
pass
@click.command(
"pre... | 2302_79757062/bench | bench/commands/install.py | Python | agpl-3.0 | 3,435 |
# imports - third party imports
import click
@click.command("init", help="Initialize a new bench instance in the specified path")
@click.argument("path")
@click.option(
"--version",
"--frappe-branch",
"frappe_branch",
default=None,
help="Clone a particular branch of frappe",
)
@click.option(
"--ignore-exist", i... | 2302_79757062/bench | bench/commands/make.py | Python | agpl-3.0 | 7,178 |
# imports - standard imports
import os
import sys
# imports - third party imports
import click
# imports - module imports
from bench.utils import exec_cmd, run_playbook, which
from bench.utils.cli import SugaredOption
@click.group(help="Setup command group for enabling setting up a Frappe environment")
def setup():... | 2302_79757062/bench | bench/commands/setup.py | Python | agpl-3.0 | 12,750 |
# imports - third party imports
import click
# imports - module imports
from bench.app import pull_apps
from bench.utils.bench import post_upgrade, patch_sites, build_assets
@click.command(
"update",
help="Performs an update operation on current bench. Without any flags will backup, pull, setup requirements, build... | 2302_79757062/bench | bench/commands/update.py | Python | agpl-3.0 | 2,798 |
# imports - standard imports
import os
# imports - third party imports
import click
@click.command("start", help="Start Frappe development processes")
@click.option("--no-dev", is_flag=True, default=False)
@click.option(
"--no-prefix",
is_flag=True,
default=False,
help="Hide process name from bench start log",
)... | 2302_79757062/bench | bench/commands/utils.py | Python | agpl-3.0 | 5,331 |
"""Module for setting up system and respective bench configurations"""
def env():
from jinja2 import Environment, PackageLoader
return Environment(loader=PackageLoader("bench.config"))
| 2302_79757062/bench | bench/config/__init__.py | Python | agpl-3.0 | 190 |
# imports - standard imports
import getpass
import json
import os
default_config = {
"restart_supervisor_on_update": False,
"restart_systemd_on_update": False,
"serve_default_site": True,
"rebase_on_pull": False,
"frappe_user": getpass.getuser(),
"shallow_clone": True,
"background_workers": 1,
"use_redis_auth"... | 2302_79757062/bench | bench/config/common_site_config.py | Python | agpl-3.0 | 3,841 |
# imports - standard imports
import os
# imports - third party imports
import click
# imports - module imports
import bench
from bench.config.nginx import make_nginx_conf
from bench.config.production_setup import service
from bench.config.site_config import get_domains, remove_domain, update_site_config
from bench.be... | 2302_79757062/bench | bench/config/lets_encrypt.py | Python | agpl-3.0 | 5,423 |
# imports - standard imports
import hashlib
import os
import random
import string
# imports - third party imports
import click
# imports - module imports
import bench
import bench.config
from bench.bench import Bench
from bench.utils import get_bench_name
def make_nginx_conf(bench_path, yes=False, logging=None, log... | 2302_79757062/bench | bench/config/nginx.py | Python | agpl-3.0 | 8,544 |
import os
import platform
import click
import bench
from bench.app import use_rq
from bench.bench import Bench
from bench.utils import which
def setup_procfile(bench_path, yes=False, skip_redis=False):
config = Bench(bench_path).conf
procfile_path = os.path.join(bench_path, "Procfile")
is_mac = platform.system(... | 2302_79757062/bench | bench/config/procfile.py | Python | agpl-3.0 | 872 |
# imports - standard imports
import contextlib
import os
import logging
import sys
# imports - module imports
import bench
from bench.config.nginx import make_nginx_conf
from bench.config.supervisor import (
generate_supervisor_config,
check_supervisord_config,
)
from bench.config.systemd import generate_systemd_con... | 2302_79757062/bench | bench/config/production_setup.py | Python | agpl-3.0 | 5,574 |
# imports - standard imports
import os
import re
import subprocess
# imports - module imports
import bench
def generate_config(bench_path):
from urllib.parse import urlparse
from bench.bench import Bench
config = Bench(bench_path).conf
redis_version = get_redis_version()
ports = {}
for key in ("redis_cache",... | 2302_79757062/bench | bench/config/redis.py | Python | agpl-3.0 | 2,418 |
# imports - standard imports
import json
import os
from collections import defaultdict
def get_site_config(site, bench_path="."):
config_path = os.path.join(bench_path, "sites", site, "site_config.json")
if not os.path.exists(config_path):
return {}
with open(config_path) as f:
return json.load(f)
def put_si... | 2302_79757062/bench | bench/config/site_config.py | Python | agpl-3.0 | 3,589 |
# imports - standard imports
import getpass
import logging
import os
# imports - third party imports
import click
# imports - module imports
import bench
from bench.app import use_rq
from bench.bench import Bench
from bench.config.common_site_config import (
compute_max_requests_jitter,
get_config,
get_default_max... | 2302_79757062/bench | bench/config/supervisor.py | Python | agpl-3.0 | 5,050 |
# imports - standard imports
import getpass
import os
# imports - third partyimports
import click
# imports - module imports
import bench
from bench.app import use_rq
from bench.bench import Bench
from bench.config.common_site_config import (
get_gunicorn_workers,
update_config,
get_default_max_requests,
compute_... | 2302_79757062/bench | bench/config/systemd.py | Python | agpl-3.0 | 9,848 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Sorry! We will be back soon.</title>
<style>
body {
font-family: "Helvetica Neue", Helvetica, Arial, "Open Sans", sans-serif;
color: #36414C;
font-weight: 300;
}
.page-container {
max-width: 800px;
padding: 15px;
... | 2302_79757062/bench | bench/config/templates/502.html | HTML | agpl-3.0 | 5,444 |
{% if not skip_redis %}
redis_cache: redis-server config/redis_cache.conf
redis_queue: redis-server config/redis_queue.conf
{% endif %}
web: bench serve {% if webserver_port -%} --port {{ webserver_port }} {%- endif %}
socketio: {{ node }} apps/frappe/socketio.js
{% if not CI %}
watch: bench watch
{% endif %}
schedu... | 2302_79757062/bench | bench/config/templates/Procfile | Procfile | agpl-3.0 | 742 |
class InvalidBranchException(Exception):
pass
class InvalidRemoteException(Exception):
pass
class PatchError(Exception):
pass
class CommandFailedError(Exception):
pass
class BenchNotFoundError(Exception):
pass
class ValidationError(Exception):
pass
class AppNotInstalledError(ValidationError):
pass
... | 2302_79757062/bench | bench/exceptions.py | Python | agpl-3.0 | 528 |
import os
import importlib
def run(bench_path):
source_patch_file = os.path.join(
os.path.dirname(os.path.abspath(__file__)), "patches.txt"
)
target_patch_file = os.path.join(os.path.abspath(bench_path), "patches.txt")
with open(source_patch_file) as f:
patches = [
p.strip()
for p in f.read().splitline... | 2302_79757062/bench | bench/patches/__init__.py | Python | agpl-3.0 | 914 |
from bench.config.common_site_config import get_config
from crontab import CronTab
def execute(bench_path):
"""
This patch fixes a cron job that would backup sites every minute per 6 hours
"""
user = get_config(bench_path=bench_path).get("frappe_user")
user_crontab = CronTab(user=user)
for job in user_crontab... | 2302_79757062/bench | bench/patches/v5/fix_backup_cronjob.py | Python | agpl-3.0 | 425 |
# imports - standard imports
import getpass
import os
import subprocess
# imports - module imports
from bench.cli import change_uid_msg
from bench.config.production_setup import get_supervisor_confdir, is_centos7, service
from bench.config.common_site_config import get_config
from bench.utils import exec_cmd, get_benc... | 2302_79757062/bench | bench/patches/v5/fix_user_permissions.py | Python | agpl-3.0 | 1,806 |
from bench.config.common_site_config import update_config
def execute(bench_path):
update_config({"live_reload": True}, bench_path)
| 2302_79757062/bench | bench/patches/v5/set_live_reload_config.py | Python | agpl-3.0 | 135 |
"""
Deprecate archived_sites folder for consistency. This change is
only for Frappe v14 benches. If not a v14 bench yet, skip this
patch and try again later.
1. Rename folder `./archived_sites` to `./archived/sites`
2. Create a symlink `./archived_sites` => `./archived/sites`
Corresponding changes in frappe/frappe vi... | 2302_79757062/bench | bench/patches/v5/update_archived_sites.py | Python | agpl-3.0 | 1,342 |
if [ $TERM != 'screen' ]
then
PS1='HEY! USE SCREEN '$PS1
fi
sw() {
screen -x $1 || screen -S $1
}
| 2302_79757062/bench | bench/playbooks/roles/bash_screen_wall/files/screen_wall.sh | Shell | agpl-3.0 | 115 |
# Block IPs trying to use server as proxy.
[Definition]
failregex = <HOST>.*\" 400
<HOST>.*"[A-Z]* /(cms|muieblackcat|db|cpcommerce|cgi-bin|wp-login|joomla|awstatstotals|wp-content|wp-includes|pma|phpmyadmin|myadmin|mysql|mysqladmin|sqladmin|mypma|admin|xampp|mysqldb|pmadb|phpmyadmin1|phpmyadmin2).*" 4[\d][\d]
<HOST>... | 2302_79757062/bench | bench/playbooks/roles/fail2ban/templates/nginx-proxy-filter.conf.j2 | Jinja | agpl-3.0 | 542 |
## block hosts trying to abuse our server as a forward proxy
[nginx-proxy]
enabled = true
filter = nginx-proxy
logpath = {{ fail2ban_nginx_access_log }}
action = iptables-multiport[name=NoNginxProxy, port="http,https"]
maxretry = {{ maxretry }}
bantime = {{ bantime }}
findtime = {{ findtime }} | 2302_79757062/bench | bench/playbooks/roles/fail2ban/templates/nginx-proxy-jail.conf.j2 | Jinja | agpl-3.0 | 295 |
MailTo = {{ logwatch_emails }}
Detail = {{ logwatch_detail }} | 2302_79757062/bench | bench/playbooks/roles/logwatch/templates/logwatch.conf.j2 | Jinja | agpl-3.0 | 61 |
# MariaDB CentOS {{ ansible_distribution_major_version|int }} repository list
# http://mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/{{ mariadb_version }}/centos{{ ansible_distribution_major_version|int }}-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
| 2302_79757062/bench | bench/playbooks/roles/mariadb/templates/mariadb_centos.repo.j2 | Jinja | agpl-3.0 | 320 |
# MariaDB {{ mariadb_version }} Debian {{ ansible_distribution_release | title }} repository list
# http://mariadb.org/mariadb/repositories/
deb http://ams2.mirrors.digitalocean.com/mariadb/repo/{{ mariadb_version }}/debian {{ ansible_distribution_release | lower }} main
deb-src http://ams2.mirrors.digitalocean.com/mar... | 2302_79757062/bench | bench/playbooks/roles/mariadb/templates/mariadb_debian.list.j2 | Jinja | agpl-3.0 | 407 |
# MariaDB Ubuntu {{ ansible_distribution_release | title }} repository list
# http://mariadb.org/mariadb/repositories/
deb http://ams2.mirrors.digitalocean.com/mariadb/repo/{{ mariadb_version }}/ubuntu {{ ansible_distribution_release | lower }} main
deb-src http://ams2.mirrors.digitalocean.com/mariadb/repo/{{ mariadb_v... | 2302_79757062/bench | bench/playbooks/roles/mariadb/templates/mariadb_ubuntu.list.j2 | Jinja | agpl-3.0 | 385 |
[client]
user=root
password={{ mysql_root_password }}
| 2302_79757062/bench | bench/playbooks/roles/mariadb/templates/my.cnf.j2 | Jinja | agpl-3.0 | 54 |
user {{ nginx_user }};
worker_processes auto;
worker_rlimit_nofile 65535;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections {{ nginx_worker_connections or 2048 }};
multi_accept on;
}
http {
include /etc/nginx/mime.types;
default_type applic... | 2302_79757062/bench | bench/playbooks/roles/nginx/templates/nginx.conf.j2 | Jinja | agpl-3.0 | 1,916 |
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/{{ ansible_distribution_major_version }}/$basearch/
gpgcheck=0
enabled=1
| 2302_79757062/bench | bench/playbooks/roles/nginx/templates/nginx.repo.j2 | Jinja | agpl-3.0 | 138 |
{% for vhost in nginx_vhosts %}
server {
listen {{ vhost.listen | default('80 default_server') }};
server_name {{ vhost.server_name }};
root {{ vhost.root }};
index {{ vhost.index | default('index.html index.htm') }};
{% if vhost.error_page is defined %}
error_page {{ vhost.error_page }};
... | 2302_79757062/bench | bench/playbooks/roles/nginx/templates/vhosts.j2 | Jinja | agpl-3.0 | 626 |
# imports - standard imports
import json
import logging
import os
import re
import subprocess
import sys
import hashlib
from functools import lru_cache
from glob import glob
from pathlib import Path
from shlex import split
from tarfile import TarInfo
from typing import List, Optional, Tuple
# imports - third party imp... | 2302_79757062/bench | bench/utils/__init__.py | Python | agpl-3.0 | 15,707 |
# imports - standard imports
import os
import pathlib
import re
import sys
import subprocess
from typing import List, Optional
from functools import lru_cache
# imports - module imports
from bench.exceptions import (
InvalidRemoteException,
InvalidBranchException,
CommandFailedError,
VersionNotFound,
)
from bench.... | 2302_79757062/bench | bench/utils/app.py | Python | agpl-3.0 | 8,965 |
# imports - standard imports
import contextlib
import json
import logging
import os
import re
import shutil
import subprocess
import sys
from functools import lru_cache
from glob import glob
from json.decoder import JSONDecodeError
from pathlib import Path
# imports - third party imports
import click
# imports - modu... | 2302_79757062/bench | bench/utils/bench.py | Python | agpl-3.0 | 21,945 |
from typing import List
import click
from click.core import _check_multicommand
def print_bench_version(ctx, param, value):
"""Prints current bench version"""
if not value or ctx.resilient_parsing:
return
import bench
click.echo(bench.VERSION)
ctx.exit()
class MultiCommandGroup(click.Group):
def add_comma... | 2302_79757062/bench | bench/utils/cli.py | Python | agpl-3.0 | 2,320 |
# imports - standard imports
import sys
from io import StringIO
# imports - third party imports
import click
# imports - module imports
import bench
class Capturing(list):
"""
Util to consume the stdout encompassed in it and push it to a list
with Capturing() as output:
subprocess.check_output("ls", sh... | 2302_79757062/bench | bench/utils/render.py | Python | agpl-3.0 | 2,890 |
# imports - standard imports
import grp
import os
import pwd
import shutil
import sys
# imports - module imports
import bench
from bench.utils import (
exec_cmd,
get_process_manager,
log,
run_frappe_cmd,
sudoers_file,
which,
is_valid_frappe_branch,
)
from bench.utils.bench import build_assets, clone_apps_from
f... | 2302_79757062/bench | bench/utils/system.py | Python | agpl-3.0 | 5,151 |
# imports - standard imports
import itertools
import json
import os
def update_translations_p(args):
import requests
try:
update_translations(*args)
except requests.exceptions.HTTPError:
print("Download failed for", args[0], args[1])
def download_translations_p():
import multiprocessing
pool = multiproce... | 2302_79757062/bench | bench/utils/translation.py | Python | agpl-3.0 | 1,333 |
_bench_completion() {
# Complete commands using click bashcomplete
COMPREPLY=( $( COMP_WORDS="${COMP_WORDS[*]}" \
COMP_CWORD=$COMP_CWORD \
_BENCH_COMPLETE=complete $1 ) )
if [ -d "sites" ]; then
# Also add frappe commands if present
# bench_helper.py ex... | 2302_79757062/bench | completion.sh | Shell | agpl-3.0 | 1,415 |
#!/usr/bin/env python3
import argparse
import fileinput
import logging
import os
import platform
import subprocess
import sys
import time
import urllib.request
from shutil import move, unpack_archive, which
from typing import Dict
logging.basicConfig(
filename="easy-install.log",
filemode="w",
format="%(asctime)s ... | 2302_79757062/bench | easy-install.py | Python | agpl-3.0 | 9,743 |
__version__ = "2.0.0-dev"
__title__ = "Frappe CRM"
| 2302_79757062/crm | crm/__init__.py | Python | agpl-3.0 | 53 |
from bs4 import BeautifulSoup
import frappe
from frappe.translate import get_all_translations
from frappe.utils import validate_email_address, split_emails, cstr
from frappe.utils.telemetry import POSTHOG_HOST_FIELD, POSTHOG_PROJECT_FIELD
@frappe.whitelist(allow_guest=True)
def get_translations():
if frappe.session.... | 2302_79757062/crm | crm/api/__init__.py | Python | agpl-3.0 | 3,048 |
import json
import frappe
from frappe import _
from frappe.utils.caching import redis_cache
from frappe.desk.form.load import get_docinfo
@frappe.whitelist()
def get_activities(name):
if frappe.db.exists("CRM Deal", name):
return get_deal_activities(name)
elif frappe.db.exists("CRM Lead", name):
return get_lead... | 2302_79757062/crm | crm/api/activities.py | Python | agpl-3.0 | 8,692 |
import frappe
@frappe.whitelist(allow_guest=True)
def oauth_providers():
from frappe.utils.html_utils import get_icon_html
from frappe.utils.password import get_decrypted_password
from frappe.utils.oauth import get_oauth2_authorize_url, get_oauth_keys
out = []
providers = frappe.get_all(
"Social Login Key",
... | 2302_79757062/crm | crm/api/auth.py | Python | agpl-3.0 | 1,098 |
from collections.abc import Iterable
import frappe
from frappe import _
from bs4 import BeautifulSoup
def on_update(self, method):
notify_mentions(self)
def notify_mentions(doc):
"""
Extract mentions from `content`, and notify.
`content` must have `HTML` content.
"""
content = getattr(doc, "... | 2302_79757062/crm | crm/api/comment.py | Python | agpl-3.0 | 2,857 |
import frappe
from frappe import _
def validate(doc, method):
set_primary_email(doc)
set_primary_mobile_no(doc)
doc.set_primary_email()
doc.set_primary("mobile_no")
def set_primary_email(doc):
if not doc.email_ids:
return
if len(doc.email_ids) == 1:
doc.email_ids[0].is_primary = 1
def set_primary_mobil... | 2302_79757062/crm | crm/api/contact.py | Python | agpl-3.0 | 3,833 |
import frappe
import json
from frappe import _
from frappe.model.document import get_controller
from frappe.model import no_value_fields
from pypika import Criterion
from frappe.utils import make_filter_tuple
from crm.api.views import get_views
from crm.fcrm.doctype.crm_form_script.crm_form_script import get_form_scri... | 2302_79757062/crm | crm/api/doc.py | Python | agpl-3.0 | 20,501 |
import frappe
from frappe.query_builder import Order
@frappe.whitelist()
def get_notifications():
Notification = frappe.qb.DocType("CRM Notification")
query = (
frappe.qb.from_(Notification)
.select("*")
.where(Notification.to_user == frappe.session.user)
.orderby("creation", o... | 2302_79757062/crm | crm/api/notifications.py | Python | agpl-3.0 | 2,052 |
import frappe
@frappe.whitelist()
def get_users():
users = frappe.qb.get_query(
"User",
fields=["name", "email", "enabled", "user_image", "first_name", "last_name", "full_name", "user_type"],
order_by="full_name asc",
distinct=True,
).run(as_dict=1)
for user in users:
if frappe.session.user == user.name... | 2302_79757062/crm | crm/api/session.py | Python | agpl-3.0 | 1,741 |
import frappe
def after_insert(doc, method):
if doc.reference_type in ["CRM Lead", "CRM Deal"] and doc.reference_name and doc.allocated_to:
fieldname = "lead_owner" if doc.reference_type == "CRM Lead" else "deal_owner"
lead_owner = frappe.db.get_value(doc.reference_type, doc.reference_name, fieldname)
if not le... | 2302_79757062/crm | crm/api/todo.py | Python | agpl-3.0 | 421 |
import frappe
from pypika import Criterion
@frappe.whitelist()
def get_views(doctype):
View = frappe.qb.DocType("CRM View Settings")
query = (
frappe.qb.from_(View)
.select("*")
.where(Criterion.any([View.user == '', View.user == frappe.session.user]))
)
if doctype:
query = query.where(View.dt == doctype)... | 2302_79757062/crm | crm/api/views.py | Python | agpl-3.0 | 367 |
import frappe
import json
from frappe import _
from crm.api.doc import get_assigned_users
def validate(doc, method):
if doc.type == "Incoming" and doc.get("from"):
name, doctype = get_lead_or_deal_from_number(doc.get("from"))
doc.reference_doctype = doctype
doc.reference_name = name
def ... | 2302_79757062/crm | crm/api/whatsapp.py | Python | agpl-3.0 | 10,345 |
// Copyright (c) 2023, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt
// frappe.ui.form.on("CRM Call Log", {
// refresh(frm) {
// },
// });
| 2302_79757062/crm | crm/fcrm/doctype/crm_call_log/crm_call_log.js | JavaScript | agpl-3.0 | 195 |
# Copyright (c) 2023, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
import frappe
from frappe.model.document import Document
class CRMCallLog(Document):
@staticmethod
def default_list_data():
columns = [
{
'label': 'From',
'type': 'Link',
'... | 2302_79757062/crm | crm/fcrm/doctype/crm_call_log/crm_call_log.py | Python | agpl-3.0 | 2,006 |
// Copyright (c) 2023, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt
// frappe.ui.form.on("CRM Communication Status", {
// refresh(frm) {
// },
// });
| 2302_79757062/crm | crm/fcrm/doctype/crm_communication_status/crm_communication_status.js | JavaScript | agpl-3.0 | 207 |
# Copyright (c) 2023, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
# import frappe
from frappe.model.document import Document
class CRMCommunicationStatus(Document):
pass
| 2302_79757062/crm | crm/fcrm/doctype/crm_communication_status/crm_communication_status.py | Python | agpl-3.0 | 227 |
# Copyright (c) 2023, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
# import frappe
from frappe.model.document import Document
class CRMContacts(Document):
pass
| 2302_79757062/crm | crm/fcrm/doctype/crm_contacts/crm_contacts.py | Python | agpl-3.0 | 216 |
import frappe
from frappe import _
from crm.api.doc import get_fields_meta, get_assigned_users
from crm.fcrm.doctype.crm_form_script.crm_form_script import get_form_script
@frappe.whitelist()
def get_deal(name):
Deal = frappe.qb.DocType("CRM Deal")
query = (
frappe.qb.from_(Deal)
.select("*")
.where(Deal.nam... | 2302_79757062/crm | crm/fcrm/doctype/crm_deal/api.py | Python | agpl-3.0 | 1,843 |